for CPP, detect __linux__, etc., instead of linux, etc.

When a compiler is run in standards mode, predefined macros that
do not start with "_" are dropped, so use the "_" versions
consistently. Whether or not Racket itself would compile in
standards mode, the Racket headers should be able to work that
way --- at least on Unix platforms.
This commit is contained in:
Matthew Flatt 2015-10-08 10:53:23 -06:00
parent 85c1ba55f3
commit 7555d022db
5 changed files with 21 additions and 21 deletions

View File

@ -163,7 +163,7 @@ extern Scheme_Object *scheme_initialize(Scheme_Env *env);
/* OS process name */ /* OS process name */
/*========================================================================*/ /*========================================================================*/
#if defined(linux) #if defined(__linux__)
# include <sys/prctl.h> # include <sys/prctl.h>
# ifdef PR_SET_NAME # ifdef PR_SET_NAME
# define CAN_SET_OS_PROCESS_NAME 1 # define CAN_SET_OS_PROCESS_NAME 1

View File

@ -85,7 +85,7 @@
# include <errno.h> # include <errno.h>
# ifdef ECHRNG # ifdef ECHRNG
/* Solaris */ /* Solaris */
# if defined(i386) # if defined(__i386__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-solaris" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-solaris"
# elif defined(__x86_64) # elif defined(__x86_64)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "x86_64-solaris" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "x86_64-solaris"
@ -121,7 +121,7 @@
# define SUBPROCESS_USE_FORK1 # define SUBPROCESS_USE_FORK1
# endif # endif
# ifdef i386 # ifdef __i386__
# define MZ_USE_JIT_I386 # define MZ_USE_JIT_I386
# define MZ_JIT_USE_MPROTECT # define MZ_JIT_USE_MPROTECT
# elif defined(__x86_64) # elif defined(__x86_64)
@ -159,7 +159,7 @@
/************** Linux with gcc ****************/ /************** Linux with gcc ****************/
#if defined(linux) #if defined(__linux__)
# ifdef __ANDROID__ # ifdef __ANDROID__
# define SPLS_LINUX "android" # define SPLS_LINUX "android"
@ -167,13 +167,13 @@
# define SPLS_LINUX "linux" # define SPLS_LINUX "linux"
# endif # endif
# if defined(i386) # if defined(__i386__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-"SPLS_LINUX # define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-"SPLS_LINUX
# define REGISTER_POOR_MACHINE # define REGISTER_POOR_MACHINE
# define MZ_TRY_EXTFLONUMS # define MZ_TRY_EXTFLONUMS
# define ASM_DBLPREC_CONTROL_87 # define ASM_DBLPREC_CONTROL_87
# endif # endif
# if defined(powerpc) # if defined(__powerpc__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "ppc-"SPLS_LINUX # define SCHEME_PLATFORM_LIBRARY_SUBPATH "ppc-"SPLS_LINUX
# endif # endif
# if defined(__mc68000__) # if defined(__mc68000__)
@ -237,7 +237,7 @@
# define FLAGS_ALREADY_SET # define FLAGS_ALREADY_SET
#if defined(i386) #if defined(__i386__)
# define MZ_USE_JIT_I386 # define MZ_USE_JIT_I386
# define MZ_JIT_USE_MPROTECT # define MZ_JIT_USE_MPROTECT
# define MZ_USE_DWARF_LIBUNWIND # define MZ_USE_DWARF_LIBUNWIND
@ -247,7 +247,7 @@
# define MZ_JIT_USE_MPROTECT # define MZ_JIT_USE_MPROTECT
# define MZ_USE_DWARF_LIBUNWIND # define MZ_USE_DWARF_LIBUNWIND
#endif #endif
#if defined(powerpc) #if defined(__powerpc__)
# define MZ_USE_JIT_PPC # define MZ_USE_JIT_PPC
#endif #endif
# if defined(__arm__) # if defined(__arm__)
@ -263,9 +263,9 @@
#if defined(__NetBSD__) #if defined(__NetBSD__)
#if defined(i386) #if defined(__i386__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-netbsd" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-netbsd"
#elif defined(powerpc) #elif defined(__powerpc__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "ppc-netbsd" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "ppc-netbsd"
#elif defined(__x86_64__) #elif defined(__x86_64__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "x86_64-netbsd" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "x86_64-netbsd"
@ -295,11 +295,11 @@
# define USE_DIVIDE_MAKE_INFINITY # define USE_DIVIDE_MAKE_INFINITY
#endif #endif
#if defined(i386) #if defined(__i386__)
# define MZ_USE_JIT_I386 # define MZ_USE_JIT_I386
# define MZ_JIT_USE_MPROTECT # define MZ_JIT_USE_MPROTECT
#endif #endif
#if defined(powerpc) #if defined(__powerpc__)
# define MZ_USE_JIT_PPC # define MZ_USE_JIT_PPC
#endif #endif
#if defined(__x86_64__) #if defined(__x86_64__)
@ -507,7 +507,7 @@
/************** SGI/IRIX with SGI cc ****************/ /************** SGI/IRIX with SGI cc ****************/
#if (defined(mips) || defined(__mips)) \ #if (defined(mips) || defined(__mips)) \
&& !(defined(ultrix) || defined(__ultrix) || defined(linux) || defined(__OpenBSD__)) && !(defined(ultrix) || defined(__ultrix) || defined(__linux__) || defined(__OpenBSD__))
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "mips-irix" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "mips-irix"
@ -552,7 +552,7 @@
/************** ALPHA/OSF1 with gcc ****************/ /************** ALPHA/OSF1 with gcc ****************/
# if (defined(__alpha) || defined(__alpha__)) \ # if (defined(__alpha) || defined(__alpha__)) \
&& !defined(linux) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__linux__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "alpha-osf1" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "alpha-osf1"
@ -925,7 +925,7 @@
#if defined(__QNX__) #if defined(__QNX__)
#if defined(i386) #if defined(__i386__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-qnx" # define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-qnx"
#endif #endif
# define ASSUME_FIXED_STACK_SIZE # define ASSUME_FIXED_STACK_SIZE
@ -944,7 +944,7 @@
# define BROKEN_READLINK_NUL_TERMINATOR # define BROKEN_READLINK_NUL_TERMINATOR
#if defined(i386) #if defined(__i386__)
# define MZ_USE_JIT_I386 # define MZ_USE_JIT_I386
# define MZ_JIT_USE_MPROTECT # define MZ_JIT_USE_MPROTECT
#endif #endif

View File

@ -14,7 +14,7 @@
# define USE_DATASTARTEND 1 # define USE_DATASTARTEND 1
#endif #endif
#if defined(linux) && defined(i386) && defined(__ELF__) #if defined(__linux) && defined(__i386__) && defined(__ELF__)
# include <linux/version.h> # include <linux/version.h>
# include <features.h> # include <features.h>
# if LINUX_VERSION_CODE >= 0x20000 && defined(__GLIBC__) && __GLIBC__ >= 2 # if LINUX_VERSION_CODE >= 0x20000 && defined(__GLIBC__) && __GLIBC__ >= 2

View File

@ -2168,7 +2168,7 @@ Scheme_Object *touch(int argc, Scheme_Object *argv[])
} }
} }
#if defined(linux) || defined(__QNX__) #if defined(__linux__) || defined(__QNX__)
# include <unistd.h> # include <unistd.h>
#elif defined(OS_X) #elif defined(OS_X)
# include <sys/param.h> # include <sys/param.h>
@ -2180,7 +2180,7 @@ Scheme_Object *touch(int argc, Scheme_Object *argv[])
static void init_cpucount(void) static void init_cpucount(void)
/* Called in runtime thread */ /* Called in runtime thread */
{ {
#if defined(linux) || defined(__QNX__) #if defined(__linux__) || defined(__QNX__)
cpucount = sysconf(_SC_NPROCESSORS_ONLN); cpucount = sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(OS_X) #elif defined(OS_X)
size_t size = sizeof(cpucount); size_t size = sizeof(cpucount);

View File

@ -26,10 +26,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef LIBUNWIND_H #ifndef LIBUNWIND_H
#define LIBUNWIND_H #define LIBUNWIND_H
#if defined(linux) #if defined(__linux__)
# define LINUX # define LINUX
#endif #endif
#if defined(i386) #if defined(__i386__)
# define PLAIN_X86 # define PLAIN_X86
#endif #endif
#if defined(__x86_64__) #if defined(__x86_64__)