On Windows only: complaints about unknown C standard

sonarcfamily
scanner

(dexter) #1

Hi,

I have a strange behavior when I scan my C/C++ code in Windows. I have the following error for every file:

Unknown language standard “”, will use “c11” from “sonar.c.std” for file XYZ.c

When I run the scanner for the same code on Linux, I have no such error.

Can you tell me the origin of this error ?

Thanks


(Loïc Joly) #2

Hello dexter,

Are you using the build wrapper to configure the analysis? If you are not, well, you should, for the two following reasons:

  • It will automatically detect versions and other options with a file by file granularity
  • It is now required with the latest versions of SonarCFamily (since version 6.0, which is in the release pipeline for SonarQube as I am writing this answer).

Hope this helps


(dexter) #3

Hi,

I am using the build wrapper. Our script is the same in Linux and Windows, it uses the build wrapper.


(Loïc Joly) #4

Ok, so could you please attach to this post the two files generated by the build wrapper (build-wrapper-dump.json and build-wrapper.log)?

Thank you


(dexter) #5

Here are the files:

build-wrapper.log.txt (1.6 MB)

build-wrapper-dump.json.txt (692.7 KB)

Thanks


(Loïc Joly) #6

Hello again,

I’m sorry, but I forgot to ask you the logs from the scanner too…


(dexter) #7

Here it is.

scanner.log.txt (30.3 KB)


(Loïc Joly) #8

Hello Dexter, and thank you for those files.

From them, we can see that you are using gcc 8.1 that by default supports C18 in C mode (I guess you are using another compiler on Linux).

We don’t yet support it (a ticket has just been created about that), which is why you see this message. Since C11 and C18 are very similar, though, you should not have any issue and can just ignore that message.

However, we advise you not to update your CFamily plugin to the 6.x for the time being, since the message that see has been moved to a hard error, which will fail your analysis.

Another way to go would be to change your build script to specify -std=c11 on your compiler command line. It would work both with no message (CFamily 5.x) and no error (CFamily 6.x), as well as being more accurate about what version of the standard you use for building.

Hope this helps,


(dexter) #9

Hello Loïc,

Thanks for this. You are right we are using gcc 8.1 in Windows and 7.3 on Linux.
That’s too bad I asked for this too late, I just updated the CFamily yesterday :frowning:

So i will change the build script.

Thanks a lot.