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
This commit is contained in:
Eric Botcazou 2015-05-30 21:13:59 +00:00 committed by Eric Botcazou
parent c67e8801d9
commit 329be64b06
13 changed files with 82 additions and 67 deletions

View File

@ -1,3 +1,19 @@
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

View File

@ -743,7 +743,7 @@ __gnat_rmdir (char *path)
#endif
}
#if defined (_WIN32) || defined (linux) || defined (sun) \
#if defined (_WIN32) || defined (__linux__) || defined (__sun__) \
|| defined (__FreeBSD__)
#define HAS_TARGET_WCHAR_T
#endif
@ -982,7 +982,7 @@ __gnat_open_new_temp (char *path, int fmode)
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);
@ -1153,8 +1153,8 @@ __gnat_tmp_name (char *tmp_filename)
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");
@ -1224,7 +1224,7 @@ DIR* __gnat_opendir (char *name)
/* 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
@ -2160,7 +2160,7 @@ __gnat_is_symbolic_link (char *name ATTRIBUTE_UNUSED)
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. */
@ -2267,7 +2267,8 @@ __gnat_number_of_cpus (void)
{
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__)
@ -3066,7 +3067,7 @@ __gnat_lwp_self (void)
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. */
@ -3155,7 +3156,7 @@ __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
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
@ -3164,8 +3165,6 @@ __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
#if defined (__APPLE__)
#include <mach-o/dyld.h>
#elif 0 && defined (__linux__)
#include <link.h>
#endif
const void *

View File

@ -51,7 +51,7 @@ extern "C" {
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
@ -279,10 +279,10 @@ extern char * __gnat_locate_file_with_predicate (char *, char *,
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 */

View File

@ -49,7 +49,7 @@ extern "C" {
/* 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

View File

@ -69,7 +69,7 @@ extern "C" {
#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 */
@ -277,8 +277,8 @@ __gnat_fseek64 (FILE *stream, __int64 offset, int origin)
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

View File

@ -211,7 +211,7 @@ __gnat_environ (void)
return NULL;
#elif defined (__MINGW32__)
return _environ;
#elif defined (sun)
#elif defined (__sun__)
extern char **_environ;
return _environ;
#elif defined (__APPLE__) && !defined (__arm__)
@ -229,7 +229,7 @@ void __gnat_unsetenv (char *name)
#if defined (VMS)
/* Not implemented */
return;
#elif defined (__hpux__) || defined (sun) \
#elif defined (__hpux__) || defined (__sun__) \
|| (defined (__vxworks) && ! defined (__RTP__)) \
|| defined (_AIX) || defined (__Lynx__)
@ -288,7 +288,7 @@ void __gnat_clearenv (void)
#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

View File

@ -212,9 +212,9 @@
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

View File

@ -49,7 +49,7 @@
#endif
#ifdef __ANDROID__
#undef linux
#undef __linux__
#endif
#ifdef IN_RTS
@ -403,7 +403,7 @@ __gnat_install_handler (void)
/* GNU/Linux Section */
/*********************/
#elif defined (linux)
#elif defined (__linux__)
#include <signal.h>
@ -452,7 +452,7 @@ void fake_linux_sigemptyset (sigset_t *set)
#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
@ -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
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)
@ -703,7 +703,7 @@ __gnat_install_handler(void)
/* Solaris Section */
/*******************/
#elif defined (sun) && defined (__SVR4) && !defined (__vxworks)
#elif defined (__sun__) && !defined (__vxworks)
#include <signal.h>
#include <siginfo.h>
@ -1702,7 +1702,7 @@ __gnat_install_handler ()
#include <signal.h>
#include <taskLib.h>
#if (defined (i386) || defined (__i386__)) && !defined (VTHREADS)
#if defined (__i386__) && !defined (VTHREADS)
#include <sysLib.h>
#endif
@ -1898,7 +1898,7 @@ __gnat_map_signal (int sig, siginfo_t *si ATTRIBUTE_UNUSED,
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);
@ -1921,7 +1921,7 @@ __gnat_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
@ -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
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. */
@ -2021,7 +2021,7 @@ __gnat_install_handler (void)
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 ();
@ -2054,7 +2054,7 @@ __gnat_init_float (void)
#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");
@ -2530,7 +2530,7 @@ __gnat_install_handler (void)
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. */

View File

@ -125,7 +125,7 @@ const char *__gnat_object_library_extension = ".a";
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;
@ -183,7 +183,7 @@ const char *__gnat_object_library_extension = ".olb";
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;
@ -200,7 +200,7 @@ const char *__gnat_default_libgcc_subdir = "lib/amd64";
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;

View File

@ -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"
#else
# define PTY_Library ""
@ -1321,7 +1321,7 @@ CND(SIZEOF_tv_usec, "tv_usec")
** 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__)

View File

@ -49,7 +49,7 @@
#endif
#ifdef __ANDROID__
#undef linux
#undef __linux__
#endif
#ifdef IN_RTS
@ -66,7 +66,7 @@
#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 *);
@ -282,10 +282,10 @@ __gnat_ttyname (int filedes)
}
#endif
#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__)
@ -335,9 +335,9 @@ getc_immediate_common (FILE *stream,
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;
@ -355,9 +355,9 @@ getc_immediate_common (FILE *stream,
/* 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];
@ -756,7 +756,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED,
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) ();
@ -819,7 +819,7 @@ __gnat_localtime_tzoff (const time_t *timer ATTRIBUTE_UNUSED,
/* 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);

View File

@ -1059,7 +1059,7 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
|| defined (__OpenBSD__) \
|| defined (__NetBSD__) \
|| defined (__DragonFly__)
# define FREEBSD
# define BSD
#endif
/* Include every system header we need */
@ -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
(HP-UX) */
#if ! defined (__hpux__) && ! defined (FREEBSD) && \
! defined (__APPLE__) && ! defined(__rtems__)
#if !defined (__hpux__) && !defined (BSD) && !defined (__APPLE__) \
&& !defined (__rtems__)
# include <termio.h>
#endif
@ -1083,10 +1083,10 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
#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__)
@ -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
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
@ -1116,11 +1116,11 @@ __gnat_setup_winsize (void *desc, int rows, int columns)
*/
/* 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"
@ -1406,7 +1406,7 @@ __gnat_setup_child_communication
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. */

View File

@ -335,7 +335,7 @@ extern void __runnit(); /* thread entry point. */
/*-------------------- PPC ELF (GNU/Linux & VxWorks) ---------------------*/
#elif (defined (_ARCH_PPC) && defined (__vxworks)) || \
(defined (linux) && defined (__powerpc__))
(defined (__linux__) && defined (__powerpc__))
#define USE_GENERIC_UNWINDER
@ -363,7 +363,7 @@ struct layout
/*-------------------------- SPARC Solaris -----------------------------*/
#elif defined (sun) && defined (sparc)
#elif defined (__sun__) && defined (__sparc__)
#define USE_GENERIC_UNWINDER
@ -401,12 +401,12 @@ struct layout
/*------------------------------- 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
@ -415,7 +415,7 @@ struct layout
/* 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
@ -481,7 +481,7 @@ struct layout
/*----------------------------- 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