False positive cpp:SingleDeclarationPerStatement

Today I got an issue that is clearly a false positve:

In case, the types are relevant:

   typedef   size_t Index;
   typedef uint32_t Id;

This only occured with gcc arm32 compiler, other targets did not show this error.

Workaround: Add typedef for the map.

Versions:

SonarQube Server 7.9.6 LTS
“cpp”: “6.8.0.16475 [SonarCFamily]”,

Hi @KUGA2 ,

This indeed looks strange.

Do you have parsing errors in this file? (you can see them by activating the debug log)?

Could you create and send us a reproducer for the file that exhibits this problem? For that, the property sonar.cfamily.reproducer should be set to the path of that file (exactly as it appears in the log). The analysis will stop, but a zip will be generated that will contain all the information we need to reproduce this issue on our side.

Thank you!

Can you link me the doc for sonar.cfamily.reproducer?

Since this is not something that would be of any use to our users unless they are in contact with us, it’s not documented.

Is there something unclear in the instructions I gave before?

I need information about what is shared with you, before I can send you the file. I need to check with our managers, if I can share the code and for this, it would be best to present a documentation that states the content.

Hi @KUGA2,

Even if the created reproducer files might be a little bit cryptic, they are in now way encrypted, so you can have a manual look at their content before sending them to us, if that can be of help to you.

The program will generate a .zip that contains several files. The main file we need is the .reproducer file. This file contains at the top all the configuration that was used to analyze the source code (macros passed on command line, rule parameters…), then it contains the content of the analyzed file, as well as the content of any header included (directly or indirectly) in this file.

On our side, we have a tool that can use this information to perform in our debug environment the exact same analysis that you did on yours, thus allowing us to reproduce and understand the issue.

I hope this is the kind of information you needed,

Thanks,

By the way, you are not yet running the latest LTS version of our product. You could also try to upgrade to see if this issue is still there…