Open martong opened 7 years ago
I think we set only one flag (-analyzer-opt-analyze-headers
) to analyze the headers in clangsa here:
https://github.com/Ericsson/codechecker/blob/ab67d2626297da41ec42afa2cbb404538069db1f/libcodechecker/analyze/analyzers/analyzer_clangsa.py#L112-L115
If we remove this I think we will not get errors from the header files (system or non system headers).
If an include path is set with the -isystem
argument it should be skipped from the analysis or from the reporting in clang maybe the-analyzer-opt-analyze-headers
overwrites this behavior? .
Maybe we can improve this if we set this argument for clang:
--system-header-prefix=<prefix> Treat all #include paths starting with <prefix> as including a system header.
In some cases, the static analyzer has special heuristics for functions from system headers. So it might be better to use skiplist than -isystem
.
Has there been any update here? I am still getting errors from header folders included with -isystem. I have also been adding the individual headers to the skipfile which does not seem to work. I have added it as an absolute path and a relative path with no success. The issue with an absolute path is that CI pipelines may run with paths that are not known at the time of generating the skip file.
Both GCC and Clang do not report any warning from system headers (those which are included with the "-isystem" option). Users of -isystem typically want to suppress noise from third party libraries, e.g. https://stackoverflow.com/questions/1867065/how-to-suppress-gcc-warnings-from-library-headers We should follow this tradition and should skip errors from system headers.