On 03/27/09 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...
>    
May be I am wrong, I got
  cpp -dM /dev/null | grep sun
#define __sun 1
#define sun 1
#define __sun__ 1
bash-3.2$ which cc
/export/home/gheet/compiler/onnv-tools/i386/SS11/bin/cc

so it seems to be all defined. Let me investigate a bit more.
Thanks,

-Ghee

> -- Christian
>
>    


Reply via email to