This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: newbie question, where is a list of defines like __sparc and __linux ?
- To: weiss at clearway dot com
- Subject: Re: newbie question, where is a list of defines like __sparc and __linux ?
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Fri, 7 Jan 2000 09:38:36 +0100
- CC: gcc at gcc dot gnu dot org
- References: <387517A5.C2FD11EB@clearway.com>
> I'm doing cross platform development and want to be able to pretty
> specifically define what is and is not compiled in my builds.
> Looking through the source code I see defines like __sparc and __linux
> but I can't find a definitive list of all the viable platform/os defines
> that I can
> #ifdef with in my code .. where is such a list of one exists?
If you have gcc for the target system installed, you can do 'gcc -v
a.c'. This shows how cpp is invoked, including all defines given to
cpp.
Alternatively, you can use 'gcc -dumpspecs'. The relevant sections are
- cpp (which includes cpp_cpu)
- predefines
- cpp_* (the relevant section is selected by cpp_cpu_default, or -mcpu
command line options)
If you want to see the predefines for an architectures for which you
don't have a gcc installed, go to the gcc/config directory, and do
grep CPP_PREDEFINES * */*
grep CPP_CPU * */*
Which one of those is used depends on the target.
Regards,
Martin