Subject: Re: cpp predefines
To: matthew green <mrg@eterna.com.au>
From: john heasley <heas@shrubbery.net>
List: tech-toolchain
Date: 02/05/2003 08:08:06
Wed, Feb 05, 2003 at 01:24:20PM +1100, matthew green:
>    basically, going through some of the xfree source (from their cvs), they
>    have some source that reads:
>    
>    #ifdef _LP64
>    # if defined(__sparcv9)
>    #  define       _MACH64_NAME            "sparcv9"
>    
>    i understand that _LP64 comes from the sysv ABI (right?), but where did
>    __sparcv9 come from?  netbsd has __sparc_v9__.  i'm curious if i should
>    change the x source or ask toolchain-masters about adding __sparcv9.
> 
> possibly we should add __sparcv9 -- it has always been defined in
> solaris i think.  as is __sparc_v9__.  (there is also __sparc_v8__ 
> for v8.)

i dont have sunCC, but gcc from a solaris 9 box:

spruce [1] gcc -dM -E - < /dev/null
#define __HAVE_BUILTIN_SETJMP__ 1
#define __sparc 1
#define sun 1
#define __unix__ 1
#define unix 1
#define __SIZE_TYPE__ unsigned int
#define __GNUC_PATCHLEVEL__ 0
#define sparc 1
#define __unix 1
#define __PRAGMA_REDEFINE_EXTNAME 1
#define __USER_LABEL_PREFIX__ 
#define __STDC_HOSTED__ 1
#define __WCHAR_TYPE__ long int
#define __WINT_TYPE__ long int
#define __GNUC__ 3
#define __sun__ 1
#define __SVR4 1
#define __GCC_NEW_VARARGS__ 1
#define __svr4__ 1
#define __sparc__ 1
#define __GNUC_MINOR__ 1
#define __PTRDIFF_TYPE__ int
#define __sun 1
#define __REGISTER_PREFIX__ 
#define __NO_INLINE__ 1
#define __VERSION__ "3.1"

not even _LP64.  interesting, solaris sys/isa_defs.h:

#if defined(__sparcv8)
	...
#elif defined(__sparcv9)
	...
#define _LP64
	...

> i believe that if _LP64 is defined, and __sparc__ is defined, we have
> a "sparcv9" machine (what is _MACH64_NAME used for?).

in this particular case, Xserver/XlcDL.c uses it to size an array and
build a path.

> __sparc64__ is the correct predefine to check for sparc64 in the
> general case.

i'd expect to see it on my solaris box.  what defines that as correct?

thanks, man.