[cfe-dev] Issue #3 with clang-analyzer on RTEMS

Ted Kremenek kremenek at apple.com
Wed Sep 29 09:57:07 PDT 2010


On Sep 24, 2010, at 6:07 AM, Joel Sherrill <joel.sherrill at oarcorp.com> wrote:

>  Hi,
> 
> 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.

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.



More information about the cfe-dev mailing list