Sonar-scanner & GCC, error & warnings

I am trying to scan C source file developed for a bare-metal application for an ADI blackfin processor. I am using the specific gcc toolchain for such target. All the above run on a windows based PC.
Attached the output from the build-wrapper and from the sonar-scanner.
With reference to the last one, there are plenty of warnings and errors, in particular:
WARNING: An illegal reflective access operation has occurred
14:41:12.270 ERROR: unknown target triple ‘bfin-unknown-unknown-elf’, please use -triple or -arch
14:41:12.270 WARN: C:/Microdev/software/flexappl_NewTL/Application/…/black_box.c: unknown target “bfin-elf”, using “x86_64-unknown-unknown” instead

I would like to fix them or, at least, to be sure they are harmless.

build-wrapper.log.txt (321.8 KB) build-wrapper-dump.json.txt (141.6 KB)
scanner.log.txt (140.0 KB)

Hi @mannuan,

I confirm that you can accept them. We are using Clang frontend as core of our analyzer which doesn’t know the target for which you are compiling bfin-elf, this is why we are setting x86_64-unknown-unknown as target instead.

They only issue is that you may encounter some false-positives on rules related to size of types as the target is mainly used to set the default types size.

Hi Massimo,

thank you for your answer.
Actually I received plenty of false posistives related to size of types, is it possible to somehow override the default size of types?


Hi @mannuan,

it is not possible to override but we could look at adding special handling for blackfin to map it to good types size. I don’t know blackfin architecture, I see that it can be 16 or 32 bits, what are you using in your case?

Another alternative would be to compile with a more common architecture or to disable the rules giving false positives for size of types, even if you say that you are getting plenty of false positives they all might be related to few rules.

Hi Massimo,

here the blackfin native data types

char: 8-bit signed integer

unsigned char: 8-bit unsigned integer

short: 16-bit signed integer

unsigned short: 16-bit unsigned integer

int: 32-bit signed integer

unsigned int: 32-bit unsigned integer

long: 32-bit signed integer

unsigned long: 32-bit unsigned integer

memory addresses are 32 bit

It would be nice to keep active the rules that helps to check types consistency.

Hi @mannuan,

thank you, I can see them in the scanner.log.txt output, in the predefined macros.

Hi @mannuan,

FYI I created a ticket to track your request, no ETA promise on that: CPP-2334.

A post was split to a new topic: Custom SonarCFamily default target to be used for unknown targets