This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gnerating deps with cpp
On Saturday 04 November 2000 03:38, Alexandre Oliva wrote:
> On Nov 2, 2000, Victor Secarin <vsecarin@ParadigmGeo.com> wrote:
> > I am using gcc 2.95.2 and the cpp that comes with it.
> > When I compile, the compiler defines __GNUC__ ; however, if I generate
> > deps with cpp (rather than with gcc -M) then I need to define __GNUC__
> > by hand (or else my header files will work differently which of course
> > is bad).
> > Is there a reason?
>
> Note that there are two different programs named `cpp' in GCC 2.95.2.
> One is an internal program, installed inside gcc-lib just like `cc1'
> and `cc1plus', that are supposed to be called only by the compilation
> driver, called `gcc', that runs it with all the appropriate flags,
> including the ones that defines pre-defined symbols. The other,
> installed in the `bin' directory, is a driver just like `gcc', that
> figures out the appropriate set of flags and calls the internal
> program.
>
> Some people have the bad habit of using the former instead of the
> latter. Sometimes, you'll even find links to the former in /lib.
> This is certainly a bad idea. Make sure you use the `cpp' driver, not
> the internal program.
>
> IIRC, In the development tree, the internal preprocessor program was
> renamed to `cpp0', to avoid this kind of confusion.
I think he is using the right cpp, cause even with current CVS I get:
[fsirl@enzo:~]$ gcc -E -dM - </dev/null | sort
#define PPC 1
#define _ARCH_PPC 1
#define _BIG_ENDIAN 1
#define _CALL_SYSV 1
#define __BIG_ENDIAN__ 1
#define __CHAR_UNSIGNED__ 1
#define __ELF__ 1
#define __GNUC_MINOR__ 97
#define __GNUC_PATCHLEVEL__ 0
#define __GNUC__ 2
#define __HAVE_BUILTIN_SETJMP__ 1
#define __PPC 1
#define __PPC__ 1
#define __PTRDIFF_TYPE__ int
#define __REGISTER_PREFIX__
#define __SIZE_TYPE__ unsigned int
#define __STDC_HOSTED__ 1
#define __USER_LABEL_PREFIX__
#define __VERSION__ "2.97 20001106 (experimental)"
#define __WCHAR_TYPE__ long int
#define __WINT_TYPE__ unsigned int
#define __linux 1
#define __linux__ 1
#define __powerpc 1
#define __powerpc__ 1
#define __unix 1
#define __unix__ 1
#define linux 1
#define powerpc 1
#define unix 1
[fsirl@enzo:~]$ cpp -dM - </dev/null | sort
#define PPC 1
#define _ARCH_PPC 1
#define _BIG_ENDIAN 1
#define _CALL_SYSV 1
#define __BIG_ENDIAN__ 1
#define __CHAR_UNSIGNED__ 1
#define __ELF__ 1
#define __HAVE_BUILTIN_SETJMP__ 1
#define __PPC 1
#define __PPC__ 1
#define __PTRDIFF_TYPE__ int
#define __REGISTER_PREFIX__
#define __SIZE_TYPE__ unsigned int
#define __STDC_HOSTED__ 1
#define __USER_LABEL_PREFIX__
#define __VERSION__ "2.97 20001106 (experimental)"
#define __WCHAR_TYPE__ long int
#define __WINT_TYPE__ unsigned int
#define __linux 1
#define __linux__ 1
#define __powerpc 1
#define __powerpc__ 1
#define __unix 1
#define __unix__ 1
#define linux 1
#define powerpc 1
#define unix 1
So if you use /usr/bin/cpp, you'll miss __GNUC__, __GNUC_MINOR__ and
__GNUC_PATCHLEVEL__, no idea if this is intended.
Franz.