I don't know if there is any way to get them dumped to stdout, but certainly the
manpage for the SunCC compiler states:
Predefinitions:unix
sparc (SPARC)
i386 (x86)
sun
The above are not predefined in -Xc mode.
These predefinitions are valid in all modes:
__BUILTIN_VA_ARG_INCR
__SUNPRO_C=0x590
__SVR4(SPARC)
__SunOS(Solaris)
__amd64(x86 with-m64)
__gnu__linux(linux)
__i386(x86)
__linux(linux)
__linux__(linux)
__sparc(SPARC)
__sparcv9(with-m64)
__sun(Solaris)
__unix
__`uname -s`_`uname -r`(Solaris)
__x86_64(x86)
linux(x86,linux)
The following is predefined in -Xa and -Xt modes only:
__RESTRICT
The compiler also predefines the object-like macro
__PRAGMA_REDEFINE_EXTNAME,
to indicate the pragma will be recognized.
HTH,
Darren.
On 27/03/2009 17:51, Christian Thalinger wrote:
> On Fri, 2009-03-27 at 17:35 +0000, Ghee Teo wrote:
>> Hi,
>>
>> I am working on patches that get the compiler to conditional include or
>> exclude the OpenSolaris specific bit of code.
>> I have seen upstream code that used
>>
>> #if defined(__sun__)
>> ...
>> #endif
>>
>> But that does not work for CBE when I build them.
>>
>> I have to use
>>
>> #if defined(sun)
>> ...
>> #endif
>>
>> So what is the right macros to use that work both down stream and upstream?
>> Where are they defined, any idea?
>
> These macros are usually defined by the compiler itself, or more
> specifically by the preprocessor. I don't know of a way to find out the
> preprocessor defines for SunCC, but I know how to do it with GCC:
>
> $ cpp -dM /dev/null
>
> Maybe someone else knows how to print them with SunCC...
>
> -- Christian
>
> _______________________________________________
> desktop-discuss mailing list
> desktop-discuss at opensolaris.org