A bit of Google magic discovered this link:
C 3.0.1 User’s Guide
Page 77 has this table:
The following predefinitions are valid in all modes:
- __sparc (SPARC only)
- __i386 (x86 only)
- __sun
- __unix
- __BUILTIN_VA_ARG_INCR
- __SVR4 (Solaris 2.x only)
- __SUNPRO_C=0x301
__SUNPRO_C=0x301
seems to be definitive - for the C compiler. I've not been able to find the C++ documentation other than some 1992 product notes at https://vtda.org/docs/computing/Sun/hardware/801-3206-10_SPARCompilerSPARCworksProductNotes_RevA_Oct92.pdf
The document dates from 1994 - it appears to be a non-ANSI K&R compiler with support for an ANSI/C89 mode.
Given the comments and the questions stated need to support •glibc
-based Fedora, the following outputs from cc -E -xdumpmacros /dev/null
on Solaris 11 and RHEL 8 systems may prove useful.
RHEL 8:
cc -E -xdumpmacros /dev/null
#define __LINE__
#define __FILE__
#define __STDC__ 1
#define __STDC_VERSION__ 201112L
#define __DATE__ "Apr 23 2024"
#define __TIME__ "13:53:22"
#define __STDC_HOSTED__ 1
#define __STDC_ANALYZABLE__ 1
#define __STDC_NO_THREADS__ 1
#define __STDC_UTF_16__ 1
#define __STDC_UTF_32__ 1
#define __ATOMIC_RELAXED 0
#define __ATOMIC_CONSUME 1
#define __ATOMIC_ACQUIRE 2
#define __ATOMIC_RELEASE 3
#define __ATOMIC_ACQ_REL 4
#define __ATOMIC_SEQ_CST 5
#define __has_attribute (attr) ___has_attribute___ ( attr )
#define __SUNPRO_C 0x5150
#define __unix 1
#define __unix__ 1
#define __linux 1
#define __linux__ 1
#define __gnu__linux__ 1
#define __x86_64 1
#define __x86_64__ 1
#define __amd64 1
#define __amd64__ 1
#define _LP64 1
#define __LP64__ 1
#define __ORDER_LITTLE_ENDIAN__ 1234
#define __ORDER_BIG_ENDIAN__ 4321
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __BUILTIN_VA_STRUCT 1
#define __C11FEATURES__ 1
#define __C99FEATURES__ 1
#define __PRAGMA_REDEFINE_EXTNAME 1
#define unix 1
#define linux 1
#define __RESTRICT 1
#define __FLT_EVAL_METHOD__ 0
#define __SUN_PREFETCH 1
#define __SIZE_TYPE__ unsigned long
# 1 "/dev/null"
#ident "acomp: Studio 12.6 Sun C 5.15 Linux_i386 2017/05/30"
Solaris 11:
cc -E -xdumpmacros /dev/null
#define __LINE__
#define __FILE__
#define __STDC__ 0
#define __STDC_VERSION__ 201112L
#define __DATE__ "Apr 23 2024"
#define __TIME__ "14:04:45"
#define __STDC_IEC_559__ 1
#define __STDC_IEC_559_COMPLEX__ 1
#define __STDC_HOSTED__ 1
#define __STDC_ANALYZABLE__ 1
#define __STDC_NO_THREADS__ 1
#define __STDC_UTF_16__ 1
#define __STDC_UTF_32__ 1
#define __ATOMIC_RELAXED 0
#define __ATOMIC_CONSUME 1
#define __ATOMIC_ACQUIRE 2
#define __ATOMIC_RELEASE 3
#define __ATOMIC_ACQ_REL 4
#define __ATOMIC_SEQ_CST 5
#define __has_attribute (attr) ___has_attribute___ ( attr )
#define __SunOS_5_11 1
#define __SunOS_RELEASE 0x051100
#define __SUNPRO_C 0x5150
#define __unix 1
#define __SVR4__ 1
#define __svr4__ 1
#define __SVR4 1
#define __sun 1
#define __sun__ 1
#define __SunOS 1
#define __i386 1
#define __i386__ 1
#define __ORDER_LITTLE_ENDIAN__ 1234
#define __ORDER_BIG_ENDIAN__ 4321
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
#define __BUILTIN_VA_ARG_INCR 1
#define __C11FEATURES__ 1
#define __C99FEATURES__ 1
#define __PRAGMA_REDEFINE_EXTNAME 1
#define unix 1
#define sun 1
#define i386 1
#define __RESTRICT 1
#define __FLT_EVAL_METHOD__ 0
#define __SUN_PREFETCH 1
# 1 "/dev/null"
#ident "acomp: Studio 12.6 Sun C 5.15 SunOS_i386 2017/05/30"
As a guess, I suspect the existence of __SunOS_RELEASE
and its value will indicate whether or not you need to provide old, outdated prototypes in place of functions from standard headers.
Also, _sun
and its various versions likely only indicates the OS. I'd think you'd need to use __SUNPRO
of some type to indicate the Sun/Oracle compiler.
-xdumpmacros
does not appear as an option in the C 3.0.1 User’s Guide – Beka