Issue #3 with clang-analyzer on RTEMS


Third problem...

RTEMS has some standard multilib libraries and headers and
some that are board (e.g. BSP) dependent. We use a -B... option
to gcc. So -BDIR adds DIR/include to the include path. The analyser
seems to be not recognizing that option. So it can't find the BSP
dependent .h files.

This final issue prevents it from analysing the RTEMS test suite
completely. And most of the board dependent source code in RTEMS.
Together these constitute the bulk of our source code. So we are
only able to analyse ~100K SLOC of ~750K SLOC of code.


--joel sherrill

Implementing this reduces down to modifying the driver to recognize -B (and its options) and then possibly modifying the preprocessor (if necessary) to add the additional include paths in the correct order. I don't think this would require modifying the preprocessor itself since -B seems very similar to -I, and the preprocessor just thinks about include directories, not command line options.

We may wish to only enable -B for specific targets, but I don't have a strong opinion.

I think the way to approach this problem is to first take the analyzer out of it, and try getting some source going through 'clang -fsyntax-only' (i.e., just parse and type check my code) with the -B option. For example:

$ clang -fsyntax-only -B<stuff> t.c

Once that is working, ccc-analyzer needs to be modified to also forward the -B option on to clang, but that is trivial.