Bug 29546 - Wrong preprocessing when value of a define is "powerpc"
Summary: Wrong preprocessing when value of a define is "powerpc"
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-22 12:59 UTC by Guillaume Libersat
Modified: 2006-10-22 14:15 UTC (History)
1 user (show)

See Also:
Host: powerpc-linux-gnu
Target: powerpc-linux-gnu
Build: powerpc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Libersat 2006-10-22 12:59:50 UTC
When you want to set the "powerpc" string as a value of a define (-D or #define), you get the integer value 1 instead of the string.

Here's an example :

test.c :
-----
Arch = ARCH
-----

With the "powerpc" string (bug) :
gcc -E -DARCH=powerpc test.c

Result is :
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.c"
Arch = 1

With another string (no bug) :
gcc -E -DARCH=ia32 test.c

Result is :
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.c"
Arch = ia32


== GCC Config ==
Using built-in specs.
Target: powerpc-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --disable-softfloat --enable-targets=powerpc-linux,powerpc64-linux --with-cpu=default32 --enable-checking=release powerpc-linux-gnu
Thread model: posix
gcc version 4.1.2 20061007 (prerelease) (Debian 4.1.1-16)
Comment 1 Richard Biener 2006-10-22 13:21:23 UTC
powerpc is one of the standard defines gcc defines if running on ppc-linux.  It is changed to __powerpc if you define powerpc yourself.
Comment 2 Andrew Pinski 2006-10-22 14:15:55 UTC
Note if you add -pedantic or -ansi or -std=c99 or -std=c89, powerpc will not be defined as it is not in the reserved space.