Using the default C++ quality profile instead of the custom C quality profile


  • I am using SonarQube Developer Edition Version 8.8 (build 42792)
  • I am using sonar-scanner-cli-
  • I created a quality profile containing all rules from the C language
  • I followed everything from C/C++/Objective-C | SonarQube Docs (installed build wrapper, configuration, …)


  • Running the scanner with the associated build-wrapper inputs is functional, no errors are raised by the scanner
  • Looking at the results in SonarQube, I see that actually the default C++ quality profile is being used instead of my custom made C quality profile

Running with verbose logs shows:

  • CFamily Code Quality and Security (cpp)
  • Declared extensions of language C were converted to sonar.lang.patterns.c : /*.c,/*.h
  • DEBUG: β€˜<file_name>.c’ indexed with language β€˜c’
  • Sensor CFamily [cpp] seems to be running which is parsing all my c files

So, what I can conclude so far:

  • The source files are correctly parsed and attached to the β€˜c’ language
  • For some reason, the cpp scanner is running and it uses the (only) default C++ quality profile instead of the default C quality profile which I created

Any ideas?

Valentin Vasiu

Hi @valentin ,

this can happen if your files are compiled as C++, you can check if in your build you are specifying -x c++.

To double check that please share the build-wrapper-output folder.

Hi @mpaladin ,

Sorry, I can’t provide the output of the build wrapper due to legal issues, but what I can say is that I am using the arm-none-eabi-g++.exe compiler for compiling the source code, and yes, I see β€œ-x” and β€œc++” options in the build wrapper output.

So, it’s a kind of cross-compiling in using a c++ compiler on a c code, but those are the project constraints.

Is there any way around this, to force the usage of C-only quality profiles? As my code is pure C code, so if I would try to use a C++ quality profile I will get a lot of false errors, which do not apply on C code.


Hi @valentin ,

no, there is no way, I would really recommend you to change from -x c++ to -x c if the source code is really C code.

Hi @mpaladin

Thanks for the clarification and your help.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.