+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>
* gcc-interface/utils.c (max_size) <tcc_binary>: Add special code to
#endif
}
-#if defined (_WIN32) || defined (linux) || defined (sun) \
+#if defined (_WIN32) || defined (__linux__) || defined (__sun__) \
|| defined (__FreeBSD__)
#define HAS_TARGET_WCHAR_T
#endif
strcpy (path, "GNAT-XXXXXX");
#if (defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) \
- || defined (linux) || defined(__GLIBC__)) && !defined (__vxworks)
+ || defined (__linux__) || defined (__GLIBC__)) && !defined (__vxworks)
return mkstemp (path);
#elif defined (__Lynx__)
mktemp (path);
free (pname);
}
-#elif defined (linux) || defined (__FreeBSD__) || defined (__NetBSD__) \
- || defined (__OpenBSD__) || defined(__GLIBC__) || defined (__ANDROID__)
+#elif defined (__linux__) || defined (__FreeBSD__) || defined (__NetBSD__) \
+ || defined (__OpenBSD__) || defined (__GLIBC__) || defined (__ANDROID__)
#define MAX_SAFE_PATH 1000
char *tmpdir = getenv ("TMPDIR");
/* Read the next entry in a directory. The returned string points somewhere
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
fail with EOVERFLOW if the server uses 64-bit cookies. */
#define dirent dirent64
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
duplicates only the active thread, must be used instead, or spawning
subprocess from a program with tasking will lead into numerous problems. */
{
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);
#elif defined (__hpux__)
return (void *) pthread_self ();
}
-#elif defined (linux)
+#elif defined (__linux__)
/* 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
information. */
CPU_SET (cpu - 1, set);
}
#endif /* !CPU_ALLOC */
-#endif /* linux */
+#endif /* __linux__ */
/* 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
#if defined (__APPLE__)
#include <mach-o/dyld.h>
-#elif 0 && defined (__linux__)
-#include <link.h>
#endif
const void *
determine at compile time what support the system offers for large files.
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_OPEN open64
#define GNAT_STAT stat64
int (*)(char*));
#if defined (__ANDROID__)
-#undef linux
+#undef __linux__
extern void *__gnat_lwp_self (void);
-#elif defined (linux)
+#elif defined (__linux__)
extern void *__gnat_lwp_self (void);
/* Routines for interface to required CPU set primitives */
/* Don't use macros on GNU/Linux since they cause incompatible changes between
glibc 2.0 and 2.1 */
-#ifdef linux
+#ifdef __linux__
#undef putchar
#undef getchar
#undef fputc
#include <unixlib.h>
#endif
-#ifdef linux
+#ifdef __linux__
/* Don't use macros on GNU/Linux since they cause incompatible changes between
glibc 2.0 and 2.1 */
return _fseeki64 (stream, offset, origin);
}
-#elif defined(linux) || defined(sun) \
- || defined (__FreeBSD__) || defined(__APPLE__)
+#elif defined (__linux__) || defined (__sun__) || defined (__FreeBSD__) \
+ || defined (__APPLE__)
/* section for platforms having ftello/fseeko */
__int64
return NULL;
#elif defined (__MINGW32__)
return _environ;
-#elif defined (sun)
+#elif defined (__sun__)
extern char **_environ;
return _environ;
#elif defined (__APPLE__) && !defined (__arm__)
#if defined (VMS)
/* Not implemented */
return;
-#elif defined (__hpux__) || defined (sun) \
+#elif defined (__hpux__) || defined (__sun__) \
|| (defined (__vxworks) && ! defined (__RTP__)) \
|| defined (_AIX) || defined (__Lynx__)
#if defined (VMS)
/* not implemented */
return;
-#elif defined (sun) \
+#elif defined (__sun__) \
|| (defined (__vxworks) && ! defined (__RTP__)) || defined (__Lynx__) \
|| defined (__PikeOS__)
/* On Solaris, VxWorks (not RTPs), and Lynx there is no system
defined (_WIN32) || defined (__APPLE__) || defined (__ANDROID__)
# define HAVE_THREAD_SAFE_GETxxxBYyyy 1
-#elif defined (linux) || defined (__GLIBC__) || \
- (defined (sun) && defined (__SVR4) && !defined (__vxworks)) || \
- defined(__rtems__)
+#elif defined (__linux__) || defined (__GLIBC__) || \
+ (defined (__sun__) && !defined (__vxworks)) || \
+ defined (__rtems__)
# define HAVE_GETxxxBYyyy_R 1
#endif
#endif
#ifdef __ANDROID__
-#undef linux
+#undef __linux__
#endif
#ifdef IN_RTS
/* GNU/Linux Section */
/*********************/
-#elif defined (linux)
+#elif defined (__linux__)
#include <signal.h>
#endif
-#if defined (i386) || defined (__x86_64__) || defined (__ia64__) \
+#if defined (__i386__) || defined (__x86_64__) || defined (__ia64__) \
|| defined (__ARMEL__)
#define HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE
The stack checking code guarantees that this address is unused by the
time this happens. */
-#if defined (i386)
+#if defined (__i386__)
unsigned long *pc = (unsigned long *)mcontext->gregs[REG_EIP];
/* The pattern is "orl $0x0,(%esp)" for a probe in 32-bit mode. */
if (signo == SIGSEGV && pc && *pc == 0x00240c83)
/* Solaris Section */
/*******************/
-#elif defined (sun) && defined (__SVR4) && !defined (__vxworks)
+#elif defined (__sun__) && !defined (__vxworks)
#include <signal.h>
#include <siginfo.h>
#include <signal.h>
#include <taskLib.h>
-#if (defined (i386) || defined (__i386__)) && !defined (VTHREADS)
+#if defined (__i386__) && !defined (VTHREADS)
#include <sysLib.h>
#endif
Raise_From_Signal_Handler (exception, msg);
}
-#if (defined (i386) || defined (__i386__)) && !defined (VTHREADS)
+#if defined (__i386__) && !defined (VTHREADS)
extern void
__gnat_vxsim_error_handler (int sig, siginfo_t *si, void *sc);
sigdelset (&mask, sig);
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
Info trampoline, voiding the need for myriads of fallback_frame_state
variants in the ZCX runtime. We have no simple way to distinguish ZCX
necessary. This only incurs a few extra instructions and a tiny
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
by a handler compiled especially for vxsim. */
trap_0_entry->inst_fourth = 0xa1480000;
#endif
-#if (defined (i386) || defined (__i386__)) && !defined (VTHREADS)
+#if defined (__i386__) && !defined (VTHREADS)
/* By experiment, found that sysModel () returns the following string
prefix for vxsim when running on Linux and Windows. */
model = sysModel ();
#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
process thread. */
asm ("finit");
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
process thread. */
unsigned char __gnat_separate_run_path_options = 1;
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_run_path_option = "-Wl,-rpath,";
char __gnat_shared_libgnat_default = STATIC;
unsigned char __gnat_separate_run_path_options = 0;
const char *__gnat_default_libgcc_subdir = "lib";
-#elif defined (sun)
+#elif defined (__sun__)
const char *__gnat_object_file_option = "";
const char *__gnat_run_path_option = "-Wl,-R";
char __gnat_shared_libgnat_default = STATIC;
const char *__gnat_default_libgcc_subdir = "lib";
#endif
-#elif defined (__svr4__) && defined (i386)
+#elif defined (__svr4__) && defined (__i386__)
const char *__gnat_object_file_option = "";
const char *__gnat_run_path_option = "";
char __gnat_shared_libgnat_default = STATIC;
*/
-#if defined (__FreeBSD__) || defined (linux)
+#if defined (__FreeBSD__) || defined (__linux__)
# define PTY_Library "-lutil"
#else
# define PTY_Library ""
** hard-wired limit of 100 million.
** On IA64 HP-UX the limit is 2**31 - 1.
**/
-#if defined (sun)
+#if defined (__sun__)
# define MAX_tv_sec "100_000_000"
#elif defined (__hpux__)
#endif
#ifdef __ANDROID__
-#undef linux
+#undef __linux__
#endif
#ifdef IN_RTS
#include <time.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
on a couple of macros we don't define. */
extern struct tm *localtime_r(const time_t *, struct tm *);
}
#endif
\f
-#if defined (linux) || defined (sun) \
+#if defined (__linux__) || defined (__sun__) \
|| defined (WINNT) \
|| 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 (__GLIBC__) || defined (__APPLE__)
int *avail,
int waiting ATTRIBUTE_UNUSED)
{
-#if defined (linux) || defined (sun) \
+#if defined (__linux__) || defined (__sun__) \
|| 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 (__GLIBC__) || defined (__APPLE__)
char c;
/* Set RAW mode, with no 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 (_AIX) || (defined (__svr4__) && defined (i386)) \
+ || defined (_AIX) || (defined (__svr4__) && defined (__i386__)) \
|| defined (__Lynx__) || defined (__FreeBSD__) || defined (__OpenBSD__) \
|| defined (__GLIBC__) || defined (__APPLE__)
eof_ch = termios_rec.c_cc[VEOF];
struct tm tp ATTRIBUTE_UNUSED;
/* AIX, HPUX, Sun Solaris */
-#if defined (_AIX) || defined (__hpux__) || defined (sun)
+#if defined (_AIX) || defined (__hpux__) || defined (__sun__)
{
(*Lock_Task) ();
/* Darwin, Free BSD, Linux, where component tm_gmtoff is present in
struct tm */
-#elif defined (__APPLE__) || defined (__FreeBSD__) || defined (linux) \
+#elif defined (__APPLE__) || defined (__FreeBSD__) || defined (__linux__) \
|| defined (__GLIBC__)
{
localtime_r (timer, &tp);
|| defined (__OpenBSD__) \
|| defined (__NetBSD__) \
|| defined (__DragonFly__)
-# define FREEBSD
+# define BSD
#endif
/* Include every system header we need */
/* On some system termio is either absent or including it will disable termios
(HP-UX) */
-#if ! defined (__hpux__) && ! defined (FREEBSD) && \
- ! defined (__APPLE__) && ! defined(__rtems__)
+#if !defined (__hpux__) && !defined (BSD) && !defined (__APPLE__) \
+ && !defined (__rtems__)
# include <termio.h>
#endif
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
-#if defined (sun)
+#if defined (__sun__)
# include <sys/stropts.h>
#endif
-#if defined (FREEBSD) || defined (sun)
+#if defined (BSD) || defined (__sun__)
# include <sys/signal.h>
#endif
#if defined (__hpux__)
/* On HP-UX and Sun system, there is a bzero function but with a different
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)
#endif
*/
/* Configurable part */
-#if defined (__APPLE__) || defined (FREEBSD)
+#if defined (__APPLE__) || defined (BSD)
#define USE_OPENPTY
-#elif defined (linux)
+#elif defined (__linux__)
#define USE_GETPT
-#elif defined (sun)
+#elif defined (__sun__)
#define USE_CLONE_DEVICE "/dev/ptmx"
#elif defined (_AIX)
#define USE_CLONE_DEVICE "/dev/ptc"
desc->slave_fd = open (desc->slave_name, O_RDWR, 0);
#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
"modules" in order to get the expected terminal behaviors. Otherwise
functionalities such as termios are not available. */
/*-------------------- PPC ELF (GNU/Linux & VxWorks) ---------------------*/
#elif (defined (_ARCH_PPC) && defined (__vxworks)) || \
- (defined (linux) && defined (__powerpc__))
+ (defined (__linux__) && defined (__powerpc__))
#define USE_GENERIC_UNWINDER
/*-------------------------- SPARC Solaris -----------------------------*/
-#elif defined (sun) && defined (sparc)
+#elif defined (__sun__) && defined (__sparc__)
#define USE_GENERIC_UNWINDER
/*------------------------------- x86 ----------------------------------*/
-#elif defined (i386)
+#elif defined (__i386__)
#if defined (__WIN32)
#include <windows.h>
#define IS_BAD_PTR(ptr) (IsBadCodePtr((FARPROC)ptr))
-#elif defined (sun)
+#elif defined (__sun__)
#define IS_BAD_PTR(ptr) ((unsigned long)ptr == -1UL)
#else
#define IS_BAD_PTR(ptr) 0
/* 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.
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
#else
#define USE_GENERIC_UNWINDER
/*----------------------------- ia64 ---------------------------------*/
-#elif defined (__ia64__) && (defined (linux) || defined (__hpux__))
+#elif defined (__ia64__) && (defined (__linux__) || defined (__hpux__))
#define USE_GCC_UNWINDER
/* Use _Unwind_Backtrace driven exceptions on ia64 HP-UX and ia64