This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: newbie question, where is a list of defines like __sparc and __linux ?


>     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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]