From: ghazi Date: Sat, 29 Nov 2003 03:08:13 +0000 (+0000) Subject: * config/gnu.h (HURD_TARGET_OS_CPP_BUILTINS): New. X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=bcc7696667c337d732a24c0e9f4ccee1e1f728de * config/gnu.h (HURD_TARGET_OS_CPP_BUILTINS): New. * config/linux.h (LINUX_TARGET_OS_CPP_BUILTINS): New. * config/alpha/gnu.h, config/alpha/linux.h, config/arm/linux-elf.h, config/cris/cris.h, config/cris/linux.h, config/i370/linux.h, config/i386/gnu.h, config/i386/i386.h, config/i386/linux-aout.h, config/i386/linux.h, config/i386/linux64.h, config/ia64/linux.h, config/m68k/linux.h, config/m68k/uclinux.h, config/mips/linux.h, config/mn10300/linux.h, config/pa/pa-linux.h, config/rs6000/sysv4.h, config/s390/linux.h, config/sh/linux.h, config/sparc/linux.h, config/sparc/linux64.h, config/xtensa/linux.h (TARGET_OS_CPP_BUILTINS): Use HURD_TARGET_OS_CPP_BUILTINS/LINUX_TARGET_OS_CPP_BUILTINS or ensure all necessary assertions are included. testsuite: * testsuite/gcc.dg/cpp/assert4.c: Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74031 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 920f03b47e4..b980ee6e26d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2003-11-28 Kaveh R. Ghazi + + * config/gnu.h (HURD_TARGET_OS_CPP_BUILTINS): New. + * config/linux.h (LINUX_TARGET_OS_CPP_BUILTINS): New. + + * config/alpha/gnu.h, config/alpha/linux.h, + config/arm/linux-elf.h, config/cris/cris.h, config/cris/linux.h, + config/i370/linux.h, config/i386/gnu.h, config/i386/i386.h, + config/i386/linux-aout.h, config/i386/linux.h, + config/i386/linux64.h, config/ia64/linux.h, config/m68k/linux.h, + config/m68k/uclinux.h, config/mips/linux.h, + config/mn10300/linux.h, config/pa/pa-linux.h, + config/rs6000/sysv4.h, config/s390/linux.h, config/sh/linux.h, + config/sparc/linux.h, config/sparc/linux64.h, + config/xtensa/linux.h (TARGET_OS_CPP_BUILTINS): Use + HURD_TARGET_OS_CPP_BUILTINS/LINUX_TARGET_OS_CPP_BUILTINS or ensure + all necessary assertions are included. + 2003-11-28 Jan Hubicka * emit-rtl.c (set_used_flags): New. diff --git a/gcc/config/alpha/gnu.h b/gcc/config/alpha/gnu.h index db2a278db4a..40348c60abb 100644 --- a/gcc/config/alpha/gnu.h +++ b/gcc/config/alpha/gnu.h @@ -6,11 +6,8 @@ #undef TARGET_OS_CPP_BUILTINS /* config.gcc includes alpha/linux.h. */ #define TARGET_OS_CPP_BUILTINS() \ do { \ - builtin_define ("__GNU__"); \ - builtin_define ("__gnu_hurd__"); \ + HURD_TARGET_OS_CPP_BUILTINS(); \ builtin_define ("_LONGLONG"); \ - builtin_define_std ("unix"); \ - builtin_assert ("system=gnu"); \ } while (0) #undef ELF_DYNAMIC_LINKER diff --git a/gcc/config/alpha/linux.h b/gcc/config/alpha/linux.h index 2c9cc8ea6a1..a4bc3d3e4a4 100644 --- a/gcc/config/alpha/linux.h +++ b/gcc/config/alpha/linux.h @@ -30,6 +30,8 @@ Boston, MA 02111-1307, USA. */ builtin_define_std ("linux"); \ builtin_define_std ("unix"); \ builtin_assert ("system=linux"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=posix"); \ /* The GNU C++ standard library requires this. */ \ if (c_dialect_cxx ()) \ builtin_define ("_GNU_SOURCE"); \ diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h index f55a42562cb..3cde7116d52 100644 --- a/gcc/config/arm/linux-elf.h +++ b/gcc/config/arm/linux-elf.h @@ -89,14 +89,7 @@ %{mbig-endian:-EB}" \ SUBTARGET_EXTRA_LINK_SPEC -#define TARGET_OS_CPP_BUILTINS() \ - do { \ - builtin_define_std ("unix"); \ - builtin_define_std ("linux"); \ - builtin_define ("__gnu_linux__"); \ - builtin_assert ("system=unix"); \ - builtin_assert ("system=posix"); \ - } while (0) +#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() /* This is how we tell the assembler that two symbols have the same value. */ #define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \ diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 288be199713..9f130d6448c 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -251,6 +251,8 @@ extern const char *cris_elinux_stacksize_str; builtin_define_std ("CRIS"); \ builtin_define_std ("GNU_CRIS"); \ builtin_define ("__CRIS_ABI_version=2"); \ + builtin_assert ("cpu=cris"); \ + builtin_assert ("machine=cris"); \ } \ while (0) diff --git a/gcc/config/cris/linux.h b/gcc/config/cris/linux.h index 288c2856ee6..f842f949d64 100644 --- a/gcc/config/cris/linux.h +++ b/gcc/config/cris/linux.h @@ -48,9 +48,7 @@ Boston, MA 02111-1307, USA. */ #undef CRIS_CPP_SUBTARGET_SPEC #define CRIS_CPP_SUBTARGET_SPEC \ "%{pthread:-D_REENTRANT}\ - %{!march=*:%{!cpu=*:-D__arch_v10 -D__CRIS_arch_version=10}}\ - %{!ansi:%{!std=*:%{!undef:-Dlinux -Dunix}\ - -Asystem(unix) -Asystem(posix) -Acpu(cris) -Amachine(cris)}}" + %{!march=*:%{!cpu=*:-D__arch_v10 -D__CRIS_arch_version=10}}" #undef CRIS_CC1_SUBTARGET_SPEC #define CRIS_CC1_SUBTARGET_SPEC \ @@ -103,9 +101,7 @@ Boston, MA 02111-1307, USA. */ #define TARGET_OS_CPP_BUILTINS() \ do \ { \ - builtin_define ("__gnu_linux__"); \ - builtin_define ("__linux__"); \ - builtin_define ("__unix__"); \ + LINUX_TARGET_OS_CPP_BUILTINS(); \ if (flag_pic) \ { \ builtin_define ("__PIC__"); \ diff --git a/gcc/config/gnu.h b/gcc/config/gnu.h index f5f4184e8d3..23a8a730ec9 100644 --- a/gcc/config/gnu.h +++ b/gcc/config/gnu.h @@ -18,3 +18,15 @@ /* The system headers under GNU are C++-aware. */ #define NO_IMPLICIT_EXTERN_C + +#define HURD_TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define ("__gnu_hurd__"); \ + builtin_define ("__GNU__"); \ + builtin_define_std ("unix"); \ + builtin_define_std ("MACH"); \ + builtin_assert ("system=gnu"); \ + builtin_assert ("system=mach"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=posix"); \ + } while (0) diff --git a/gcc/config/i370/linux.h b/gcc/config/i370/linux.h index adc1959c4d0..f402fbde9f3 100644 --- a/gcc/config/i370/linux.h +++ b/gcc/config/i370/linux.h @@ -29,13 +29,7 @@ Boston, MA 02111-1307, USA. */ #define TARGET_ELF_ABI /* Target OS preprocessor built-ins. */ -#define TARGET_OS_CPP_BUILTINS() \ - do { \ - builtin_define_std ("unix"); \ - builtin_define_std ("linux"); \ - builtin_define ("__gnu_linux__"); \ - builtin_assert ("system=posix"); \ - } while (0) +#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() /* Options for this target machine. */ diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h index ff0ff254bac..cc9994bcaed 100644 --- a/gcc/config/i386/gnu.h +++ b/gcc/config/i386/gnu.h @@ -7,14 +7,7 @@ #define TARGET_OS_CPP_BUILTINS() \ do \ { \ - builtin_define_std ("MACH"); \ - builtin_define_std ("unix"); \ - builtin_define ("__GNU__"); \ - builtin_define ("__gnu_hurd__"); \ - builtin_assert ("system=gnu"); \ - builtin_assert ("system=mach"); \ - builtin_assert ("system=posix"); \ - builtin_assert ("system=unix"); \ + HURD_TARGET_OS_CPP_BUILTINS(); \ if (flag_pic) \ { \ builtin_define ("__PIC__"); \ diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 2f5630a3bd9..c5c03abe20c 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -546,6 +546,7 @@ extern int x86_prefetch_sse; if (TARGET_64BIT) \ { \ builtin_assert ("cpu=x86_64"); \ + builtin_assert ("machine=x86_64"); \ builtin_define ("__amd64"); \ builtin_define ("__amd64__"); \ builtin_define ("__x86_64"); \ diff --git a/gcc/config/i386/linux-aout.h b/gcc/config/i386/linux-aout.h index b286b800fa6..d7be93c7312 100644 --- a/gcc/config/i386/linux-aout.h +++ b/gcc/config/i386/linux-aout.h @@ -26,10 +26,7 @@ Boston, MA 02111-1307, USA. */ #define TARGET_OS_CPP_BUILTINS() \ do \ { \ - builtin_define_std ("linux"); \ - builtin_define_std ("unix"); \ - builtin_define ("__gnu_linux__"); \ - builtin_assert ("system=posix"); \ + LINUX_TARGET_OS_CPP_BUILTINS(); \ if (flag_pic) \ { \ builtin_define ("__PIC__"); \ diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index 493d64f7974..e7d19ec181a 100644 --- a/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h @@ -73,10 +73,7 @@ Boston, MA 02111-1307, USA. */ #define TARGET_OS_CPP_BUILTINS() \ do \ { \ - builtin_define_std ("linux"); \ - builtin_define_std ("unix"); \ - builtin_define ("__gnu_linux__"); \ - builtin_assert ("system=posix"); \ + LINUX_TARGET_OS_CPP_BUILTINS(); \ if (flag_pic) \ { \ builtin_define ("__PIC__"); \ diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h index 416561733c1..98536c19bd3 100644 --- a/gcc/config/i386/linux64.h +++ b/gcc/config/i386/linux64.h @@ -24,10 +24,7 @@ Boston, MA 02111-1307, USA. */ #define TARGET_OS_CPP_BUILTINS() \ do \ { \ - builtin_define_std ("linux"); \ - builtin_define_std ("unix"); \ - builtin_define ("__gnu_linux__"); \ - builtin_assert ("system=posix"); \ + LINUX_TARGET_OS_CPP_BUILTINS(); \ if (flag_pic) \ { \ builtin_define ("__PIC__"); \ diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h index c24c70c8d5a..460dd26deae 100644 --- a/gcc/config/ia64/linux.h +++ b/gcc/config/ia64/linux.h @@ -12,10 +12,7 @@ /* Target OS builtins. */ #define TARGET_OS_CPP_BUILTINS() \ do { \ - builtin_assert("system=linux"); \ - builtin_define_std("linux"); \ - builtin_define_std("unix"); \ - builtin_define("__gnu_linux__"); \ + LINUX_TARGET_OS_CPP_BUILTINS(); \ builtin_define("_LONGLONG"); \ } while (0) diff --git a/gcc/config/linux.h b/gcc/config/linux.h index 2c85148c685..0f7ba1777e8 100644 --- a/gcc/config/linux.h +++ b/gcc/config/linux.h @@ -97,6 +97,16 @@ Boston, MA 02111-1307, USA. */ %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}" #endif +#define LINUX_TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define ("__gnu_linux__"); \ + builtin_define_std ("linux"); \ + builtin_define_std ("unix"); \ + builtin_assert ("system=linux"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=posix"); \ + } while (0) + #if !defined(USE_GNULIBC_1) && defined(HAVE_LD_EH_FRAME_HDR) #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " #endif diff --git a/gcc/config/m68k/linux.h b/gcc/config/m68k/linux.h index 5bf21c55e3d..03e637088fc 100644 --- a/gcc/config/m68k/linux.h +++ b/gcc/config/m68k/linux.h @@ -86,13 +86,9 @@ Boston, MA 02111-1307, USA. */ #define TARGET_OS_CPP_BUILTINS() \ do \ { \ + LINUX_TARGET_OS_CPP_BUILTINS(); \ builtin_define_std ("mc68000"); \ builtin_define_std ("mc68020"); \ - builtin_define_std ("linux"); \ - builtin_define_std ("unix"); \ - builtin_define ("__gnu_linux__"); \ - builtin_assert ("system=unix"); \ - builtin_assert ("system=posix"); \ } \ while (0) diff --git a/gcc/config/m68k/uclinux.h b/gcc/config/m68k/uclinux.h index 0231539281d..596cc1979c8 100644 --- a/gcc/config/m68k/uclinux.h +++ b/gcc/config/m68k/uclinux.h @@ -55,6 +55,8 @@ Boston, MA 02111-1307, USA. */ builtin_define_std ("linux"); \ builtin_define_std ("unix"); \ builtin_define ("__gnu_linux__"); \ + builtin_assert ("system=linux"); \ + builtin_assert ("system=unix"); \ builtin_assert ("system=posix"); \ if (TARGET_ID_SHARED_LIBRARY) \ builtin_define ("__ID_SHARED_LIBRARY__"); \ diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h index 48c5e3c908d..ae64020882e 100644 --- a/gcc/config/mips/linux.h +++ b/gcc/config/mips/linux.h @@ -55,12 +55,9 @@ Boston, MA 02111-1307, USA. */ #define TARGET_OS_CPP_BUILTINS() \ do { \ - builtin_define ("__gnu_linux__"); \ + LINUX_TARGET_OS_CPP_BUILTINS(); \ builtin_define ("__PIC__"); \ builtin_define ("__pic__"); \ - builtin_define_std ("unix"); \ - builtin_define_std ("linux"); \ - builtin_assert ("system=linux"); \ /* The GNU C++ standard library requires this. */ \ if (c_dialect_cxx ()) \ builtin_define ("_GNU_SOURCE"); \ diff --git a/gcc/config/mn10300/linux.h b/gcc/config/mn10300/linux.h index 59358df4386..0130498ce5a 100644 --- a/gcc/config/mn10300/linux.h +++ b/gcc/config/mn10300/linux.h @@ -23,16 +23,7 @@ #undef PREFERRED_DEBUGGING_TYPE #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_define_std ("unix"); \ - builtin_define_std ("linux"); \ - builtin_define ("__gnu_linux__"); \ - builtin_assert ("system=unix"); \ - builtin_assert ("system=posix"); \ - } \ - while (0) +#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() #undef CPP_SPEC #define CPP_SPEC "%{mam33:-D__AM33__} %{!mam33:-D__AM33__=2 -D__AM33_2__} \ diff --git a/gcc/config/pa/pa-linux.h b/gcc/config/pa/pa-linux.h index 2a714e3ebdf..c3808f1c34f 100644 --- a/gcc/config/pa/pa-linux.h +++ b/gcc/config/pa/pa-linux.h @@ -56,12 +56,8 @@ Boston, MA 02111-1307, USA. */ #define TARGET_OS_CPP_BUILTINS() \ do \ { \ - builtin_define ("__gnu_linux__"); \ - builtin_define_std ("linux"); \ - builtin_define_std ("unix"); \ + LINUX_TARGET_OS_CPP_BUILTINS(); \ builtin_assert ("machine=bigendian"); \ - builtin_assert ("system=posix"); \ - builtin_assert ("system=unix"); \ } \ while (0) diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 2c82b057e43..a49a1ca6516 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -1124,7 +1124,7 @@ extern int fixuplabelno; %{!ansi: \ %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \ %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \ --Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}" +-Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}" /* GNU/Hurd support. */ #define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \ diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h index e7e3b2ed995..9a6db9d76c1 100644 --- a/gcc/config/s390/linux.h +++ b/gcc/config/s390/linux.h @@ -53,11 +53,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define TARGET_OS_CPP_BUILTINS() \ do \ { \ - builtin_define_std ("linux"); \ - builtin_define_std ("unix"); \ - builtin_assert ("system=linux"); \ - builtin_assert ("system=unix"); \ - builtin_define ("__gnu_linux__"); \ + LINUX_TARGET_OS_CPP_BUILTINS(); \ if (flag_pic) \ { \ builtin_define ("__PIC__"); \ diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h index da423516b16..d28e0c24680 100644 --- a/gcc/config/sh/linux.h +++ b/gcc/config/sh/linux.h @@ -57,6 +57,8 @@ do { \ builtin_define_std ("unix"); \ builtin_define ("__gnu_linux__"); \ builtin_define_std ("linux"); \ + builtin_assert ("system=linux"); \ + builtin_assert ("system=unix"); \ builtin_assert ("system=posix"); \ } while (0) diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h index ac1cc12ad3b..8af7c5a0259 100644 --- a/gcc/config/sparc/linux.h +++ b/gcc/config/sparc/linux.h @@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA. */ builtin_define_std ("unix"); \ builtin_define_std ("linux"); \ builtin_define ("__gnu_linux__"); \ + builtin_assert ("system=linux"); \ builtin_assert ("system=unix"); \ builtin_assert ("system=posix"); \ } \ diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h index c7c45dcdd98..fb9f5a73709 100644 --- a/gcc/config/sparc/linux64.h +++ b/gcc/config/sparc/linux64.h @@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA. */ builtin_define_std ("linux"); \ builtin_define ("_LONGLONG"); \ builtin_define ("__gnu_linux__"); \ + builtin_assert ("system=linux"); \ builtin_assert ("system=unix"); \ builtin_assert ("system=posix"); \ } \ diff --git a/gcc/config/xtensa/linux.h b/gcc/config/xtensa/linux.h index ef5aae04f63..0b3b077eca9 100644 --- a/gcc/config/xtensa/linux.h +++ b/gcc/config/xtensa/linux.h @@ -19,13 +19,7 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define TARGET_OS_CPP_BUILTINS() \ - do { \ - builtin_define_std ("linux"); \ - builtin_define_std ("unix"); \ - builtin_define ("__gnu_linux__"); \ - builtin_assert ("system=posix"); \ - } while (0) +#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS() #undef SUBTARGET_CPP_SPEC #define SUBTARGET_CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cbac84803d4..77938bd6a35 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-11-28 Kaveh R. Ghazi + + * testsuite/gcc.dg/cpp/assert4.c: Update. + 2003-11-28 Eric Botcazou * gcc.dg/builtin-apply2.c: Set size of stack argument data to 64. diff --git a/gcc/testsuite/gcc.dg/cpp/assert4.c b/gcc/testsuite/gcc.dg/cpp/assert4.c index 557d1c0ec28..1b09ab1beac 100644 --- a/gcc/testsuite/gcc.dg/cpp/assert4.c +++ b/gcc/testsuite/gcc.dg/cpp/assert4.c @@ -15,7 +15,7 @@ #endif #if defined __gnu_hurd__ -# if !#system(gnu) || !#system(unix) || !#system(posix) +# if !#system(gnu) || !#system(unix) || !#system(posix) || !#system(mach) # error # endif #elif #system(gnu) @@ -128,6 +128,14 @@ # error #endif +#if defined __cris__ +# if !#cpu(cris) || !#machine(cris) +# error +# endif +#elif #cpu(cris) || #machine(cris) +# error +#endif + #if defined __d30v__ # if !#cpu(d30v) || !#machine(d30v) # error