cpp internal #defines

Manfred Hollstein manfred@s-direktnet.de
Thu Sep 24 02:37:00 GMT 1998


On Wed, 23 September 1998, 22:54:09, cpbotha@sun.ac.za wrote:

 > Dear list,
 > 
 > Excuse me if this is known or it has been discussed, but the normal
 > sources made no mention.  When one runs (from a egcs-1.1b release install)
 > /tmp/cpp -dM (this switch makes it output the values of internal defines)
 > and then types ctrl-d (to indicate end of file) it outputs the following
 > on an i386 linux architecture:
 > 
 > #define linux 1 
 > #define __ELF__ 1 
 > #define unix 1 
 > 
 > and on alpha-linux
 > 
 > #define linux 1 
 > #define _LONGLONG 1 
 > #define __ELF__ 1 
 > #define unix 1 
 > 
 > Shouldn't there be an internal define for the cpu type?  I.e. on the
 > previous egcs release, it had i386 or __alpha (and __alpha__) defined on
 > respectively the i386 and alpha.  The fact that there's no cputype
 > confuses things like imake.
 > 
 > Have I done something wrong during the compile? (using configure
 > --prefix=/usr --enable-shared --enable-threads)  Please CC to this email
 > address as well, I am not subscribed to the egcs-bugs list anymore.
 > 
 > Thankyou very much for any help and or advice,
 > Charl

There had been a long discussion prior to 1.0.3's release. I suggested
that all Linux distributions with egcs as their default compiler should
supply a shell script like the appended one as /lib/cpp.

manfred

------------ Cut here: /lib/cpp ----------------
#! /bin/sh

# set -x

# First lets look if there is a file argument; otherwise we'll need to instruct
# gcc to read from stdin.

got_file=no
for f
do
	[ -f "$f" ] && { got_file=yes; break; }
done

# The '-x c' is necessary to suppress error message like
#  gcc: /home/manfred//.holiday: linker input file unused since linking not done
# for files with unknown extensions.
exec gcc -x c -E ${1+"$@"} `[ $got_file = no ] && echo -`
--------- Cut here: end of /lib/cpp -------------



More information about the Gcc-bugs mailing list