Ericsson / codechecker

CodeChecker is an analyzer tooling, defect database and viewer extension for the Clang Static Analyzer and Clang Tidy
https://codechecker.readthedocs.io
Apache License 2.0
2.23k stars 373 forks source link

[analyzer] Adds -fno-freestanding to ignored GCC compiler flags #4281

Closed ArchieAtkinson closed 2 months ago

ArchieAtkinson commented 3 months ago

-ffreestanding and -fno-freestanding are common in embedded systems but clang does not support it. This PR adds them both to the ignored GCC compiler flags list.

bruntib commented 3 months ago

Is it possible that only an old Clang version doesn't support this flag? I can see this in the current Clang docs: https://clang.llvm.org/docs/CommandGuide/clang.html#cmdoption-ffreestanding

ArchieAtkinson commented 2 months ago

Is it possible that only an old Clang version doesn't support this flag? I can see this in the current Clang docs: https://clang.llvm.org/docs/CommandGuide/clang.html#cmdoption-ffreestanding

Odd, I'm running 17.0.6 and I get this:

[INFO 2024-07-04 18:39] - Starting static analysis ...
[ERROR 2024-07-04 18:39] - Analyzing main.cpp with clang-tidy  failed!
[ERROR 2024-07-04 18:39] - 
error: unknown argument: '-fno-freestanding' [clang-diagnostic-error]

[ERROR 2024-07-04 18:39] - 
ArchieAtkinson commented 2 months ago

Is it possible that only an old Clang version doesn't support this flag? I can see this in the current Clang docs: https://clang.llvm.org/docs/CommandGuide/clang.html#cmdoption-ffreestanding

Updated to only ignore -fno-freestanding, which isn't supported by clang (Godbolt) while -freestanding is (Godbolt)