SonarQube Error with no code mistakes

Hi Sonarsource Team,

We have a problem when anylsing a C/C++ code. We are getting below error even when the variables are declared as different statements.

Server & Scanners used:
Server: 7.9.1 LTS
Scanner: 3.3.0

Could you please help us to avoid these errors? As of now, we are marking them as ‘Resolved as false positive’ with a bulk change.

Thanks & Regards,
Madhuvanthi Yellur

Hello @MY123,

Welcome to the community and sorry for the late reply.
This seems like a false-positive. It might be due to failure in parsing some part of your code. To help investigate the problem please generate and share the reproducer file:

  • Add the reproducer option to the scanner configuration:
    sonar.cfamily.reproducer= "Full path to the .cpp file that has or include the file that has the false-positive"
  • Re-running the scanner should generate a file named sonar-cfamily.reproducer in the project directory.
  • Please share this file. if you think this file contains private information you can send it privately.