CPP wrapper mishandles -A- (was: cpp bug?)

Daniel Jacobowitz dan@debian.org
Wed Jul 21 17:12:00 GMT 1999


I see the problem.

-A- clears any predefined macros, and any macros before it on the
command line.  But the cpp wrapper places the -A- _before_ the macros
gcc wants predefined!

$ cpp -v -A- -dM /dev/null
 /usr/lib/gcc-lib/powerpc-debian-linux-gnu/2.95/cpp -lang-c -v -A-
-DPPC -D__ELF__ -Dpowerpc -D__PPC__ -D__ELF__ -D__powerpc__ -D__PPC
-D__powerpc -Acpu(powerpc) -Amachine(powerpc) -D__CHAR_UNSIGNED__ -dM
-D_CALL_SYSV -D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine(bigendian)
-D_ARCH_PPC -D__unix__ -D__linux__ -Dunix -Dlinux -Asystem(unix)
-Asystem(posix) /dev/null


If the cpp from /usr/lib/gcc-lib/powerpc-debian-linux-gnu/2.95/ is
invoked directly, with or without -A-, it has no predefines.  If it is
invoked from /usr/bin/cpp with or without -A-, it does have predefines.

Does this patch put -A options in a more appropriate place?



On Wed, Jul 21, 1999 at 02:50:38PM -0700, Jim Pick wrote:
> Hi,
> 
> I encountered this when trying to figure out how come my control.in
> wasn't coming out right.  I was getting "Architecture: 1", not
> "Architecture: ARM".
> 
> Normally, cpp defines some default macros (a.k.a. assertions).
> 
> # cpp /dev/null -dM
> #define __linux__ 1 
> #define __ARM_ARCH_3__ 1 
> #define __arm_elf 1 
> #define arm_elf 1 
> #define __arm__ 1 
> #define linux 1 
> #define __arm 1 
> #define __arm_elf__ 1 
> #define arm 1 
> #define __CHAR_UNSIGNED__ 1 
> #define __unix 1 
> #define __unix__ 1 
> #define __APCS_32__ 1 
> #define __linux 1 
> #define __ELF__ 1 
> #define unix 1 
> 
> The -A- option (as used by the gcc debian/rules) is supposed to turn
> these off.  But with the cpp supplied with 2.95 doesn't do this.  I
> verified this on i386 and ARM.
> 
> Cheers,
> 
>  - Jim
> 
> 
> --  
> To UNSUBSCRIBE, email to debian-toolchain-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 


Dan

/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|        SCS Class of 2002       |
|   Debian GNU/Linux Developer    __    Carnegie Mellon University   |
|         dan@debian.org         |  |       dmj+@andrew.cmu.edu      |
\--------------------------------/  \--------------------------------/


More information about the Gcc-bugs mailing list