From f60ed6be98bde80360b8a61e40ca3d5774f0ea49 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sat, 29 Jun 2002 09:10:04 +0000 Subject: [PATCH] crtdll.h: Define EXTRA_OS_CPP_BUILTINS. * config/i386/crtdll.h: Define EXTRA_OS_CPP_BUILTINS. Don't use CPP_PREDEFINES. * config/i386/cygwin.h (EXTRA_OS_CPP_BUILTINS): New. Used TARGET_OS_CPP_BUILTINS in preference to CPP_PREDEFINES. * config/i386/djgpp.h, config/i386/i386-coff.h, config/i386/i386-interix.h, config/i386/i386-interix3.h, config/i386/lynx-ng.h, config/i386/lynx.h, config/i386/mingw32.h, config/i386/openbsd.h, config/i386/ptx4-i.h, config/i386/sysv3.h, config/i386/uwin.h: Similarly. From-SVN: r55101 --- gcc/ChangeLog | 12 +++++++++ gcc/config/i386/crtdll.h | 7 +++-- gcc/config/i386/cygwin.h | 25 ++++++++++++------ gcc/config/i386/djgpp.h | 11 +++++--- gcc/config/i386/i386-coff.h | 7 ++--- gcc/config/i386/i386-interix.h | 43 ++++++++++++++++++------------- gcc/config/i386/i386-interix3.h | 9 +------ gcc/config/i386/lynx-ng.h | 14 +++++++--- gcc/config/i386/lynx.h | 12 +++++++-- gcc/config/i386/mingw32.h | 45 ++++++++++++++++++++++----------- gcc/config/i386/openbsd.h | 13 +++++++--- gcc/config/i386/ptx4-i.h | 14 ++++++---- gcc/config/i386/sysv3.h | 8 +++++- gcc/config/i386/uwin.h | 23 +++++++++-------- 14 files changed, 158 insertions(+), 85 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 01539f5b647..d2775fd9751 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2002-06-29 Neil Booth + + * config/i386/crtdll.h: Define EXTRA_OS_CPP_BUILTINS. + Don't use CPP_PREDEFINES. + * config/i386/cygwin.h (EXTRA_OS_CPP_BUILTINS): New. + Used TARGET_OS_CPP_BUILTINS in preference to CPP_PREDEFINES. + * config/i386/djgpp.h, config/i386/i386-coff.h, + config/i386/i386-interix.h, config/i386/i386-interix3.h, + config/i386/lynx-ng.h, config/i386/lynx.h, config/i386/mingw32.h, + config/i386/openbsd.h, config/i386/ptx4-i.h, config/i386/sysv3.h, + config/i386/uwin.h: Similarly. + 2002-06-29 Herman A.J. ten Brugge * c4x.h: (TARGET_CPU_CPP_BUILTINS): Check flag_inline_functions and diff --git a/gcc/config/i386/crtdll.h b/gcc/config/i386/crtdll.h index f3eae8471a7..dab60c19ca2 100644 --- a/gcc/config/i386/crtdll.h +++ b/gcc/config/i386/crtdll.h @@ -20,10 +20,9 @@ along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D_WIN32 -DWIN32 \ - -D__MINGW32__=0.2 -DWINNT -D_X86_=1 \ - -Asystem=winnt" +#undef EXTRA_OS_CPP_BUILTINS +#define EXTRA_OS_CPP_BUILTINS() \ + do { builtin_define ("__MINGW32__=0.2"); } while (0) #undef LIBGCC_SPEC #define LIBGCC_SPEC \ diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index 15a5cdbb925..e849c9b800d 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -54,8 +54,23 @@ Boston, MA 02111-1307, USA. */ { "no-nop-fun-dllimport", -MASK_NOP_FUN_DLLIMPORT, "" }, \ { "threads", 0, N_("Use Mingw-specific thread support") }, -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D_X86_=1 -Asystem=winnt" +#define MAYBE_UWIN_CPP_BUILTINS() /* Nothing. */ +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("_X86_=1"); \ + builtin_assert ("system=winnt"); \ + builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ + builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ + builtin_define ("__declspec(x)=__attribute__((x))"); \ + if (!flag_iso) \ + { \ + builtin_define ("_stdcall=__attribute__((__stdcall__))"); \ + builtin_define ("_cdecl=__attribute__((__cdecl__))"); \ + } \ + MAYBE_UWIN_CPP_BUILTINS (); \ + } \ + while (0) #ifdef CROSS_COMPILE #define CYGWIN_INCLUDES "%{!nostdinc:-idirafter " CYGWIN_CROSS_DIR "/include}" @@ -97,12 +112,6 @@ Boston, MA 02111-1307, USA. */ #undef CPP_SPEC #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} \ - -D__stdcall=__attribute__((__stdcall__)) \ - -D__cdecl=__attribute__((__cdecl__)) \ - %{!ansi:-D_stdcall=__attribute__((__stdcall__)) \ - -D_cdecl=__attribute__((__cdecl__))} \ - -D__declspec(x)=__attribute__((x)) \ - -D__i386__ -D__i386 \ %{mno-win32:%{mno-cygwin: %emno-cygwin and mno-win32 are not compatible}} \ %{mno-cygwin:-D__MSVCRT__ -D__MINGW32__ %{mthreads:-D_MT} "\ MINGW_INCLUDES "} \ diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h index 15c1531a9c8..3afafd0ae3c 100644 --- a/gcc/config/i386/djgpp.h +++ b/gcc/config/i386/djgpp.h @@ -82,13 +82,18 @@ Boston, MA 02111-1307, USA. */ (((NAME)[0] == '/') || ((NAME)[0] == '\\') || \ (((NAME)[0] >= 'A') && ((NAME)[0] <= 'z') && ((NAME)[1] == ':'))) -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__MSDOS__ -D__GO32__ -Asystem=msdos" +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("MSDOS"); \ + builtin_define_std ("GO32"); \ + builtin_assert ("system=msdos"); \ + } \ + while (0) /* Include so __DJGPP__ and __DJGPP_MINOR__ are defined. */ #undef CPP_SPEC #define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE} \ - %{!ansi:%{!std=c*:%{!std=i*:-DMSDOS}}} %{!ansi:%{!std=c*:%{!std=i*:-DGO32}}} \ -imacros %s../include/sys/version.h" /* We need to override link_command_spec in gcc.c so support -Tdjgpp.djl. diff --git a/gcc/config/i386/i386-coff.h b/gcc/config/i386/i386-coff.h index 5f3ed142866..d4d155323e5 100644 --- a/gcc/config/i386/i386-coff.h +++ b/gcc/config/i386/i386-coff.h @@ -21,12 +21,9 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define TARGET_VERSION fprintf (stderr, " (80386, COFF BSD syntax)"); +#define TARGET_VERSION fprintf (stderr, " (80386, COFF BSD syntax)"); -/* Specify predefined symbols in preprocessor. */ - -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "" +#define TARGET_OS_CPP_BUILTINS() /* Sweet FA. */ /* We want to be able to get DBX debugging information via -gstabs. */ diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h index 101f812c362..6d74150d704 100644 --- a/gcc/config/i386/i386-interix.h +++ b/gcc/config/i386/i386-interix.h @@ -53,30 +53,37 @@ Boston, MA 02111-1307, USA. */ #define ASM_LOAD_ADDR(loc, reg) " leal " #loc "," #reg "\n" /* cpp handles __STDC__ */ -#undef CPP_PREDEFINES -#define CPP_PREDEFINES " \ - -D__INTERIX \ - -D__OPENNT \ - -D_M_IX86=300 -D_X86_=1 \ - -D__stdcall=__attribute__((__stdcall__)) \ - -D__cdecl=__attribute__((__cdecl__)) \ - -D__declspec(x)=__attribute__((x)) \ - -Asystem=unix -Asystem=interix" +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__INTERIX"); \ + builtin_define ("__OPENNT"); \ + builtin_define ("_M_IX86=300"); \ + builtin_define ("_X86_=1"); \ + builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ + builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ + builtin_define ("__declspec(x)=__attribute__((x))"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=interix"); \ + if (preprocessing_asm_p ()) \ + builtin_define_std ("LANGUAGE_ASSEMBLY"); \ + else \ + { \ + builtin_define_std ("LANGUAGE_C"); \ + if (c_language == clk_cplusplus) \ + builtin_define_std ("LANGUAGE_C_PLUS_PLUS"); \ + else if (c_language == clk_objective_c) \ + builtin_define_std ("LANGUAGE_OBJECTIVE_C"); \ + } \ + } \ + while (0) #undef CPP_SPEC /* Write out the correct language type definition for the header files. Unless we have assembler language, write out the symbols for C. mieee is an Alpha specific variant. Cross polination a bad idea. */ -#define CPP_SPEC "\ -%{!.S: -D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}} \ -%{.S: -D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ -%{.cc: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ -%{.cxx: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ -%{.C: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ -%{.m: -D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C} \ --remap \ -%{posix:-D_POSIX_SOURCE} \ +#define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE} \ -isystem %$INTERIX_ROOT/usr/include" #define TARGET_VERSION fprintf (stderr, " (i386 Interix)"); diff --git a/gcc/config/i386/i386-interix3.h b/gcc/config/i386/i386-interix3.h index 38c6c55290f..aafe57fa24d 100644 --- a/gcc/config/i386/i386-interix3.h +++ b/gcc/config/i386/i386-interix3.h @@ -20,12 +20,5 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #undef CPP_SPEC -#define CPP_SPEC "\ -%{!.S: -D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}} \ -%{.S: -D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \ -%{.cc: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ -%{.cxx: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ -%{.C: -D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus} \ -%{.m: -D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C} \ -%{posix:-D_POSIX_SOURCE}" +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}" diff --git a/gcc/config/i386/lynx-ng.h b/gcc/config/i386/lynx-ng.h index 1ef22fb23dc..08fa60f430c 100644 --- a/gcc/config/i386/lynx-ng.h +++ b/gcc/config/i386/lynx-ng.h @@ -20,9 +20,17 @@ Boston, MA 02111-1307, USA. */ #define TARGET_VERSION fprintf (stderr, " (80386, LYNX BSD syntax)"); -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-Dunix -DI386 -DLynx -DIBITS32 \ - -Asystem=unix -Asystem=lynx" +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("unix"); \ + builtin_define_std ("I386"); \ + builtin_define_std ("Lynx"); \ + builtin_define_std ("IBITS32"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=lynx"); \ + } \ + while (0) /* Provide required defaults for linker switches. */ diff --git a/gcc/config/i386/lynx.h b/gcc/config/i386/lynx.h index 00fc0ac7417..7835f2713f2 100644 --- a/gcc/config/i386/lynx.h +++ b/gcc/config/i386/lynx.h @@ -20,8 +20,16 @@ Boston, MA 02111-1307, USA. */ #define TARGET_VERSION fprintf (stderr, " (80386, LYNX BSD syntax)"); -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-DI386 -DLynx -DIBITS32 -Asystem=unix -Asystem=lynx" +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("I386"); \ + builtin_define_std ("Lynx"); \ + builtin_define_std ("IBITS32"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=lynx"); \ + } \ + while (0) /* The prefix to add to user-visible assembler symbols. */ diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h index c5b8701f898..6b367eba314 100644 --- a/gcc/config/i386/mingw32.h +++ b/gcc/config/i386/mingw32.h @@ -32,13 +32,35 @@ Boston, MA 02111-1307, USA. */ #define TARGET_EXECUTABLE_SUFFIX ".exe" -/* Please keep changes to CPP_PREDEFINES in sync with i386/crtdll. The - only difference between the two should be __MSVCRT__ needed to - distinguish MSVC from CRTDLL runtime in mingw headers. */ -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D_WIN32 -D__WIN32 -D__WIN32__ -DWIN32 \ - -D__MINGW32__ -D__MSVCRT__ -DWINNT -D_X86_=1 \ - -Asystem=winnt" +/* See i386/crtdll.h for an altervative definition. */ +#define EXTRA_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__MSVCRT__"); \ + builtin_define ("__MINGW32__"); \ + } \ + while (0) + +#undef TARGET_OS_CPP_BUILTINS /* From cygwin.h. */ +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("_WIN32"); \ + builtin_define_std ("WIN32"); \ + builtin_define_std ("WINNT"); \ + builtin_define ("_X86_=1"); \ + builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ + builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ + builtin_define ("__declspec(x)=__attribute__((x))"); \ + if (!flag_iso) \ + { \ + builtin_define ("_stdcall=__attribute__((__stdcall__))"); \ + builtin_define ("_cdecl=__attribute__((__cdecl__))"); \ + } \ + EXTRA_OS_CPP_BUILTINS (); \ + builtin_assert ("system=winnt"); \ + } \ + while (0) /* Specific a different directory for the standard include files. */ #undef STANDARD_INCLUDE_DIR @@ -47,14 +69,7 @@ Boston, MA 02111-1307, USA. */ #define STANDARD_INCLUDE_COMPONENT "MINGW" #undef CPP_SPEC -#define CPP_SPEC \ - "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} \ - -D__stdcall=__attribute__((__stdcall__)) \ - -D__cdecl=__attribute__((__cdecl__)) \ - %{!ansi:-D_stdcall=__attribute__((__stdcall__)) \ - -D_cdecl=__attribute__((__cdecl__))} \ - -D__declspec(x)=__attribute__((x))" - +#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}" /* For Windows applications, include more libraries, but always include kernel32. */ diff --git a/gcc/config/i386/openbsd.h b/gcc/config/i386/openbsd.h index 9b7ce3e4f00..8f54026539b 100644 --- a/gcc/config/i386/openbsd.h +++ b/gcc/config/i386/openbsd.h @@ -26,9 +26,16 @@ Boston, MA 02111-1307, USA. */ #define TARGET_SUBTARGET_DEFAULT \ (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387) -/* Run-time target specifications */ -#define CPP_PREDEFINES "-D__unix__ -D__OpenBSD__ \ - -Asystem=unix -Asystem=bsd -Asystem=OpenBSD" +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__unix__"); \ + builtin_define ("__OpenBSD__"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=bsd"); \ + builtin_assert ("system=OpenBSD"); \ + } \ + while (0) /* Layout of source language data types. */ diff --git a/gcc/config/i386/ptx4-i.h b/gcc/config/i386/ptx4-i.h index d29bdade144..a7d57106762 100644 --- a/gcc/config/i386/ptx4-i.h +++ b/gcc/config/i386/ptx4-i.h @@ -33,11 +33,15 @@ Boston, MA 02111-1307, USA. */ (TYPE_MODE (TYPE) == BLKmode \ || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8)) -/* Define which macros to predefine. _SEQUENT_ is our extension. */ -/* This used to define X86, but james@bigtex.cactus.org says that - is supposed to be defined optionally by user programs--not by default. */ -#define CPP_PREDEFINES \ - "-Dunix -D_SEQUENT_ -Asystem=unix -Asystem=ptx4" +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("unix"); \ + builtin_define ("_SEQUENT_"); \ + builtin_assert ("system=unix"); \ + builtin_assert ("system=ptx4"); \ + } \ + while (0) #undef DBX_REGISTER_NUMBER #define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n] diff --git a/gcc/config/i386/sysv3.h b/gcc/config/i386/sysv3.h index 07dadb818ed..67194f4acc5 100644 --- a/gcc/config/i386/sysv3.h +++ b/gcc/config/i386/sysv3.h @@ -32,7 +32,13 @@ Boston, MA 02111-1307, USA. */ /* Specify predefined symbols in preprocessor. */ -#define CPP_PREDEFINES "-Dunix -Asystem=svr3" +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("unix"); \ + builtin_assert ("system=svr3"); \ + } \ + while (0) #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}" diff --git a/gcc/config/i386/uwin.h b/gcc/config/i386/uwin.h index b5865ac9787..121051064e4 100644 --- a/gcc/config/i386/uwin.h +++ b/gcc/config/i386/uwin.h @@ -30,16 +30,19 @@ Boston, MA 02111-1307, USA. */ #undef MD_STARTFILE_PREFIX #define MD_STARTFILE_PREFIX "/usr/gnu/lib/" -#undef CPP_PREDEFINES -#define CPP_PREDEFINES "-D_WIN32 -D__WIN32__ \ - -D_UWIN -DWINNT -D_X86_=1 -D__STDC__=1 \ - -D__UWIN__ -D__MSVCRT__ \ - -D_STD_INCLUDE_DIR=mingw32 \ - -D__stdcall=__attribute__((__stdcall__)) \ - _D_stdcall=__attribute__((__stdcall__)) \ - -D__cdecl=__attribute__((__cdecl__)) \ - -D__declspec(x)=__attribute__((x)) \ - -Asystem=winnt" +#undef MAYBE_UWIN_CPP_BUILTINS +#define MAYBE_UWIN_CPP_BUILTINS() \ + do \ + { \ + builtin_define_std ("WINNT"); \ + builtin_define ("_WIN32"); \ + builtin_define ("__WIN32__"); \ + builtin_define ("_UWIN"); \ + builtin_define ("__UWIN__"); \ + builtin_define ("__MSVCRT__"); \ + builtin_define ("_STD_INCLUDE_DIR=mingw32"); \ + } \ + while (0) #undef CPP_SPEC #define CPP_SPEC "-remap %{posix:-D_POSIX_SOURCE} \