Actually __sparc is sufficient to cover 32-bit or 64-bit SPARC ABIs.
Also #if defined(_BIG_ENDIAN) might be even more useful.

tim

>
>
> Jyri Virkki wrote:
>
>>     2.4.1. Include [ header ] files.
>>
>>     Public Apache header files which are generated at ./configure  
>> time
>>     will be merged to include both 32- and 64-bit definitions.  The
>>     differences between 32- and 64-bit datatypes will be guarded
>>     either via the _LP64 macro, or via the appropriate ISA macros:
>>
>>         #if defined(_LP64)
>>         #define APR_SIZEOF_VOIDP 8
>>         #else
>>         #define APR_SIZEOF_VOIDP 4
>>         #endif
>>
>>         #if defined(__sparcv9)
>>         #define APR_IS_BIGENDIAN       1
>>         #else
>>         #define APR_IS_BIGENDIAN       0
>>         #endif
>
> __sparcv9 is defined only for 64-bit builds, it is not defined for  
> 32-bit builds.
>
> #ifdef guarding on __sparcv9 only will result on (APR_IS_BIGENDIAN  
> == 0) for
> 32-bit sparcv8 builds.
>
> the correct #ifdef guard should be:
>
> #if defined(__sparc) || defined(__sparcv9)
> /* ... */
> #endif
>
> /* testsparcdefines.c */
>
> #include <stdio.h>
>
> static char* endian = "LITTLE ENDIAN";
>
> int
> main(int argc, char* argv[])
> {
> #if defined(__sparcv9)
>      endian = "BIG ENDIAN";
> #endif
>      (void) fprintf(stderr, "endian is %s.\n", endian);
>      return 0;
> }
>
> --Stefan
>
> -- 
> Stefan Teleman
> Sun Microsystems, Inc.
> Stefan.Teleman at Sun.COM
>
> _______________________________________________
> opensolaris-arc mailing list
> opensolaris-arc at opensolaris.org


Reply via email to