Commit 329be64b by Eric Botcazou Committed by Eric Botcazou

adaint.c: Test for __linux__ instead of linux and __sun__ instead of sun.

	* adaint.c: Test for __linux__ instead of linux and __sun__ instead
	of sun.  Add missing leading underscore to AIX.  Remove #elif 0.
	* adaint.h: Likewise.
	* cio.c: Likewise.
	* cstreams.c: Likewise.
	* env.c: Likewise.
	* gsocket.h: Likewise.
	* init.c: Likewise.  Test for __i386__ instead of i386.
	* link.c: Likewise.
	* s-oscons-tmplt.c: Likewise.
	* sysdep.c: Likewise.
	* terminals.c: Likewise.  Use BSD symbol instead of FREEBSD.
	* tracebak.c: Likewise.  Test for __sparc__ instead of sparc.

From-SVN: r223890
parent c67e8801
2015-05-30 Eric Botcazou <ebotcazou@adacore.com>
* adaint.c: Test for __linux__ instead of linux and __sun__ instead
of sun. Add missing leading underscore to AIX. Remove #elif 0.
* adaint.h: Likewise.
* cio.c: Likewise.
* cstreams.c: Likewise.
* env.c: Likewise.
* gsocket.h: Likewise.
* init.c: Likewise. Test for __i386__ instead of i386.
* link.c: Likewise.
* s-oscons-tmplt.c: Likewise.
* sysdep.c: Likewise.
* terminals.c: Likewise. Use BSD symbol instead of FREEBSD.
* tracebak.c: Likewise. Test for __sparc__ instead of sparc.
2015-05-28 Eric Botcazou <ebotcazou@adacore.com> 2015-05-28 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (max_size) <tcc_binary>: Add special code to * gcc-interface/utils.c (max_size) <tcc_binary>: Add special code to
......
...@@ -743,7 +743,7 @@ __gnat_rmdir (char *path) ...@@ -743,7 +743,7 @@ __gnat_rmdir (char *path)
#endif #endif
} }
#if defined (_WIN32) || defined (linux) || defined (sun) \ #if defined (_WIN32) || defined (__linux__) || defined (__sun__) \
|| defined (__FreeBSD__) || defined (__FreeBSD__)
#define HAS_TARGET_WCHAR_T #define HAS_TARGET_WCHAR_T
#endif #endif
...@@ -982,7 +982,7 @@ __gnat_open_new_temp (char *path, int fmode) ...@@ -982,7 +982,7 @@ __gnat_open_new_temp (char *path, int fmode)
strcpy (path, "GNAT-XXXXXX"); strcpy (path, "GNAT-XXXXXX");
#if (defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) \ #if (defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) \
|| defined (linux) || defined(__GLIBC__)) && !defined (__vxworks) || defined (__linux__) || defined (__GLIBC__)) && !defined (__vxworks)
return mkstemp (path); return mkstemp (path);
#elif defined (__Lynx__) #elif defined (__Lynx__)
mktemp (path); mktemp (path);
...@@ -1153,8 +1153,8 @@ __gnat_tmp_name (char *tmp_filename) ...@@ -1153,8 +1153,8 @@ __gnat_tmp_name (char *tmp_filename)
free (pname); free (pname);
} }
#elif defined (linux) || defined (__FreeBSD__) || defined (__NetBSD__) \ #elif defined (__linux__) || defined (__FreeBSD__) || defined (__NetBSD__) \
|| defined (__OpenBSD__) || defined(__GLIBC__) || defined (__ANDROID__) || defined (__OpenBSD__) || defined (__GLIBC__) || defined (__ANDROID__)
#define MAX_SAFE_PATH 1000 #define MAX_SAFE_PATH 1000
char *tmpdir = getenv ("TMPDIR"); char *tmpdir = getenv ("TMPDIR");
...@@ -1224,7 +1224,7 @@ DIR* __gnat_opendir (char *name) ...@@ -1224,7 +1224,7 @@ DIR* __gnat_opendir (char *name)
/* Read the next entry in a directory. The returned string points somewhere /* Read the next entry in a directory. The returned string points somewhere
in the buffer. */ in the buffer. */
#if defined (sun) && defined (__SVR4) #if defined (__sun__)
/* For Solaris, be sure to use the 64-bit version, otherwise NFS reads may /* For Solaris, be sure to use the 64-bit version, otherwise NFS reads may
fail with EOVERFLOW if the server uses 64-bit cookies. */ fail with EOVERFLOW if the server uses 64-bit cookies. */
#define dirent dirent64 #define dirent dirent64
...@@ -2160,7 +2160,7 @@ __gnat_is_symbolic_link (char *name ATTRIBUTE_UNUSED) ...@@ -2160,7 +2160,7 @@ __gnat_is_symbolic_link (char *name ATTRIBUTE_UNUSED)
return __gnat_is_symbolic_link_attr (name, &attr); return __gnat_is_symbolic_link_attr (name, &attr);
} }
#if defined (sun) && defined (__SVR4) #if defined (__sun__)
/* Using fork on Solaris will duplicate all the threads. fork1, which /* Using fork on Solaris will duplicate all the threads. fork1, which
duplicates only the active thread, must be used instead, or spawning duplicates only the active thread, must be used instead, or spawning
subprocess from a program with tasking will lead into numerous problems. */ subprocess from a program with tasking will lead into numerous problems. */
...@@ -2267,7 +2267,8 @@ __gnat_number_of_cpus (void) ...@@ -2267,7 +2267,8 @@ __gnat_number_of_cpus (void)
{ {
int cores = 1; int cores = 1;
#if defined (linux) || defined (sun) || defined (AIX) || defined (__APPLE__) #if defined (__linux__) || defined (__sun__) || defined (_AIX) \
|| defined (__APPLE__)
cores = (int) sysconf (_SC_NPROCESSORS_ONLN); cores = (int) sysconf (_SC_NPROCESSORS_ONLN);
#elif defined (__hpux__) #elif defined (__hpux__)
...@@ -3066,7 +3067,7 @@ __gnat_lwp_self (void) ...@@ -3066,7 +3067,7 @@ __gnat_lwp_self (void)
return (void *) pthread_self (); return (void *) pthread_self ();
} }
#elif defined (linux) #elif defined (__linux__)
/* There is no function in the glibc to retrieve the LWP of the current /* There is no function in the glibc to retrieve the LWP of the current
thread. We need to do a system call in order to retrieve this thread. We need to do a system call in order to retrieve this
information. */ information. */
...@@ -3155,7 +3156,7 @@ __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) ...@@ -3155,7 +3156,7 @@ __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
CPU_SET (cpu - 1, set); CPU_SET (cpu - 1, set);
} }
#endif /* !CPU_ALLOC */ #endif /* !CPU_ALLOC */
#endif /* linux */ #endif /* __linux__ */
/* Return the load address of the executable, or 0 if not known. In the /* Return the load address of the executable, or 0 if not known. In the
specific case of error, (void *)-1 can be returned. Beware: this unit may specific case of error, (void *)-1 can be returned. Beware: this unit may
...@@ -3164,8 +3165,6 @@ __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) ...@@ -3164,8 +3165,6 @@ __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
#if defined (__APPLE__) #if defined (__APPLE__)
#include <mach-o/dyld.h> #include <mach-o/dyld.h>
#elif 0 && defined (__linux__)
#include <link.h>
#endif #endif
const void * const void *
......
...@@ -51,7 +51,7 @@ extern "C" { ...@@ -51,7 +51,7 @@ extern "C" {
determine at compile time what support the system offers for large files. determine at compile time what support the system offers for large files.
For now we just list the platforms we have manually tested. */ For now we just list the platforms we have manually tested. */
#if defined (__GLIBC__) || defined (sun) #if defined (__GLIBC__) || defined (__sun__)
#define GNAT_FOPEN fopen64 #define GNAT_FOPEN fopen64
#define GNAT_OPEN open64 #define GNAT_OPEN open64
#define GNAT_STAT stat64 #define GNAT_STAT stat64
...@@ -279,10 +279,10 @@ extern char * __gnat_locate_file_with_predicate (char *, char *, ...@@ -279,10 +279,10 @@ extern char * __gnat_locate_file_with_predicate (char *, char *,
int (*)(char*)); int (*)(char*));
#if defined (__ANDROID__) #if defined (__ANDROID__)
#undef linux #undef __linux__
extern void *__gnat_lwp_self (void); extern void *__gnat_lwp_self (void);
#elif defined (linux) #elif defined (__linux__)
extern void *__gnat_lwp_self (void); extern void *__gnat_lwp_self (void);
/* Routines for interface to required CPU set primitives */ /* Routines for interface to required CPU set primitives */
......
...@@ -49,7 +49,7 @@ extern "C" { ...@@ -49,7 +49,7 @@ extern "C" {
/* Don't use macros on GNU/Linux since they cause incompatible changes between /* Don't use macros on GNU/Linux since they cause incompatible changes between
glibc 2.0 and 2.1 */ glibc 2.0 and 2.1 */
#ifdef linux #ifdef __linux__
#undef putchar #undef putchar
#undef getchar #undef getchar
#undef fputc #undef fputc
......
...@@ -69,7 +69,7 @@ extern "C" { ...@@ -69,7 +69,7 @@ extern "C" {
#include <unixlib.h> #include <unixlib.h>
#endif #endif
#ifdef linux #ifdef __linux__
/* Don't use macros on GNU/Linux since they cause incompatible changes between /* Don't use macros on GNU/Linux since they cause incompatible changes between
glibc 2.0 and 2.1 */ glibc 2.0 and 2.1 */
...@@ -277,8 +277,8 @@ __gnat_fseek64 (FILE *stream, __int64 offset, int origin) ...@@ -277,8 +277,8 @@ __gnat_fseek64 (FILE *stream, __int64 offset, int origin)
return _fseeki64 (stream, offset, origin); return _fseeki64 (stream, offset, origin);
} }
#elif defined(linux) || defined(sun) \ #elif defined (__linux__) || defined (__sun__) || defined (__FreeBSD__) \
|| defined (__FreeBSD__) || defined(__APPLE__) || defined (__APPLE__)
/* section for platforms having ftello/fseeko */ /* section for platforms having ftello/fseeko */
__int64 __int64
......
...@@ -211,7 +211,7 @@ __gnat_environ (void) ...@@ -211,7 +211,7 @@ __gnat_environ (void)
return NULL; return NULL;
#elif defined (__MINGW32__) #elif defined (__MINGW32__)
return _environ; return _environ;
#elif defined (sun) #elif defined (__sun__)
extern char **_environ; extern char **_environ;
return _environ; return _environ;
#elif defined (__APPLE__) && !defined (__arm__) #elif defined (__APPLE__) && !defined (__arm__)
...@@ -229,7 +229,7 @@ void __gnat_unsetenv (char *name) ...@@ -229,7 +229,7 @@ void __gnat_unsetenv (char *name)
#if defined (VMS) #if defined (VMS)
/* Not implemented */ /* Not implemented */
return; return;
#elif defined (__hpux__) || defined (sun) \ #elif defined (__hpux__) || defined (__sun__) \
|| (defined (__vxworks) && ! defined (__RTP__)) \ || (defined (__vxworks) && ! defined (__RTP__)) \
|| defined (_AIX) || defined (__Lynx__) || defined (_AIX) || defined (__Lynx__)
...@@ -288,7 +288,7 @@ void __gnat_clearenv (void) ...@@ -288,7 +288,7 @@ void __gnat_clearenv (void)
#if defined (VMS) #if defined (VMS)
/* not implemented */ /* not implemented */
return; return;
#elif defined (sun) \ #elif defined (__sun__) \
|| (defined (__vxworks) && ! defined (__RTP__)) || defined (__Lynx__) \ || (defined (__vxworks) && ! defined (__RTP__)) || defined (__Lynx__) \
|| defined (__PikeOS__) || defined (__PikeOS__)
/* On Solaris, VxWorks (not RTPs), and Lynx there is no system /* On Solaris, VxWorks (not RTPs), and Lynx there is no system
......
...@@ -212,9 +212,9 @@ ...@@ -212,9 +212,9 @@
defined (_WIN32) || defined (__APPLE__) || defined (__ANDROID__) defined (_WIN32) || defined (__APPLE__) || defined (__ANDROID__)
# define HAVE_THREAD_SAFE_GETxxxBYyyy 1 # define HAVE_THREAD_SAFE_GETxxxBYyyy 1
#elif defined (linux) || defined (__GLIBC__) || \ #elif defined (__linux__) || defined (__GLIBC__) || \
(defined (sun) && defined (__SVR4) && !defined (__vxworks)) || \ (defined (__sun__) && !defined (__vxworks)) || \
defined(__rtems__) defined (__rtems__)
# define HAVE_GETxxxBYyyy_R 1 # define HAVE_GETxxxBYyyy_R 1
#endif #endif
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#endif #endif
#ifdef __ANDROID__ #ifdef __ANDROID__
#undef linux #undef __linux__
#endif #endif
#ifdef IN_RTS #ifdef IN_RTS
...@@ -403,7 +403,7 @@ __gnat_install_handler (void) ...@@ -403,7 +403,7 @@ __gnat_install_handler (void)
/* GNU/Linux Section */ /* GNU/Linux Section */
/*********************/ /*********************/
#elif defined (linux) #elif defined (__linux__)
#include <signal.h> #include <signal.h>
...@@ -452,7 +452,7 @@ void fake_linux_sigemptyset (sigset_t *set) ...@@ -452,7 +452,7 @@ void fake_linux_sigemptyset (sigset_t *set)
#endif #endif
#if defined (i386) || defined (__x86_64__) || defined (__ia64__) \ #if defined (__i386__) || defined (__x86_64__) || defined (__ia64__) \
|| defined (__ARMEL__) || defined (__ARMEL__)
#define HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE #define HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE
...@@ -480,7 +480,7 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext) ...@@ -480,7 +480,7 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, void *ucontext)
The stack checking code guarantees that this address is unused by the The stack checking code guarantees that this address is unused by the
time this happens. */ time this happens. */
#if defined (i386) #if defined (__i386__)
unsigned long *pc = (unsigned long *)mcontext->gregs[REG_EIP]; unsigned long *pc = (unsigned long *)mcontext->gregs[REG_EIP];
/* The pattern is "orl $0x0,(%esp)" for a probe in 32-bit mode. */ /* The pattern is "orl $0x0,(%esp)" for a probe in 32-bit mode. */
if (signo == SIGSEGV && pc && *pc == 0x00240c83) if (signo == SIGSEGV && pc && *pc == 0x00240c83)
...@@ -703,7 +703,7 @@ __gnat_install_handler(void) ...@@ -703,7 +703,7 @@ __gnat_install_handler(void)
/* Solaris Section */ /* Solaris Section */
/*******************/ /*******************/
#elif defined (sun) && defined (__SVR4) && !defined (__vxworks) #elif defined (__sun__) && !defined (__vxworks)
#include <signal.h> #include <signal.h>
#include <siginfo.h> #include <siginfo.h>
...@@ -1702,7 +1702,7 @@ __gnat_install_handler () ...@@ -1702,7 +1702,7 @@ __gnat_install_handler ()
#include <signal.h> #include <signal.h>
#include <taskLib.h> #include <taskLib.h>
#if (defined (i386) || defined (__i386__)) && !defined (VTHREADS) #if defined (__i386__) && !defined (VTHREADS)
#include <sysLib.h> #include <sysLib.h>
#endif #endif
...@@ -1898,7 +1898,7 @@ __gnat_map_signal (int sig, siginfo_t *si ATTRIBUTE_UNUSED, ...@@ -1898,7 +1898,7 @@ __gnat_map_signal (int sig, siginfo_t *si ATTRIBUTE_UNUSED,
Raise_From_Signal_Handler (exception, msg); Raise_From_Signal_Handler (exception, msg);
} }
#if (defined (i386) || defined (__i386__)) && !defined (VTHREADS) #if defined (__i386__) && !defined (VTHREADS)
extern void extern void
__gnat_vxsim_error_handler (int sig, siginfo_t *si, void *sc); __gnat_vxsim_error_handler (int sig, siginfo_t *si, void *sc);
...@@ -1921,7 +1921,7 @@ __gnat_error_handler (int sig, siginfo_t *si, void *sc) ...@@ -1921,7 +1921,7 @@ __gnat_error_handler (int sig, siginfo_t *si, void *sc)
sigdelset (&mask, sig); sigdelset (&mask, sig);
sigprocmask (SIG_SETMASK, &mask, NULL); sigprocmask (SIG_SETMASK, &mask, NULL);
#if defined (__ARMEL__) || defined (__PPC__) || defined (i386) || defined (__i386__) #if defined (__ARMEL__) || defined (__PPC__) || defined (__i386__)
/* On certain targets, kernel mode, we process signals through a Call Frame /* On certain targets, kernel mode, we process signals through a Call Frame
Info trampoline, voiding the need for myriads of fallback_frame_state Info trampoline, voiding the need for myriads of fallback_frame_state
variants in the ZCX runtime. We have no simple way to distinguish ZCX variants in the ZCX runtime. We have no simple way to distinguish ZCX
...@@ -1929,7 +1929,7 @@ __gnat_error_handler (int sig, siginfo_t *si, void *sc) ...@@ -1929,7 +1929,7 @@ __gnat_error_handler (int sig, siginfo_t *si, void *sc)
necessary. This only incurs a few extra instructions and a tiny necessary. This only incurs a few extra instructions and a tiny
amount of extra stack usage. */ amount of extra stack usage. */
#if (defined (i386) || defined (__i386__)) && !defined (VTHREADS) #if defined (__i386__) && !defined (VTHREADS)
/* On x86, the vxsim signal context is subtly different and is processeed /* On x86, the vxsim signal context is subtly different and is processeed
by a handler compiled especially for vxsim. */ by a handler compiled especially for vxsim. */
...@@ -2021,7 +2021,7 @@ __gnat_install_handler (void) ...@@ -2021,7 +2021,7 @@ __gnat_install_handler (void)
trap_0_entry->inst_fourth = 0xa1480000; trap_0_entry->inst_fourth = 0xa1480000;
#endif #endif
#if (defined (i386) || defined (__i386__)) && !defined (VTHREADS) #if defined (__i386__) && !defined (VTHREADS)
/* By experiment, found that sysModel () returns the following string /* By experiment, found that sysModel () returns the following string
prefix for vxsim when running on Linux and Windows. */ prefix for vxsim when running on Linux and Windows. */
model = sysModel (); model = sysModel ();
...@@ -2054,7 +2054,7 @@ __gnat_init_float (void) ...@@ -2054,7 +2054,7 @@ __gnat_init_float (void)
#endif #endif
#endif #endif
#if (defined (__i386__) || defined (i386)) && !defined (VTHREADS) #if defined (__i386__) && !defined (VTHREADS)
/* This is used to properly initialize the FPU on an x86 for each /* This is used to properly initialize the FPU on an x86 for each
process thread. */ process thread. */
asm ("finit"); asm ("finit");
...@@ -2530,7 +2530,7 @@ __gnat_install_handler (void) ...@@ -2530,7 +2530,7 @@ __gnat_install_handler (void)
void void
__gnat_init_float (void) __gnat_init_float (void)
{ {
#if defined (__i386__) || defined (i386) || defined (__x86_64) #if defined (__i386__) || defined (__x86_64__)
/* This is used to properly initialize the FPU on an x86 for each /* This is used to properly initialize the FPU on an x86 for each
process thread. */ process thread. */
......
...@@ -125,7 +125,7 @@ const char *__gnat_object_library_extension = ".a"; ...@@ -125,7 +125,7 @@ const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 1; unsigned char __gnat_separate_run_path_options = 1;
const char *__gnat_default_libgcc_subdir = "lib"; const char *__gnat_default_libgcc_subdir = "lib";
#elif defined (linux) || defined(__GLIBC__) #elif defined (__linux__) || defined (__GLIBC__)
const char *__gnat_object_file_option = "-Wl,@"; const char *__gnat_object_file_option = "-Wl,@";
const char *__gnat_run_path_option = "-Wl,-rpath,"; const char *__gnat_run_path_option = "-Wl,-rpath,";
char __gnat_shared_libgnat_default = STATIC; char __gnat_shared_libgnat_default = STATIC;
...@@ -183,7 +183,7 @@ const char *__gnat_object_library_extension = ".olb"; ...@@ -183,7 +183,7 @@ const char *__gnat_object_library_extension = ".olb";
unsigned char __gnat_separate_run_path_options = 0; unsigned char __gnat_separate_run_path_options = 0;
const char *__gnat_default_libgcc_subdir = "lib"; const char *__gnat_default_libgcc_subdir = "lib";
#elif defined (sun) #elif defined (__sun__)
const char *__gnat_object_file_option = ""; const char *__gnat_object_file_option = "";
const char *__gnat_run_path_option = "-Wl,-R"; const char *__gnat_run_path_option = "-Wl,-R";
char __gnat_shared_libgnat_default = STATIC; char __gnat_shared_libgnat_default = STATIC;
...@@ -200,7 +200,7 @@ const char *__gnat_default_libgcc_subdir = "lib/amd64"; ...@@ -200,7 +200,7 @@ const char *__gnat_default_libgcc_subdir = "lib/amd64";
const char *__gnat_default_libgcc_subdir = "lib"; const char *__gnat_default_libgcc_subdir = "lib";
#endif #endif
#elif defined (__svr4__) && defined (i386) #elif defined (__svr4__) && defined (__i386__)
const char *__gnat_object_file_option = ""; const char *__gnat_object_file_option = "";
const char *__gnat_run_path_option = ""; const char *__gnat_run_path_option = "";
char __gnat_shared_libgnat_default = STATIC; char __gnat_shared_libgnat_default = STATIC;
......
...@@ -1014,7 +1014,7 @@ CNU(RTS_CONTROL_ENABLE, "Enable RTS flow ctrl") ...@@ -1014,7 +1014,7 @@ CNU(RTS_CONTROL_ENABLE, "Enable RTS flow ctrl")
*/ */
#if defined (__FreeBSD__) || defined (linux) #if defined (__FreeBSD__) || defined (__linux__)
# define PTY_Library "-lutil" # define PTY_Library "-lutil"
#else #else
# define PTY_Library "" # define PTY_Library ""
...@@ -1321,7 +1321,7 @@ CND(SIZEOF_tv_usec, "tv_usec") ...@@ -1321,7 +1321,7 @@ CND(SIZEOF_tv_usec, "tv_usec")
** hard-wired limit of 100 million. ** hard-wired limit of 100 million.
** On IA64 HP-UX the limit is 2**31 - 1. ** On IA64 HP-UX the limit is 2**31 - 1.
**/ **/
#if defined (sun) #if defined (__sun__)
# define MAX_tv_sec "100_000_000" # define MAX_tv_sec "100_000_000"
#elif defined (__hpux__) #elif defined (__hpux__)
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#endif #endif
#ifdef __ANDROID__ #ifdef __ANDROID__
#undef linux #undef __linux__
#endif #endif
#ifdef IN_RTS #ifdef IN_RTS
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#if defined (sun) && defined (__SVR4) && !defined (__vxworks) #if defined (__sun__) && !defined (__vxworks)
/* The declaration is present in <time.h> but conditionalized /* The declaration is present in <time.h> but conditionalized
on a couple of macros we don't define. */ on a couple of macros we don't define. */
extern struct tm *localtime_r(const time_t *, struct tm *); extern struct tm *localtime_r(const time_t *, struct tm *);
...@@ -282,10 +282,10 @@ __gnat_ttyname (int filedes) ...@@ -282,10 +282,10 @@ __gnat_ttyname (int filedes)
} }
#endif #endif
#if defined (linux) || defined (sun) \ #if defined (__linux__) || defined (__sun__) \
|| defined (WINNT) \ || defined (WINNT) \
|| defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \ || defined (__MACHTEN__) || defined (__hpux__) || defined (_AIX) \
|| (defined (__svr4__) && defined (i386)) || defined (__Lynx__) \ || (defined (__svr4__) && defined (__i386__)) || defined (__Lynx__) \
|| defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ || defined (__CYGWIN__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
|| defined (__GLIBC__) || defined (__APPLE__) || defined (__GLIBC__) || defined (__APPLE__)
...@@ -335,9 +335,9 @@ getc_immediate_common (FILE *stream, ...@@ -335,9 +335,9 @@ getc_immediate_common (FILE *stream,
int *avail, int *avail,
int waiting ATTRIBUTE_UNUSED) int waiting ATTRIBUTE_UNUSED)
{ {
#if defined (linux) || defined (sun) \ #if defined (__linux__) || defined (__sun__) \
|| defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \ || defined (__CYGWIN32__) || defined (__MACHTEN__) || defined (__hpux__) \
|| defined (_AIX) || (defined (__svr4__) && defined (i386)) \ || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \
|| defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
|| defined (__GLIBC__) || defined (__APPLE__) || defined (__GLIBC__) || defined (__APPLE__)
char c; char c;
...@@ -355,9 +355,9 @@ getc_immediate_common (FILE *stream, ...@@ -355,9 +355,9 @@ getc_immediate_common (FILE *stream,
/* Set RAW mode, with no echo */ /* Set RAW mode, with no echo */
termios_rec.c_lflag = termios_rec.c_lflag & ~ICANON & ~ECHO; termios_rec.c_lflag = termios_rec.c_lflag & ~ICANON & ~ECHO;
#if defined(linux) || defined (sun) \ #if defined (__linux__) || defined (__sun__) \
|| defined (__MACHTEN__) || defined (__hpux__) \ || defined (__MACHTEN__) || defined (__hpux__) \
|| defined (_AIX) || (defined (__svr4__) && defined (i386)) \ || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \
|| defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ || defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
|| defined (__GLIBC__) || defined (__APPLE__) || defined (__GLIBC__) || defined (__APPLE__)
eof_ch = termios_rec.c_cc[VEOF]; eof_ch = termios_rec.c_cc[VEOF];
...@@ -756,7 +756,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED, ...@@ -756,7 +756,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED,
struct tm tp ATTRIBUTE_UNUSED; struct tm tp ATTRIBUTE_UNUSED;
/* AIX, HPUX, Sun Solaris */ /* AIX, HPUX, Sun Solaris */
#if defined (_AIX) || defined (__hpux__) || defined (sun) #if defined (_AIX) || defined (__hpux__) || defined (__sun__)
{ {
(*Lock_Task) (); (*Lock_Task) ();
...@@ -819,7 +819,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED, ...@@ -819,7 +819,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED,
/* Darwin, Free BSD, Linux, where component tm_gmtoff is present in /* Darwin, Free BSD, Linux, where component tm_gmtoff is present in
struct tm */ struct tm */
#elif defined (__APPLE__) || defined (__FreeBSD__) || defined (linux) \ #elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \
|| defined (__GLIBC__) || defined (__GLIBC__)
{ {
localtime_r (timer, &tp); localtime_r (timer, &tp);
......
...@@ -1059,7 +1059,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns) ...@@ -1059,7 +1059,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
|| defined (__OpenBSD__) \ || defined (__OpenBSD__) \
|| defined (__NetBSD__) \ || defined (__NetBSD__) \
|| defined (__DragonFly__) || defined (__DragonFly__)
# define FREEBSD # define BSD
#endif #endif
/* Include every system header we need */ /* Include every system header we need */
...@@ -1070,8 +1070,8 @@ __gnat_setup_winsize (void *desc, int rows, int columns) ...@@ -1070,8 +1070,8 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
/* On some system termio is either absent or including it will disable termios /* On some system termio is either absent or including it will disable termios
(HP-UX) */ (HP-UX) */
#if ! defined (__hpux__) && ! defined (FREEBSD) && \ #if !defined (__hpux__) && !defined (BSD) && !defined (__APPLE__) \
! defined (__APPLE__) && ! defined(__rtems__) && !defined (__rtems__)
# include <termio.h> # include <termio.h>
#endif #endif
...@@ -1083,10 +1083,10 @@ __gnat_setup_winsize (void *desc, int rows, int columns) ...@@ -1083,10 +1083,10 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#if defined (sun) #if defined (__sun__)
# include <sys/stropts.h> # include <sys/stropts.h>
#endif #endif
#if defined (FREEBSD) || defined (sun) #if defined (BSD) || defined (__sun__)
# include <sys/signal.h> # include <sys/signal.h>
#endif #endif
#if defined (__hpux__) #if defined (__hpux__)
...@@ -1098,7 +1098,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns) ...@@ -1098,7 +1098,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
/* On HP-UX and Sun system, there is a bzero function but with a different /* On HP-UX and Sun system, there is a bzero function but with a different
signature. Use memset instead */ signature. Use memset instead */
#if defined (__hpux__) || defined (sun) || defined (_AIX) #if defined (__hpux__) || defined (__sun__) || defined (_AIX)
# define bzero(s,n) memset (s,0,n) # define bzero(s,n) memset (s,0,n)
#endif #endif
...@@ -1116,11 +1116,11 @@ __gnat_setup_winsize (void *desc, int rows, int columns) ...@@ -1116,11 +1116,11 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
*/ */
/* Configurable part */ /* Configurable part */
#if defined (__APPLE__) || defined (FREEBSD) #if defined (__APPLE__) || defined (BSD)
#define USE_OPENPTY #define USE_OPENPTY
#elif defined (linux) #elif defined (__linux__)
#define USE_GETPT #define USE_GETPT
#elif defined (sun) #elif defined (__sun__)
#define USE_CLONE_DEVICE "/dev/ptmx" #define USE_CLONE_DEVICE "/dev/ptmx"
#elif defined (_AIX) #elif defined (_AIX)
#define USE_CLONE_DEVICE "/dev/ptc" #define USE_CLONE_DEVICE "/dev/ptc"
...@@ -1406,7 +1406,7 @@ __gnat_setup_child_communication ...@@ -1406,7 +1406,7 @@ __gnat_setup_child_communication
desc->slave_fd = open (desc->slave_name, O_RDWR, 0); desc->slave_fd = open (desc->slave_name, O_RDWR, 0);
#endif #endif
#if defined (sun) || defined (__hpux__) #if defined (__sun__) || defined (__hpux__)
/* On systems such as Solaris we are using stream. We need to push the right /* On systems such as Solaris we are using stream. We need to push the right
"modules" in order to get the expected terminal behaviors. Otherwise "modules" in order to get the expected terminal behaviors. Otherwise
functionalities such as termios are not available. */ functionalities such as termios are not available. */
......
...@@ -335,7 +335,7 @@ extern void __runnit(); /* thread entry point. */ ...@@ -335,7 +335,7 @@ extern void __runnit(); /* thread entry point. */
/*-------------------- PPC ELF (GNU/Linux & VxWorks) ---------------------*/ /*-------------------- PPC ELF (GNU/Linux & VxWorks) ---------------------*/
#elif (defined (_ARCH_PPC) && defined (__vxworks)) || \ #elif (defined (_ARCH_PPC) && defined (__vxworks)) || \
(defined (linux) && defined (__powerpc__)) (defined (__linux__) && defined (__powerpc__))
#define USE_GENERIC_UNWINDER #define USE_GENERIC_UNWINDER
...@@ -363,7 +363,7 @@ struct layout ...@@ -363,7 +363,7 @@ struct layout
/*-------------------------- SPARC Solaris -----------------------------*/ /*-------------------------- SPARC Solaris -----------------------------*/
#elif defined (sun) && defined (sparc) #elif defined (__sun__) && defined (__sparc__)
#define USE_GENERIC_UNWINDER #define USE_GENERIC_UNWINDER
...@@ -401,12 +401,12 @@ struct layout ...@@ -401,12 +401,12 @@ struct layout
/*------------------------------- x86 ----------------------------------*/ /*------------------------------- x86 ----------------------------------*/
#elif defined (i386) #elif defined (__i386__)
#if defined (__WIN32) #if defined (__WIN32)
#include <windows.h> #include <windows.h>
#define IS_BAD_PTR(ptr) (IsBadCodePtr((FARPROC)ptr)) #define IS_BAD_PTR(ptr) (IsBadCodePtr((FARPROC)ptr))
#elif defined (sun) #elif defined (__sun__)
#define IS_BAD_PTR(ptr) ((unsigned long)ptr == -1UL) #define IS_BAD_PTR(ptr) ((unsigned long)ptr == -1UL)
#else #else
#define IS_BAD_PTR(ptr) 0 #define IS_BAD_PTR(ptr) 0
...@@ -415,7 +415,7 @@ struct layout ...@@ -415,7 +415,7 @@ struct layout
/* Starting with GCC 4.6, -fomit-frame-pointer is turned on by default for /* Starting with GCC 4.6, -fomit-frame-pointer is turned on by default for
32-bit x86/Linux as well and DWARF 2 unwind tables are emitted instead. 32-bit x86/Linux as well and DWARF 2 unwind tables are emitted instead.
See the x86-64 case below for the drawbacks with this approach. */ See the x86-64 case below for the drawbacks with this approach. */
#if defined (linux) && (__GNUC__ * 10 + __GNUC_MINOR__ > 45) #if defined (__linux__) && (__GNUC__ * 10 + __GNUC_MINOR__ > 45)
#define USE_GCC_UNWINDER #define USE_GCC_UNWINDER
#else #else
#define USE_GENERIC_UNWINDER #define USE_GENERIC_UNWINDER
...@@ -481,7 +481,7 @@ struct layout ...@@ -481,7 +481,7 @@ struct layout
/*----------------------------- ia64 ---------------------------------*/ /*----------------------------- ia64 ---------------------------------*/
#elif defined (__ia64__) && (defined (linux) || defined (__hpux__)) #elif defined (__ia64__) && (defined (__linux__) || defined (__hpux__))
#define USE_GCC_UNWINDER #define USE_GCC_UNWINDER
/* Use _Unwind_Backtrace driven exceptions on ia64 HP-UX and ia64 /* Use _Unwind_Backtrace driven exceptions on ia64 HP-UX and ia64
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment