Oodini
(Robert)
June 26, 2025, 1:07pm
1
Hi,
I am using SonarCloud for C++ with the scanner 6.66.
I get quite often S5536 issues (" Functions that are not used in a project should be removed"), for functions actually used.
I am studying now 4 occurrences of this issue:
1st case: constructor whose one argument was implicitely converted ; I added the explicit conversion, and it the issue disappeared
2nd case: the function is called from a list of arguments, and is called from a Qt slot (directly or indirectly)
3rd case: the function is static, and has an argument which doesn’t respect a pattern
4th case: the function is called from a Qt slot (directly or indirectly)
Colin
(Colin)
June 27, 2025, 7:50am
2
Hey @Oodini
Always appreciate your reports, but our devs need code samples in order to investigate effectively.
Oodini
(Robert)
June 27, 2025, 4:55pm
7
Hi,
Here is a precise scenario. S5536 is raised when a static member function is called from within one of the class’s function, without the scope operator. At least when the calling function is static
.
class Foo
{
static void Bar1() {};
static void Bar2() { Bar1(); }; // Bar1 unused
// static void Bar2() { Foo::Bar1(); }; // OK}
;
JolyLoic
(LoĂŻc Joly)
June 30, 2025, 12:46pm
8
Hi @Oodini ,
I tried to reproduce your issue, but in my test, the call to Bar1
was detected, as you can see here .
Could you provide us with a full project that can showcase the issue? (maybe an open-source project that you would analyze on SonarQube Cloud)
Oodini
(Robert)
June 30, 2025, 2:12pm
9
No, I can’t, it isn’t open source (and anyway, I am too ashamed on this legacy code :)).
I must confess I havn’t tested the sample I provided, but I have “cleaned” some issues by adding this scope operator for static functions.
I am going to setup an empty open source project to be able to submit some problematic code to Sonar.
1 Like
JolyLoic
(LoĂŻc Joly)
July 1, 2025, 3:57pm
10
This is what I had in mind. Thank you for making this effort!