emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CEDET calls cpp -E -dM -x c++ /dev/null


From: Miles Bader
Subject: Re: CEDET calls cpp -E -dM -x c++ /dev/null
Date: Fri, 03 Jul 2009 09:46:17 +0900

Lennart Borgman <address@hidden> writes:
> Thanks, there are more env vars for this, see
> http://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
>
> From the page http://www.mingw.org/wiki/IncludePathHOWTO it looks like
> the way to get the include path used by gcc is something like
>
>    touch temp.c
>    gcc -v -c temp.c -o NUL (or /dev/null)

Better to use something like this:  gcc -v -E -x c /dev/null
which doesn't require an input file or run unnecessary passes of the compiler.
(substitute NUL on windows)

> I believe this works on all os:es with gcc. It seems to include CPATH
> and C_INCLUDE_PATH etc. However do not quite understand the output and
> how to parse it. Could someone explain?

This part of the output seems to have pretty well-defined markers, and
lists the include directories one per line:

   #include "..." search starts here:
   #include <...> search starts here:
    /usr/local/include
    /usr/lib/gcc/x86_64-linux-gnu/4.3.3/include
    /usr/lib/gcc/x86_64-linux-gnu/4.3.3/include-fixed
    /usr/include
   End of search list.

Looks easy enough to parse (since there's a space prepended to each
directory line, you don't even have to worry about a directory called
"End of search list.", though an embedded newline might cause a
mess... :).

Thanks,

-Miles

-- 
Learning, n. The kind of ignorance distinguishing the studious.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]