Custom SonarCFamily default target to be used for unknown targets

Thanks for the question and answer, I found this thread very useful as I’m looking in to use SonarQube for Embedded C/C++ software.

@mpaladin Previously you mentioned that Sonar-scanner selects the x86_64-unknown-unknown if it doesn’t know the target. My question is, if Sonar-Scanner doesn’t know the target, is it possible to force Sonar-Scanner to use a processor architecture as the target that is a closer match to the actual target or do you have to use “x86_64-unknown-unknown”? If the former is possible, how could I do this?

Hi @TomPughe,

No, it is not possible at the moment, it is hardcoded and not customisable.

Which compiler and architecture did you try to use?

Hi @mpaladin
Thanks for the quick response.

I’m currently working with a trial version of SonarQube to check out how well it’s SonarCFamily analysis performs. The projects I work on frequently require propitiatory gcc based compilers for embedded software, so I was interested in checking in general terms how it handles analysis for these compiler types. I have been trying it out on an existing C code base that requires the Microchip MPLAB xc16-gcc compiler (and have been able to run analysis successfully). However, that was just to see how it works in practice rather than being specifically interested in using Sonar-Scanner with that compiler.

Hi @TomPughe,

we are using Clang frontend for the core of our analyzer, we currently supports targets supported by Clang itself plus we have some customization for some IAR architectures.

We may add support for more compilers/architectures in the future.

If the compilers respect gcc naming and its command line interface they would work with our analyzer.