From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23723 invoked by alias); 3 Nov 2010 21:27:21 -0000 Received: (qmail 23691 invoked by uid 22791); 3 Nov 2010 21:27:09 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_20,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,FSL_RU_URL,RCVD_IN_DNSWL_NONE,TW_CP,TW_CX X-Spam-Check-By: sourceware.org Received: from mail-ww0-f41.google.com (HELO mail-ww0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Nov 2010 21:26:55 +0000 Received: by wwb13 with SMTP id 13so1611692wwb.2 for ; Wed, 03 Nov 2010 14:26:52 -0700 (PDT) Received: by 10.216.22.70 with SMTP id s48mr1061981wes.27.1288819612211; Wed, 03 Nov 2010 14:26:52 -0700 (PDT) Received: from [192.168.0.101] (chufi.coudert.name [88.162.139.106]) by mx.google.com with ESMTPS id p4sm5925674wer.29.2010.11.03.14.26.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 03 Nov 2010 14:26:50 -0700 (PDT) From: FX Content-Type: multipart/mixed; boundary=Apple-Mail-33--872722161 Subject: [patch] Separate {OS,CPU}_CPP_BUILTINS macros into C-family and language-independent macros Date: Wed, 03 Nov 2010 21:29:00 -0000 Message-Id: <1D974441-C894-4F24-A0D1-7B693044B2BF@gmail.com> Cc: Michael Meissner , Rainer Orth , chertykov@gmail.com, aesok@post.ru, eric.weddington@atmel.com To: gcc-patches@gcc.gnu.org, gfortran List Mime-Version: 1.0 (Apple Message framework v1081) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-11/txt/msg00357.txt.bz2 --Apple-Mail-33--872722161 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Content-length: 2804 See below for the description of the patch; this take n+1 incorporates sugg= estions by Michael Meissner and Rainer Orth, with the following exceptions: -- As avr.c includes new headers (cpplib.h and cppbuiltin.h), I wanted to= update its dependencies in the target configuration file (t-avr), but to m= y surprise, this file doesn't contain any mention of avr.o. In fact, I fail= ed to find any by grepping the whole tree, so I'm a little unsure how this = can work (and apparently it does). Could the maintainers help me here? -- Michael is worried about splitting all this stuff: >> Unless I don't see what you're talking about, this is not possible: the = Fortran front-end is not linked with the *-c.c files, only with *.c, so the= language-independent functions need to be moved there. >=20 > Yes, but if fortran is going to use the preprocessor, maybe they should be > linked in. I'm just worried about the possibility of a macro getting los= t in > the movement. Well, we do need some separation between CPP built-in macros that are only = relevant for C-family languages (for example, because they depend on flag v= ariables that are only declared for C) and the others. Now that the job is = done, was discussed beforehand, and it fixes the regression experienced by = Fortran, I'd be glad to just have it work. Tested as indicated below, OK to commit? (needs a global reviewer; pretty p= retty please, don't let it bitrot again) I'd like to highlight that it's n= othing conceptualy major, and it'll be easy to fix any eventual fallout. FX ------------------ The attached patch fixes PR 42954: when Fortran moved to using libcpp direc= tly from the front-end (instead of calling cc1 to do its preprocessing), we= lost all target-specific CPP built-in macros. The issue is that part of th= e code in TARGET_OS_CPP_BUILTINS and TARGET_CPU_CPP_BUILTINS depends on C-o= nly flags, and thus cannot be moved to a directory outside gcc/c-family/. The patch moves this C-only code to specific TARGET_OS_CPP_BUILTINS_CFAMILY= and TARGET_CPU_CPP_BUILTINS_CFAMILY macros. I manually audited all the tar= gets in config/ twice, to check that I did not leave any code behind. I hav= e bootstrapped and regtested an all-language compiler on x86_64-linux and i= 686-darwin. I have also built C and Fortran cross-compilers (make all-gcc &= & make fortran) for the following targets (which cover all gcc/config/ file= s changed): avr-elf frv-elf spu-elf i386-pc-netware alpha-linux alpha-dec-osf5.1 ia64-hpux mips-linux mips-sgi-irix6.5 hppa2.0w-hp-hpux11.00 sparc-sun-solaris2.10 i686-pc-mingw32 powerpc-darwin In all cases, the cross-compiler built successfully and seemed to work. In = each case, I checked a few of the target-specific macros (but did not check= all of them). --Apple-Mail-33--872722161 Content-Disposition: attachment; filename=cpp-2.ChangeLog Content-Type: application/octet-stream; name="cpp-2.ChangeLog" Content-Transfer-Encoding: 7bit Content-length: 3850 2010-10-07 Francois-Xavier Coudert PR fortran/42954 * cppbuiltin.c (define_target_specific_builtins, define_builtin_macro_std): New functions. (define_language_independent_builtin_macros): Call define_target_specific_builtins. * cppbuiltin.h (define_builtin_macro_std): New prototype. (define_language_independent_builtin_macros): Adjust prototype. * config.gcc (avr-*-*): Don't build avr-c.o. * config/alpha/linux.h: Split code between TARGET_OS_CPP_BUILTINS and TARGET_OS_CPP_BUILTINS_CFAMILY. * config/alpha/alpha.h: Likewise. * config/alpha/osf5.h: Likewise. * config/alpha/netbsd.h: Rename SUBTARGET_LANGUAGE_CPP_BUILTINS into TARGET_CPU_CPP_BUILTINS_CFAMILY. * config/frv/frv.h: Split code between TARGET_OS_CPP_BUILTINS and TARGET_OS_CPP_BUILTINS_CFAMILY. * config/spu/spu-protos.h (spu_cpu_cpp_builtins_cfamily): New prototype. * config/spu/spu-c.c (spu_cpu_cpp_builtins_cfamily): Move language-independent code to spu-c.c. * config/spu/spu.c (spu_cpu_cpp_builtins): Move from spu-c.c. * config/spu/spu.h: Call spu_cpu_cpp_builtins_cfamily. * config/sol2.h: Split code between TARGET_OS_CPP_BUILTINS and TARGET_OS_CPP_BUILTINS_CFAMILY. * config/pa/pa-hpux.h: Likewise * config/pa/pa-hpux10.h: Likewise * config/pa/pa-hpux11.h: Likewise * config/pa/pa.h: Likewise * config/mips/linux.h: Likewise. * config/mips/iris6.h: Likewise. * config/mips/mips.h: Likewise. * config/ia64/hpux.h: Likewise. * config/i386/netware.h: Split code between TARGET_OS_CPP_BUILTINS and TARGET_OS_CPP_BUILTINS_CFAMILY. * config/i386/i386-interix.h: Likewise. * config/i386/cygming.h: Split code between TARGET_OS_CPP_BUILTINS and TARGET_OS_CPP_BUILTINS_CFAMILY. Use the new EXTRA_OS_CPP_BUILTINS_CFAMILY. * config/i386/cygwin.h: Define empty EXTRA_OS_CPP_BUILTINS_CFAMILY. * config/i386/i386.h (TARGET_CPU_CPP_BUILTINS): Pass extra argument to ix86_target_macros. * config/i386/i386-c.c: Move ix86_target_macros_internal and ix86_target_macros from i386.c. * config/i386/mingw32.h: Split code between EXTRA_OS_CPP_BUILTINS and EXTRA_OS_CPP_BUILTINS_CFAMILY. * config/i386/i386-protos.h: Move ix86_target_macros. * config/i386/i386.c: Move ix86_target_macros_internal and ix86_target_macros from i386-c.c. * config/darwin-c.c (version_as_macro, darwin_cpp_builtins): Move to darwin.c. * config/darwin.c (version_as_macro, darwin_cpp_builtins): Move from darwin-c.c. * config/darwin.h: Adjust comment. * config/avr/avr-protos.h (avr_cpu_cpp_builtins): Adjust prototype. * config/avr/avr.c (avr_cpu_cpp_builtins): Move from avr-c.c. * config/avr/t-avr: Remove avr-c.o rule. * config/avr/avr-c.c: Remove file. * config/avr/avr.h (TARGET_CPU_CPP_BUILTINS): Pass extra argument to avr_cpu_cpp_builtins. * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins_cfamily): New functions. * config/rs6000/rs6000.c (rs6000_cpu_cpp_builtins): Move from rs6000.c. * config/rs6000/rs6000.h (TARGET_CPU_CPP_BUILTINS_CFAMILY): New macro. * doc/tm.texi.in: Adjust documentation of TARGET_CPU_CPP_BUILTINS. Document TARGET_CPU_CPP_BUILTINS_CFAMILY and TARGET_OS_CPP_BUILTINS_CFAMILY. * doc/tm.texi: Regenerate. gcc/c-family/ 2010-10-07 Francois-Xavier Coudert PR fortran/42954 * c-common.h (builtin_define_std): Remove prototype. * c-cppbuiltin.c (builtin_define_std): Remove function. (c_cpp_builtins): Don't call TARGET_CPU_CPP_BUILTINS, TARGET_OS_CPP_BUILTINS and TARGET_OBJFMT_CPP_BUILTINS. Call TARGET_OS_CPP_BUILTINS_CFAMILY and TARGET_CPU_CPP_BUILTINS_CFAMILY. gcc/fortran/ 2010-10-07 Francois-Xavier Coudert PR fortran/42954 * cpp.c (cpp_define_builtins): Call define_target_specific_builtins instead of TARGET_CPU_CPP_BUILTINS, TARGET_OS_CPP_BUILTINS and TARGET_OBJFMT_CPP_BUILTINS. --Apple-Mail-33--872722161 Content-Disposition: attachment; filename=cpp-2.diff.txt Content-Type: text/plain; name="cpp-2.diff.txt" Content-Transfer-Encoding: quoted-printable Content-length: 87902 Index: gcc/c-family/c-common.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/c-family/c-common.h (revision 166272) +++ gcc/c-family/c-common.h (working copy) @@ -964,7 +964,6 @@ extern void c_common_print_pch_checksum=20 extern const unsigned char executable_checksum[16]; =20 /* In c-cppbuiltin.c */ -extern void builtin_define_std (const char *macro); extern void builtin_define_with_value (const char *, const char *, int); extern void c_stddef_cpp_builtins (void); extern void fe_file_change (const struct line_map *); Index: gcc/c-family/c-cppbuiltin.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/c-family/c-cppbuiltin.c (revision 166272) +++ gcc/c-family/c-cppbuiltin.c (working copy) @@ -35,12 +35,12 @@ along with GCC; see the file COPYING3.=20=20 #include "cpp-id-data.h" #include "cppbuiltin.h" =20 -#ifndef TARGET_OS_CPP_BUILTINS -# define TARGET_OS_CPP_BUILTINS() +#ifndef TARGET_OS_CPP_BUILTINS_CFAMILY +# define TARGET_OS_CPP_BUILTINS_CFAMILY() #endif =20 -#ifndef TARGET_OBJFMT_CPP_BUILTINS -# define TARGET_OBJFMT_CPP_BUILTINS() +#ifndef TARGET_CPU_CPP_BUILTINS_CFAMILY +# define TARGET_CPU_CPP_BUILTINS_CFAMILY() #endif =20 #ifndef REGISTER_PREFIX @@ -48,7 +48,6 @@ along with GCC; see the file COPYING3.=20=20 #endif =20 /* Non-static as some targets don't use it. */ -void builtin_define_std (const char *) ATTRIBUTE_UNUSED; static void builtin_define_with_int_value (const char *, HOST_WIDE_INT); static void builtin_define_with_hex_fp_value (const char *, tree, int, const char *, @@ -576,7 +575,8 @@ c_cpp_builtins (cpp_reader *pfile) if (flag_undef) return; =20 - define_language_independent_builtin_macros (pfile); + /* Language-independent builtins. */ + define_language_independent_builtin_macros (pfile, flag_iso); =20 if (c_dialect_cxx ()) { @@ -813,9 +813,11 @@ c_cpp_builtins (cpp_reader *pfile) # define preprocessing_trad_p() (cpp_get_options (pfile)->traditional) # define builtin_define(TXT) cpp_define (pfile, TXT) # define builtin_assert(TXT) cpp_assert (pfile, TXT) - TARGET_CPU_CPP_BUILTINS (); - TARGET_OS_CPP_BUILTINS (); - TARGET_OBJFMT_CPP_BUILTINS (); +# define builtin_define_std(TXT) \ + define_builtin_macro_std (pfile, TXT, flag_iso) + + TARGET_OS_CPP_BUILTINS_CFAMILY (); + TARGET_CPU_CPP_BUILTINS_CFAMILY (); =20 /* Support the __declspec keyword by turning them into attributes. Note that the current way we do this may result in a collision @@ -833,50 +835,6 @@ c_cpp_builtins (cpp_reader *pfile) cpp_define (pfile, "__DECIMAL_BID_FORMAT__"); } =20 -/* Pass an object-like macro. If it doesn't lie in the user's - namespace, defines it unconditionally. Otherwise define a version - with two leading underscores, and another version with two leading - and trailing underscores, and define the original only if an ISO - standard was not nominated. - - e.g. passing "unix" defines "__unix", "__unix__" and possibly - "unix". Passing "_mips" defines "__mips", "__mips__" and possibly - "_mips". */ -void -builtin_define_std (const char *macro) -{ - size_t len =3D strlen (macro); - char *buff =3D (char *) alloca (len + 5); - char *p =3D buff + 2; - char *q =3D p + len; - - /* prepend __ (or maybe just _) if in user's namespace. */ - memcpy (p, macro, len + 1); - if (!( *p =3D=3D '_' && (p[1] =3D=3D '_' || ISUPPER (p[1])))) - { - if (*p !=3D '_') - *--p =3D '_'; - if (p[1] !=3D '_') - *--p =3D '_'; - } - cpp_define (parse_in, p); - - /* If it was in user's namespace... */ - if (p !=3D buff + 2) - { - /* Define the macro with leading and following __. */ - if (q[-1] !=3D '_') - *q++ =3D '_'; - if (q[-2] !=3D '_') - *q++ =3D '_'; - *q =3D '\0'; - cpp_define (parse_in, p); - - /* Finally, define the original macro if permitted. */ - if (!flag_iso) - cpp_define (parse_in, macro); - } -} =20 /* Pass an object-like macro and a value to define it to. The third parameter says whether or not to turn the value into a string Index: gcc/cppbuiltin.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/cppbuiltin.c (revision 166272) +++ gcc/cppbuiltin.c (working copy) @@ -27,6 +27,9 @@ along with GCC; see the file COPYING3.=20=20 #include "flags.h" #include "toplev.h" #include "cpp-id-data.h" +#include "output.h" +#include "tm_p.h" /* For TARGET_CPU_CPP_BUILTINS & friends. */ +#include "target.h" #include "cppbuiltin.h" =20 =20 @@ -163,13 +166,99 @@ define_builtin_macros_for_type_sizes (cp } =20 =20 +/* Define target-specific built-in CPP macros. */ +static void +define_target_specific_builtins (cpp_reader *pfile, bool iso_c) +{ + +#ifndef TARGET_OBJFMT_CPP_BUILTINS +# define TARGET_OBJFMT_CPP_BUILTINS() +#endif + +#ifndef TARGET_CPU_CPP_BUILTINS +# define TARGET_CPU_CPP_BUILTINS() +#endif + +#ifndef TARGET_OS_CPP_BUILTINS +# define TARGET_OS_CPP_BUILTINS() +#endif + +#define builtin_define(TXT) cpp_define (pfile, TXT) +#define builtin_assert(TXT) cpp_assert (pfile, TXT) +#define builtin_define_with_value(NAME, VALUE, IS_STR) \ + cpp_define_formatted (pfile, IS_STR ? NAME"=3D%s" : NAME"=3D\"%s\"", VAL= UE) +#define builtin_define_with_int_value(NAME, VALUE) \ + cpp_define_formatted (pfile, NAME"=3D"HOST_WIDE_INT_PRINT_DEC, VALUE) +#define builtin_define_std(TXT) \ + define_builtin_macro_std (pfile, TXT, iso_c) + + TARGET_OBJFMT_CPP_BUILTINS (); + TARGET_CPU_CPP_BUILTINS (); + TARGET_OS_CPP_BUILTINS (); + +#undef builtin_define +#undef builtin_assert +#undef builtin_define_with_value +#undef builtin_define_with_int_value +#undef builtin_define_std + +} + + /* Define macros builtins common to all language performing CPP preprocessing. */ void -define_language_independent_builtin_macros (cpp_reader *pfile) +define_language_independent_builtin_macros (cpp_reader *pfile, bool iso_c) { define__GNUC__ (pfile); define_builtin_macros_for_compilation_flags (pfile); define_builtin_macros_for_lp64 (pfile); define_builtin_macros_for_type_sizes (pfile); + define_target_specific_builtins (pfile, iso_c); +} + + +/* Pass an object-like macro. If it doesn't lie in the user's + namespace, defines it unconditionally. Otherwise define a version + with two leading underscores, and another version with two leading + and trailing underscores, and define the original only if an ISO + standard was not nominated. + + e.g. passing "unix" defines "__unix", "__unix__" and possibly + "unix". Passing "_mips" defines "__mips", "__mips__" and possibly + "_mips". */ +void +define_builtin_macro_std (cpp_reader *pfile, const char *macro, bool iso_c) +{ + size_t len =3D strlen (macro); + char *buff =3D (char *) alloca (len + 5); + char *p =3D buff + 2; + char *q =3D p + len; + + /* prepend __ (or maybe just _) if in user's namespace. */ + memcpy (p, macro, len + 1); + if (!( *p =3D=3D '_' && (p[1] =3D=3D '_' || ISUPPER (p[1])))) + { + if (*p !=3D '_') + *--p =3D '_'; + if (p[1] !=3D '_') + *--p =3D '_'; + } + cpp_define (pfile, p); + + /* If it was in user's namespace... */ + if (p !=3D buff + 2) + { + /* Define the macro with leading and following __. */ + if (q[-1] !=3D '_') + *q++ =3D '_'; + if (q[-2] !=3D '_') + *q++ =3D '_'; + *q =3D '\0'; + cpp_define (pfile, p); + + /* Finally, define the original macro if permitted. */ + if (iso_c) + cpp_define (pfile, macro); + } } Index: gcc/cppbuiltin.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/cppbuiltin.h (revision 166272) +++ gcc/cppbuiltin.h (working copy) @@ -28,9 +28,13 @@ along with GCC; see the file COPYING3.=20=20 or "major.minor" to extract its components. */ extern void parse_basever (int *, int *, int *); =20 -/* Define macros builtins common to all language performing CPP +/* Define built-in macros common to all language performing CPP preprocessing. */ -extern void define_language_independent_builtin_macros (cpp_reader *); +extern void define_language_independent_builtin_macros (cpp_reader *, bool= ); + +/* Define a built-in macro, and possible prevent it from polluting the + user's namespace. */ +extern void define_builtin_macro_std (cpp_reader *, const char *, bool); =20 =20 #endif /* ! GCC_CPPBUILTIN_H */ Index: gcc/fortran/cpp.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/fortran/cpp.c (revision 166272) +++ gcc/fortran/cpp.c (working copy) @@ -38,18 +38,6 @@ along with GCC; see the file COPYING3.=20=20 #include "cppbuiltin.h" #include "mkdeps.h" =20 -#ifndef TARGET_CPU_CPP_BUILTINS -# define TARGET_CPU_CPP_BUILTINS() -#endif - -#ifndef TARGET_OS_CPP_BUILTINS -# define TARGET_OS_CPP_BUILTINS() -#endif - -#ifndef TARGET_OBJFMT_CPP_BUILTINS -# define TARGET_OBJFMT_CPP_BUILTINS() -#endif - =20 /* Holds switches parsed by gfc_cpp_handle_option (), but whose handling is deferred to gfc_cpp_init (). */ @@ -167,40 +155,12 @@ cpp_define_builtins (cpp_reader *pfile) =20 /* Initialize GFORTRAN specific builtins. These are documented. */ - define_language_independent_builtin_macros (pfile); + define_language_independent_builtin_macros (pfile, false); cpp_define (pfile, "__GFORTRAN__=3D1"); cpp_define (pfile, "_LANGUAGE_FORTRAN=3D1"); =20 if (gfc_option.gfc_flag_openmp) cpp_define (pfile, "_OPENMP=3D200805"); - - /* The defines below are necessary for the TARGET_* macros. - - FIXME: Note that builtin_define_std() actually is a function - in c-cppbuiltin.c which uses flags undefined for Fortran. - Let's skip this for now. If needed, one needs to look into it - once more. */ - -# define builtin_define(TXT) cpp_define (pfile, TXT) -# define builtin_define_std(TXT) -# define builtin_assert(TXT) cpp_assert (pfile, TXT) - - /* FIXME: Pandora's Box - Using the macros below results in multiple breakages: - - mingw will fail to compile this file as dependent macros - assume to be used in c-cppbuiltin.c only. Further, they use - flags only valid/defined in C (same as noted above). - [config/i386/mingw32.h, config/i386/cygming.h] - - other platforms (not as popular) break similarly - [grep for 'builtin_define_with_int_value' in gcc/config/] - - TARGET_CPU_CPP_BUILTINS (); - TARGET_OS_CPP_BUILTINS (); - TARGET_OBJFMT_CPP_BUILTINS (); */ - -#undef builtin_define -#undef builtin_define_std -#undef builtin_assert } =20 bool Index: gcc/doc/tm.texi.in =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/doc/tm.texi.in (revision 166272) +++ gcc/doc/tm.texi.in (working copy) @@ -645,7 +645,10 @@ the functions @code{builtin_define}, @co @code{builtin_assert}. When the front end calls this macro it provides a trailing semicolon, and since it has finished command line option processing your code can use those -results freely. +results freely. This macro, however, will be used by all front-end using +CPP for preprocessing, and should only depend on language-independent +command line option flags (see @code{TARGET_CPU_CPP_BUILTINS_CFAMILY} for +C-specific preprocessor macros). =20 @code{builtin_assert} takes a string in the form you pass to the command-line option @option{-A}, such as @code{cpu=3Dmips}, and creates @@ -657,7 +660,8 @@ object-like macro. If it doesn't lie in @code{builtin_define_std} defines it unconditionally. Otherwise, it defines a version with two leading underscores, and another version with two leading and trailing underscores, and defines the original -only if an ISO standard was not requested on the command line. For +only if an ISO C standard was not requested on the command line (or if +we're preprocessing for a language outside the C family). For example, passing @code{unix} defines @code{__unix}, @code{__unix__} and possibly @code{unix}; passing @code{_mips} defines @code{__mips}, @code{__mips__} and possibly @code{_mips}, and passing @code{_ABI64} @@ -674,11 +678,21 @@ variable @code{flag_iso} can be used. T preprocessing. @end defmac =20 +@defmac TARGET_CPU_CPP_BUILTINS_CFAMILY () +Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional +and will only be called when compiling languages of the C family. +@end defmac + @defmac TARGET_OS_CPP_BUILTINS () Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional and is used for the target operating system instead. @end defmac =20 +@defmac TARGET_OS_CPP_BUILTINS_CFAMILY () +Similarly to @code{TARGET_OS_CPP_BUILTINS} but this macro is optional +and will only be called when compiling languages of the C family. +@end defmac + @defmac TARGET_OBJFMT_CPP_BUILTINS () Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional and is used for the target object format. @file{elfos.h} uses this Index: gcc/config/alpha/linux.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/alpha/linux.h (revision 166272) +++ gcc/config/alpha/linux.h (working copy) @@ -32,6 +32,10 @@ along with GCC; see the file COPYING3.=20=20 builtin_assert ("system=3Dlinux"); \ builtin_assert ("system=3Dunix"); \ builtin_assert ("system=3Dposix"); \ + } while (0) + +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do { \ /* The GNU C++ standard library requires this. */ \ if (c_dialect_cxx ()) \ builtin_define ("_GNU_SOURCE"); \ Index: gcc/config/alpha/alpha.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/alpha/alpha.h (revision 166272) +++ gcc/config/alpha/alpha.h (working copy) @@ -69,13 +69,11 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("_IEEE_FP_INEXACT"); \ if (TARGET_LONG_DOUBLE_128) \ builtin_define ("__LONG_DOUBLE_128__"); \ - \ - /* Macros dependent on the C dialect. */ \ - SUBTARGET_LANGUAGE_CPP_BUILTINS(); \ } while (0) =20 -#ifndef SUBTARGET_LANGUAGE_CPP_BUILTINS -#define SUBTARGET_LANGUAGE_CPP_BUILTINS() \ +/* Macros dependent on the C dialect. */ +#ifndef TARGET_CPU_CPP_BUILTINS_CFAMILY +#define TARGET_CPU_CPP_BUILTINS_CFAMILY() \ do \ { \ if (preprocessing_asm_p ()) \ Index: gcc/config/alpha/osf5.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/alpha/osf5.h (revision 166272) +++ gcc/config/alpha/osf5.h (working copy) @@ -63,7 +63,10 @@ along with GCC; see the file COPYING3.=20=20 to be defined for . */ \ if (LONG_DOUBLE_TYPE_SIZE =3D=3D 128) \ builtin_define ("__X_FLOAT"); \ - \ + } while (0) + +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do { \ /* Tru64 UNIX V4/V5 provide several ISO C94 \ features protected by the corresponding \ __STDC_VERSION__ macro. libstdc++ v3 \ Index: gcc/config/alpha/netbsd.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/alpha/netbsd.h (revision 166272) +++ gcc/config/alpha/netbsd.h (working copy) @@ -29,8 +29,8 @@ along with GCC; see the file COPYING3.=20=20 =20 =20 /* NetBSD doesn't use the LANGUAGE* built-ins. */ -#undef SUBTARGET_LANGUAGE_CPP_BUILTINS -#define SUBTARGET_LANGUAGE_CPP_BUILTINS() /* nothing */ +#undef TARGET_CPU_CPP_BUILTINS_CFAMILY +#define TARGET_CPU_CPP_BUILTINS_CFAMILY() /* nothing */ =20 =20 /* Show that we need a GP when profiling. */ Index: gcc/config/t-darwin =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/t-darwin (revision 166272) +++ gcc/config/t-darwin (working copy) @@ -21,7 +21,7 @@ darwin.o: $(srcdir)/config/darwin.c $(CO $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(REAL_H) insn-config.h = \ conditions.h insn-flags.h output.h insn-attr.h flags.h $(TREE_H) expr.h = \ reload.h function.h $(GGC_H) langhooks.h $(TARGET_H) $(TM_P_H) gt-darwin= .h \ - c-tree.h c-lang.h config/darwin-sections.def + c-tree.h c-lang.h config/darwin-sections.def $(CPPLIB_H) cppbuiltin.h $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/darwin.c =20 Index: gcc/config/frv/frv.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/frv/frv.h (revision 166272) +++ gcc/config/frv/frv.h (working copy) @@ -235,6 +235,13 @@ builtin_define ("__FRV_DWORD__"); \ if (TARGET_FDPIC) \ builtin_define ("__FRV_FDPIC__"); \ + } \ + while (0) + +/* Builtins for C languages. */ +#define TARGET_CPU_CPP_BUILTINS_CFAMILY() \ + do \ + { \ if (flag_leading_underscore > 0) \ builtin_define ("__FRV_UNDERSCORE__"); \ } \ Index: gcc/config/spu/spu-protos.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/spu/spu-protos.h (revision 166272) +++ gcc/config/spu/spu-protos.h (working copy) @@ -19,6 +19,7 @@ #define _SPU_PROTOS_ =20 extern void spu_cpu_cpp_builtins (struct cpp_reader * pfile); +extern void spu_cpu_cpp_builtins_cfamily (struct cpp_reader * pfile); extern void builtin_define_std (const char *); extern void spu_c_common_override_options (void); extern int valid_subreg (rtx op); Index: gcc/config/spu/spu-c.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/spu/spu-c.c (revision 166272) +++ gcc/config/spu/spu-c.c (working copy) @@ -186,25 +186,9 @@ spu_resolve_overloaded_builtin (location =20 =20 void -spu_cpu_cpp_builtins (struct cpp_reader *pfile) +spu_cpu_cpp_builtins_cfamily (struct cpp_reader *pfile) { - cpp_define (pfile, "__SPU__"); - cpp_assert (pfile, "cpu=3Dspu"); - cpp_assert (pfile, "machine=3Dspu"); - if (spu_arch =3D=3D PROCESSOR_CELLEDP) - cpp_define (pfile, "__SPU_EDP__"); cpp_define (pfile, "__vector=3D__attribute__((__spu_vector__))"); - switch (spu_ea_model) - { - case 32: - cpp_define (pfile, "__EA32__"); - break; - case 64: - cpp_define (pfile, "__EA64__"); - break; - default: - gcc_unreachable (); - } =20 if (!flag_iso) { Index: gcc/config/spu/spu.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/spu/spu.c (revision 166272) +++ gcc/config/spu/spu.c (working copy) @@ -7117,4 +7117,25 @@ spu_function_profiler (FILE * file, int=20 fprintf (file, "brsl $75, _mcount\n"); } =20 +void +spu_cpu_cpp_builtins (struct cpp_reader *pfile) +{ + cpp_define (pfile, "__SPU__"); + cpp_assert (pfile, "cpu=3Dspu"); + cpp_assert (pfile, "machine=3Dspu"); + if (spu_arch =3D=3D PROCESSOR_CELLEDP) + cpp_define (pfile, "__SPU_EDP__"); + switch (spu_ea_model) + { + case 32: + cpp_define (pfile, "__EA32__"); + break; + case 64: + cpp_define (pfile, "__EA64__"); + break; + default: + gcc_unreachable (); + } +} + #include "gt-spu.h" Index: gcc/config/spu/spu.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/spu/spu.h (revision 166272) +++ gcc/config/spu/spu.h (working copy) @@ -16,7 +16,8 @@ =20 =0C /* Run-time Target */ -#define TARGET_CPU_CPP_BUILTINS() spu_cpu_cpp_builtins(pfile) +#define TARGET_CPU_CPP_BUILTINS() spu_cpu_cpp_builtins(pfile) +#define TARGET_CPU_CPP_BUILTINS_CFAMILY() spu_cpu_cpp_builtins_cfamily(pf= ile) =20 #define TARGET_VERSION fprintf (stderr, " (spu %s)", __DATE__); =20 Index: gcc/config/darwin-c.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/darwin-c.c (revision 166272) +++ gcc/config/darwin-c.c (working copy) @@ -568,51 +568,14 @@ find_subframework_header (cpp_reader *pf return 0; } =20 -/* Return the value of darwin_macosx_version_min suitable for the - __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, - so '10.4.2' becomes 1040. The lowest digit is always zero. - Print a warning if the version number can't be understood. */ -static const char * -version_as_macro (void) -{ - static char result[] =3D "1000"; - - if (strncmp (darwin_macosx_version_min, "10.", 3) !=3D 0) - goto fail; - if (! ISDIGIT (darwin_macosx_version_min[3])) - goto fail; - result[2] =3D darwin_macosx_version_min[3]; - if (darwin_macosx_version_min[4] !=3D '\0' - && darwin_macosx_version_min[4] !=3D '.') - goto fail; - - return result; - - fail: - error ("Unknown value %qs of -mmacosx-version-min", - darwin_macosx_version_min); - return "1000"; -} =20 /* Define additional CPP flags for Darwin. */ =20 -#define builtin_define(TXT) cpp_define (pfile, TXT) - void -darwin_cpp_builtins (cpp_reader *pfile) +darwin_cpp_builtins_cfamily (cpp_reader *pfile) { - builtin_define ("__MACH__"); - builtin_define ("__APPLE__"); - - /* __APPLE_CC__ is defined as some old Apple include files expect it - to be defined and won't work if it isn't. */ - builtin_define_with_value ("__APPLE_CC__", "1", false); - if (darwin_constant_cfstrings) - builtin_define ("__CONSTANT_CFSTRINGS__"); - - builtin_define_with_value ("__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED_= _", - version_as_macro(), false); + cpp_define (pfile, "__CONSTANT_CFSTRINGS__"); =20 /* Since we do not (at 4.6) support ObjC gc for the NeXT runtime, the following will cause a syntax error if one tries to compile gc attrib= uted @@ -620,14 +583,14 @@ darwin_cpp_builtins (cpp_reader *pfile) properly (on systems >=3D darwin 9). */ if (flag_objc_gc) { - builtin_define ("__strong=3D__attribute__((objc_gc(strong)))"); - builtin_define ("__weak=3D__attribute__((objc_gc(weak)))"); - builtin_define ("__OBJC_GC__"); + cpp_define (pfile, "__strong=3D__attribute__((objc_gc(strong)))"); + cpp_define (pfile, "__weak=3D__attribute__((objc_gc(weak)))"); + cpp_define (pfile, "__OBJC_GC__"); } else { - builtin_define ("__strong=3D"); - builtin_define ("__weak=3D"); + cpp_define (pfile, "__strong=3D"); + cpp_define (pfile, "__weak=3D"); } } =20 Index: gcc/config/i386/i386.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/i386/i386.h (revision 166272) +++ gcc/config/i386/i386.h (working copy) @@ -563,7 +563,7 @@ extern const char *host_detect_local_cpu #endif =0C /* Target CPU builtins. */ -#define TARGET_CPU_CPP_BUILTINS() ix86_target_macros () +#define TARGET_CPU_CPP_BUILTINS() ix86_target_macros (pfile, iso_c) =20 /* Target Pragmas. */ #define REGISTER_TARGET_PRAGMAS() ix86_register_pragmas () Index: gcc/config/i386/cygming.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/i386/cygming.h (revision 166272) +++ gcc/config/i386/cygming.h (working copy) @@ -124,6 +124,17 @@ along with GCC; see the file COPYING3.=20=20 if (TARGET_SEH) \ builtin_define ("__SEH__"); \ builtin_assert ("system=3Dwinnt"); \ + /* Even though linkonce works with static libs, this is needed \ + to compare typeinfo symbols across dll boundaries. */ \ + builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=3D0"); \ + builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=3D0"); \ + EXTRA_OS_CPP_BUILTINS (); \ + } \ + while (0) + +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do \ + { \ builtin_define ("__stdcall=3D__attribute__((__stdcall__))"); \ builtin_define ("__fastcall=3D__attribute__((__fastcall__))"); \ builtin_define ("__thiscall=3D__attribute__((__thiscall__))"); \ @@ -135,12 +146,8 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("_thiscall=3D__attribute__((__thiscall__))"); \ builtin_define ("_cdecl=3D__attribute__((__cdecl__))"); \ } \ - /* Even though linkonce works with static libs, this is needed \ - to compare typeinfo symbols across dll boundaries. */ \ - builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=3D0"); \ - builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=3D0"); \ - EXTRA_OS_CPP_BUILTINS (); \ - } \ + EXTRA_OS_CPP_BUILTINS_CFAMILY (); \ + } \ while (0) =20 /* Get tree.c to declare a target-specific specialization of Index: gcc/config/i386/cygwin.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/i386/cygwin.h (revision 166272) +++ gcc/config/i386/cygwin.h (working copy) @@ -22,6 +22,7 @@ along with GCC; see the file COPYING3.=20=20 #define TARGET_VERSION fprintf (stderr, " (x86 Cygwin)"); =20 #define EXTRA_OS_CPP_BUILTINS() /* Nothing. */ +#define EXTRA_OS_CPP_BUILTINS_CFAMILY() /* Nothing. */ =20 #undef CPP_SPEC #define CPP_SPEC "%(cpp_cpu) %{posix:-D_POSIX_SOURCE} \ Index: gcc/config/i386/netware.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/i386/netware.h (revision 166272) +++ gcc/config/i386/netware.h (working copy) @@ -51,6 +51,12 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("__netware__"); \ builtin_assert ("system=3Dnetware"); \ builtin_define ("__ELF__"); \ + } \ + while (0) + +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do \ + { \ builtin_define ("__cdecl=3D__attribute__((__cdecl__))"); \ builtin_define ("__stdcall=3D__attribute__((__stdcall__))"); \ builtin_define ("__fastcall=3D__attribute__((__fastcall__))"); \ Index: gcc/config/i386/i386-interix.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/i386/i386-interix.h (revision 166272) +++ gcc/config/i386/i386-interix.h (working copy) @@ -63,10 +63,16 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("__OPENNT"); \ builtin_define ("_M_IX86=3D300"); \ builtin_define ("_X86_=3D1"); \ - builtin_define ("__stdcall=3D__attribute__((__stdcall__))"); \ - builtin_define ("__cdecl=3D__attribute__((__cdecl__))"); \ builtin_assert ("system=3Dunix"); \ builtin_assert ("system=3Dinterix"); \ + } \ + while (0) + +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do \ + { \ + builtin_define ("__stdcall=3D__attribute__((__stdcall__))"); \ + builtin_define ("__cdecl=3D__attribute__((__cdecl__))"); \ if (preprocessing_asm_p ()) \ builtin_define_std ("LANGUAGE_ASSEMBLY"); \ else \ Index: gcc/config/i386/i386-c.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/i386/i386-c.c (revision 166272) +++ gcc/config/i386/i386-c.c (working copy) @@ -30,242 +30,10 @@ along with GCC; see the file COPYING3.=20=20 #include "target.h" #include "target-def.h" #include "cpplib.h" +#include "cppbuiltin.h" #include "c-family/c-pragma.h" =20 static bool ix86_pragma_target_parse (tree, tree); -static void ix86_target_macros_internal - (int, enum processor_type, enum processor_type, enum fpmath_unit, - void (*def_or_undef) (cpp_reader *, const char *)); - -=0C -/* Internal function to either define or undef the appropriate system - macros. */ -static void -ix86_target_macros_internal (int isa_flag, - enum processor_type arch, - enum processor_type tune, - enum fpmath_unit fpmath, - void (*def_or_undef) (cpp_reader *, - const char *)) -{ - /* For some of the k6/pentium varients there weren't seperate ISA bits to - identify which tune/arch flag was passed, so figure it out here. */ - size_t arch_len =3D strlen (ix86_arch_string); - size_t tune_len =3D strlen (ix86_tune_string); - int last_arch_char =3D ix86_arch_string[arch_len - 1]; - int last_tune_char =3D ix86_tune_string[tune_len - 1]; - - /* Built-ins based on -march=3D. */ - switch (arch) - { - case PROCESSOR_I386: - break; - case PROCESSOR_I486: - def_or_undef (parse_in, "__i486"); - def_or_undef (parse_in, "__i486__"); - break; - case PROCESSOR_PENTIUM: - def_or_undef (parse_in, "__i586"); - def_or_undef (parse_in, "__i586__"); - def_or_undef (parse_in, "__pentium"); - def_or_undef (parse_in, "__pentium__"); - if (isa_flag & OPTION_MASK_ISA_MMX) - def_or_undef (parse_in, "__pentium_mmx__"); - break; - case PROCESSOR_PENTIUMPRO: - def_or_undef (parse_in, "__i686"); - def_or_undef (parse_in, "__i686__"); - def_or_undef (parse_in, "__pentiumpro"); - def_or_undef (parse_in, "__pentiumpro__"); - break; - case PROCESSOR_GEODE: - def_or_undef (parse_in, "__geode"); - def_or_undef (parse_in, "__geode__"); - break; - case PROCESSOR_K6: - def_or_undef (parse_in, "__k6"); - def_or_undef (parse_in, "__k6__"); - if (last_arch_char =3D=3D '2') - def_or_undef (parse_in, "__k6_2__"); - else if (last_arch_char =3D=3D '3') - def_or_undef (parse_in, "__k6_3__"); - else if (isa_flag & OPTION_MASK_ISA_3DNOW) - def_or_undef (parse_in, "__k6_3__"); - break; - case PROCESSOR_ATHLON: - def_or_undef (parse_in, "__athlon"); - def_or_undef (parse_in, "__athlon__"); - if (isa_flag & OPTION_MASK_ISA_SSE) - def_or_undef (parse_in, "__athlon_sse__"); - break; - case PROCESSOR_K8: - def_or_undef (parse_in, "__k8"); - def_or_undef (parse_in, "__k8__"); - break; - case PROCESSOR_AMDFAM10: - def_or_undef (parse_in, "__amdfam10"); - def_or_undef (parse_in, "__amdfam10__"); - break; - case PROCESSOR_BDVER1: - def_or_undef (parse_in, "__bdver1"); - def_or_undef (parse_in, "__bdver1__"); - break; - case PROCESSOR_PENTIUM4: - def_or_undef (parse_in, "__pentium4"); - def_or_undef (parse_in, "__pentium4__"); - break; - case PROCESSOR_NOCONA: - def_or_undef (parse_in, "__nocona"); - def_or_undef (parse_in, "__nocona__"); - break; - case PROCESSOR_CORE2: - def_or_undef (parse_in, "__core2"); - def_or_undef (parse_in, "__core2__"); - break; - case PROCESSOR_COREI7_32: - case PROCESSOR_COREI7_64: - def_or_undef (parse_in, "__corei7"); - def_or_undef (parse_in, "__corei7__"); - break; - case PROCESSOR_ATOM: - def_or_undef (parse_in, "__atom"); - def_or_undef (parse_in, "__atom__"); - break; - /* use PROCESSOR_max to not set/unset the arch macro. */ - case PROCESSOR_max: - break; - case PROCESSOR_GENERIC32: - case PROCESSOR_GENERIC64: - gcc_unreachable (); - } - - /* Built-ins based on -mtune=3D. */ - switch (tune) - { - case PROCESSOR_I386: - def_or_undef (parse_in, "__tune_i386__"); - break; - case PROCESSOR_I486: - def_or_undef (parse_in, "__tune_i486__"); - break; - case PROCESSOR_PENTIUM: - def_or_undef (parse_in, "__tune_i586__"); - def_or_undef (parse_in, "__tune_pentium__"); - if (last_tune_char =3D=3D 'x') - def_or_undef (parse_in, "__tune_pentium_mmx__"); - break; - case PROCESSOR_PENTIUMPRO: - def_or_undef (parse_in, "__tune_i686__"); - def_or_undef (parse_in, "__tune_pentiumpro__"); - switch (last_tune_char) - { - case '3': - def_or_undef (parse_in, "__tune_pentium3__"); - /* FALLTHRU */ - case '2': - def_or_undef (parse_in, "__tune_pentium2__"); - break; - } - break; - case PROCESSOR_GEODE: - def_or_undef (parse_in, "__tune_geode__"); - break; - case PROCESSOR_K6: - def_or_undef (parse_in, "__tune_k6__"); - if (last_tune_char =3D=3D '2') - def_or_undef (parse_in, "__tune_k6_2__"); - else if (last_tune_char =3D=3D '3') - def_or_undef (parse_in, "__tune_k6_3__"); - else if (isa_flag & OPTION_MASK_ISA_3DNOW) - def_or_undef (parse_in, "__tune_k6_3__"); - break; - case PROCESSOR_ATHLON: - def_or_undef (parse_in, "__tune_athlon__"); - if (isa_flag & OPTION_MASK_ISA_SSE) - def_or_undef (parse_in, "__tune_athlon_sse__"); - break; - case PROCESSOR_K8: - def_or_undef (parse_in, "__tune_k8__"); - break; - case PROCESSOR_AMDFAM10: - def_or_undef (parse_in, "__tune_amdfam10__"); - break; - case PROCESSOR_BDVER1: - def_or_undef (parse_in, "__tune_bdver1__"); - break; - case PROCESSOR_PENTIUM4: - def_or_undef (parse_in, "__tune_pentium4__"); - break; - case PROCESSOR_NOCONA: - def_or_undef (parse_in, "__tune_nocona__"); - break; - case PROCESSOR_CORE2: - def_or_undef (parse_in, "__tune_core2__"); - break; - case PROCESSOR_COREI7_32: - case PROCESSOR_COREI7_64: - def_or_undef (parse_in, "__tune_corei7__"); - break; - case PROCESSOR_ATOM: - def_or_undef (parse_in, "__tune_atom__"); - break; - case PROCESSOR_GENERIC32: - case PROCESSOR_GENERIC64: - break; - /* use PROCESSOR_max to not set/unset the tune macro. */ - case PROCESSOR_max: - break; - } - - if (isa_flag & OPTION_MASK_ISA_MMX) - def_or_undef (parse_in, "__MMX__"); - if (isa_flag & OPTION_MASK_ISA_3DNOW) - def_or_undef (parse_in, "__3dNOW__"); - if (isa_flag & OPTION_MASK_ISA_3DNOW_A) - def_or_undef (parse_in, "__3dNOW_A__"); - if (isa_flag & OPTION_MASK_ISA_SSE) - def_or_undef (parse_in, "__SSE__"); - if (isa_flag & OPTION_MASK_ISA_SSE2) - def_or_undef (parse_in, "__SSE2__"); - if (isa_flag & OPTION_MASK_ISA_SSE3) - def_or_undef (parse_in, "__SSE3__"); - if (isa_flag & OPTION_MASK_ISA_SSSE3) - def_or_undef (parse_in, "__SSSE3__"); - if (isa_flag & OPTION_MASK_ISA_SSE4_1) - def_or_undef (parse_in, "__SSE4_1__"); - if (isa_flag & OPTION_MASK_ISA_SSE4_2) - def_or_undef (parse_in, "__SSE4_2__"); - if (isa_flag & OPTION_MASK_ISA_AES) - def_or_undef (parse_in, "__AES__"); - if (isa_flag & OPTION_MASK_ISA_PCLMUL) - def_or_undef (parse_in, "__PCLMUL__"); - if (isa_flag & OPTION_MASK_ISA_AVX) - def_or_undef (parse_in, "__AVX__"); - if (isa_flag & OPTION_MASK_ISA_FMA) - def_or_undef (parse_in, "__FMA__"); - if (isa_flag & OPTION_MASK_ISA_SSE4A) - def_or_undef (parse_in, "__SSE4A__"); - if (isa_flag & OPTION_MASK_ISA_FMA4) - def_or_undef (parse_in, "__FMA4__"); - if (isa_flag & OPTION_MASK_ISA_XOP) - def_or_undef (parse_in, "__XOP__"); - if (isa_flag & OPTION_MASK_ISA_LWP) - def_or_undef (parse_in, "__LWP__"); - if (isa_flag & OPTION_MASK_ISA_ABM) - def_or_undef (parse_in, "__ABM__"); - if (isa_flag & OPTION_MASK_ISA_POPCNT) - def_or_undef (parse_in, "__POPCNT__"); - if (isa_flag & OPTION_MASK_ISA_FSGSBASE) - def_or_undef (parse_in, "__FSGSBASE__"); - if (isa_flag & OPTION_MASK_ISA_RDRND) - def_or_undef (parse_in, "__RDRND__"); - if (isa_flag & OPTION_MASK_ISA_F16C) - def_or_undef (parse_in, "__F16C__"); - if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE)) - def_or_undef (parse_in, "__SSE_MATH__"); - if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE2)) - def_or_undef (parse_in, "__SSE2_MATH__"); -} =20 =0C /* Hook to validate the current #pragma GCC target and set the state, and @@ -328,6 +96,7 @@ ix86_pragma_target_parse (tree args, tre prev_arch, prev_tune, (enum fpmath_unit) prev_opt->fpmath, + parse_in, cpp_undef); =20 /* Define all of the macros for new options that were just turned on. */ @@ -335,42 +104,12 @@ ix86_pragma_target_parse (tree args, tre cur_arch, cur_tune, (enum fpmath_unit) cur_opt->fpmath, + parse_in, cpp_define); =20 return true; } =0C -/* Function to tell the preprocessor about the defines for the current tar= get. */ - -void -ix86_target_macros (void) -{ - /* 32/64-bit won't change with target specific options, so do the assert= and - builtin_define_std calls here. */ - if (TARGET_64BIT) - { - cpp_assert (parse_in, "cpu=3Dx86_64"); - cpp_assert (parse_in, "machine=3Dx86_64"); - cpp_define (parse_in, "__amd64"); - cpp_define (parse_in, "__amd64__"); - cpp_define (parse_in, "__x86_64"); - cpp_define (parse_in, "__x86_64__"); - } - else - { - cpp_assert (parse_in, "cpu=3Di386"); - cpp_assert (parse_in, "machine=3Di386"); - builtin_define_std ("i386"); - } - - ix86_target_macros_internal (ix86_isa_flags, - ix86_arch, - ix86_tune, - ix86_fpmath, - cpp_define); -} - -=0C /* Register target pragmas. We need to add the hook for parsing #pragma G= CC option here rather than in i386.c since it will pull in various preproc= essor functions, and those are not present in languages like fortran without a Index: gcc/config/i386/darwin.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/i386/darwin.h (revision 166272) +++ gcc/config/i386/darwin.h (working copy) @@ -54,6 +54,13 @@ along with GCC; see the file COPYING3.=20=20 } \ while (0) =20 +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do \ + { \ + darwin_cpp_builtins_cfamily (pfile); \ + } \ + while (0) + #undef PTRDIFF_TYPE #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") =20 Index: gcc/config/i386/mingw32.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/i386/mingw32.h (revision 166272) +++ gcc/config/i386/mingw32.h (working copy) @@ -36,8 +36,6 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("_WIN32"); \ builtin_define_std ("WIN32"); \ builtin_define_std ("WINNT"); \ - builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \ - TYPE_PRECISION (intmax_type_node));\ if (TARGET_64BIT && ix86_abi =3D=3D MS_ABI) \ { \ builtin_define ("__MINGW64__"); \ @@ -47,6 +45,15 @@ along with GCC; see the file COPYING3.=20=20 } \ while (0) =20 +#define EXTRA_OS_CPP_BUILTINS_CFAMILY() \ + do \ + { \ + builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \ + TYPE_PRECISION (intmax_type_node));\ + } \ + while (0) + + #undef SUB_LINK_ENTRY32 #undef SUB_LINK_ENTRY64 #define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12" Index: gcc/config/i386/t-i386 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/i386/t-i386 (revision 166272) +++ gcc/config/i386/t-i386 (working copy) @@ -23,12 +23,12 @@ i386.o: $(CONFIG_H) $(SYSTEM_H) coretype $(RECOG_H) $(EXPR_H) $(OPTABS_H) toplev.h $(BASIC_BLOCK_H) \ $(GGC_H) $(TARGET_H) $(TARGET_DEF_H) langhooks.h $(CGRAPH_H) \ $(TREE_GIMPLE_H) $(DWARF2_H) $(DF_H) tm-constrs.h $(PARAMS_H) \ - i386-builtin-types.inc debug.h dwarf2out.h + i386-builtin-types.inc debug.h dwarf2out.h $(CPPLIB_H) cppbuiltin.h =20 i386-c.o: $(srcdir)/config/i386/i386-c.c \ $(srcdir)/config/i386/i386-protos.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(TM_P_H) $(FLAGS_H) $(C_COMMON_H) $(GGC_H) \ - $(TARGET_H) $(TARGET_DEF_H) $(CPPLIB_H) $(C_PRAGMA_H) + $(TARGET_H) $(TARGET_DEF_H) $(CPPLIB_H) $(C_PRAGMA_H) cppbuiltin.h $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ $(srcdir)/config/i386/i386-c.c =20 Index: gcc/config/i386/i386-protos.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/i386/i386-protos.h (revision 166272) +++ gcc/config/i386/i386-protos.h (working copy) @@ -206,8 +206,13 @@ extern void ix86_expand_reduc_v4sf (rtx=20 =20 extern void ix86_expand_vec_extract_even_odd (rtx, rtx, rtx, unsigned); =20 +extern void ix86_target_macros_internal + (int, enum processor_type, enum processor_type, enum fpmath_unit, + struct cpp_reader *, + void (*def_or_undef) (struct cpp_reader *, const char *)); +extern void ix86_target_macros (struct cpp_reader *, bool); + /* In i386-c.c */ -extern void ix86_target_macros (void); extern void ix86_register_pragmas (void); =20 /* In winnt.c */ Index: gcc/config/i386/i386.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/i386/i386.c (revision 166272) +++ gcc/config/i386/i386.c (working copy) @@ -56,6 +56,8 @@ along with GCC; see the file COPYING3.=20=20 #include "debug.h" #include "dwarf2out.h" #include "sched-int.h" +#include "cpplib.h" +#include "cppbuiltin.h" =20 typedef struct block_info_def { @@ -34170,6 +34172,261 @@ ix86_preferred_simd_mode (enum machine_m return word_mode; } =20 + +/* Internal function to either define or undef the appropriate system + macros. */ +void +ix86_target_macros_internal (int isa_flag, + enum processor_type arch, + enum processor_type tune, + enum fpmath_unit fpmath, + cpp_reader *pfile, + void (*def_or_undef) (cpp_reader *, + const char *)) +{ + /* For some of the k6/pentium varients there weren't seperate ISA bits to + identify which tune/arch flag was passed, so figure it out here. */ + size_t arch_len =3D strlen (ix86_arch_string); + size_t tune_len =3D strlen (ix86_tune_string); + int last_arch_char =3D ix86_arch_string[arch_len - 1]; + int last_tune_char =3D ix86_tune_string[tune_len - 1]; + + /* Built-ins based on -march=3D. */ + switch (arch) + { + case PROCESSOR_I386: + break; + case PROCESSOR_I486: + def_or_undef (pfile, "__i486"); + def_or_undef (pfile, "__i486__"); + break; + case PROCESSOR_PENTIUM: + def_or_undef (pfile, "__i586"); + def_or_undef (pfile, "__i586__"); + def_or_undef (pfile, "__pentium"); + def_or_undef (pfile, "__pentium__"); + if (isa_flag & OPTION_MASK_ISA_MMX) + def_or_undef (pfile, "__pentium_mmx__"); + break; + case PROCESSOR_PENTIUMPRO: + def_or_undef (pfile, "__i686"); + def_or_undef (pfile, "__i686__"); + def_or_undef (pfile, "__pentiumpro"); + def_or_undef (pfile, "__pentiumpro__"); + break; + case PROCESSOR_GEODE: + def_or_undef (pfile, "__geode"); + def_or_undef (pfile, "__geode__"); + break; + case PROCESSOR_K6: + def_or_undef (pfile, "__k6"); + def_or_undef (pfile, "__k6__"); + if (last_arch_char =3D=3D '2') + def_or_undef (pfile, "__k6_2__"); + else if (last_arch_char =3D=3D '3') + def_or_undef (pfile, "__k6_3__"); + else if (isa_flag & OPTION_MASK_ISA_3DNOW) + def_or_undef (pfile, "__k6_3__"); + break; + case PROCESSOR_ATHLON: + def_or_undef (pfile, "__athlon"); + def_or_undef (pfile, "__athlon__"); + if (isa_flag & OPTION_MASK_ISA_SSE) + def_or_undef (pfile, "__athlon_sse__"); + break; + case PROCESSOR_K8: + def_or_undef (pfile, "__k8"); + def_or_undef (pfile, "__k8__"); + break; + case PROCESSOR_AMDFAM10: + def_or_undef (pfile, "__amdfam10"); + def_or_undef (pfile, "__amdfam10__"); + break; + case PROCESSOR_BDVER1: + def_or_undef (pfile, "__bdver1"); + def_or_undef (pfile, "__bdver1__"); + break; + case PROCESSOR_PENTIUM4: + def_or_undef (pfile, "__pentium4"); + def_or_undef (pfile, "__pentium4__"); + break; + case PROCESSOR_NOCONA: + def_or_undef (pfile, "__nocona"); + def_or_undef (pfile, "__nocona__"); + break; + case PROCESSOR_CORE2: + def_or_undef (pfile, "__core2"); + def_or_undef (pfile, "__core2__"); + break; + case PROCESSOR_ATOM: + def_or_undef (pfile, "__atom"); + def_or_undef (pfile, "__atom__"); + break; + /* use PROCESSOR_max to not set/unset the arch macro. */ + case PROCESSOR_max: + break; + case PROCESSOR_GENERIC32: + case PROCESSOR_GENERIC64: + gcc_unreachable (); + } + + /* Built-ins based on -mtune=3D. */ + switch (tune) + { + case PROCESSOR_I386: + def_or_undef (pfile, "__tune_i386__"); + break; + case PROCESSOR_I486: + def_or_undef (pfile, "__tune_i486__"); + break; + case PROCESSOR_PENTIUM: + def_or_undef (pfile, "__tune_i586__"); + def_or_undef (pfile, "__tune_pentium__"); + if (last_tune_char =3D=3D 'x') + def_or_undef (pfile, "__tune_pentium_mmx__"); + break; + case PROCESSOR_PENTIUMPRO: + def_or_undef (pfile, "__tune_i686__"); + def_or_undef (pfile, "__tune_pentiumpro__"); + switch (last_tune_char) + { + case '3': + def_or_undef (pfile, "__tune_pentium3__"); + /* FALLTHRU */ + case '2': + def_or_undef (pfile, "__tune_pentium2__"); + break; + } + break; + case PROCESSOR_GEODE: + def_or_undef (pfile, "__tune_geode__"); + break; + case PROCESSOR_K6: + def_or_undef (pfile, "__tune_k6__"); + if (last_tune_char =3D=3D '2') + def_or_undef (pfile, "__tune_k6_2__"); + else if (last_tune_char =3D=3D '3') + def_or_undef (pfile, "__tune_k6_3__"); + else if (isa_flag & OPTION_MASK_ISA_3DNOW) + def_or_undef (pfile, "__tune_k6_3__"); + break; + case PROCESSOR_ATHLON: + def_or_undef (pfile, "__tune_athlon__"); + if (isa_flag & OPTION_MASK_ISA_SSE) + def_or_undef (pfile, "__tune_athlon_sse__"); + break; + case PROCESSOR_K8: + def_or_undef (pfile, "__tune_k8__"); + break; + case PROCESSOR_AMDFAM10: + def_or_undef (pfile, "__tune_amdfam10__"); + break; + case PROCESSOR_BDVER1: + def_or_undef (pfile, "__tune_bdver1__"); + break; + case PROCESSOR_PENTIUM4: + def_or_undef (pfile, "__tune_pentium4__"); + break; + case PROCESSOR_NOCONA: + def_or_undef (pfile, "__tune_nocona__"); + break; + case PROCESSOR_CORE2: + def_or_undef (pfile, "__tune_core2__"); + break; + case PROCESSOR_ATOM: + def_or_undef (pfile, "__tune_atom__"); + break; + case PROCESSOR_GENERIC32: + case PROCESSOR_GENERIC64: + break; + /* use PROCESSOR_max to not set/unset the tune macro. */ + case PROCESSOR_max: + break; + } + + if (isa_flag & OPTION_MASK_ISA_MMX) + def_or_undef (pfile, "__MMX__"); + if (isa_flag & OPTION_MASK_ISA_3DNOW) + def_or_undef (pfile, "__3dNOW__"); + if (isa_flag & OPTION_MASK_ISA_3DNOW_A) + def_or_undef (pfile, "__3dNOW_A__"); + if (isa_flag & OPTION_MASK_ISA_SSE) + def_or_undef (pfile, "__SSE__"); + if (isa_flag & OPTION_MASK_ISA_SSE2) + def_or_undef (pfile, "__SSE2__"); + if (isa_flag & OPTION_MASK_ISA_SSE3) + def_or_undef (pfile, "__SSE3__"); + if (isa_flag & OPTION_MASK_ISA_SSSE3) + def_or_undef (pfile, "__SSSE3__"); + if (isa_flag & OPTION_MASK_ISA_SSE4_1) + def_or_undef (pfile, "__SSE4_1__"); + if (isa_flag & OPTION_MASK_ISA_SSE4_2) + def_or_undef (pfile, "__SSE4_2__"); + if (isa_flag & OPTION_MASK_ISA_AES) + def_or_undef (pfile, "__AES__"); + if (isa_flag & OPTION_MASK_ISA_PCLMUL) + def_or_undef (pfile, "__PCLMUL__"); + if (isa_flag & OPTION_MASK_ISA_AVX) + def_or_undef (pfile, "__AVX__"); + if (isa_flag & OPTION_MASK_ISA_FMA) + def_or_undef (pfile, "__FMA__"); + if (isa_flag & OPTION_MASK_ISA_SSE4A) + def_or_undef (pfile, "__SSE4A__"); + if (isa_flag & OPTION_MASK_ISA_FMA4) + def_or_undef (pfile, "__FMA4__"); + if (isa_flag & OPTION_MASK_ISA_XOP) + def_or_undef (pfile, "__XOP__"); + if (isa_flag & OPTION_MASK_ISA_LWP) + def_or_undef (pfile, "__LWP__"); + if (isa_flag & OPTION_MASK_ISA_ABM) + def_or_undef (pfile, "__ABM__"); + if (isa_flag & OPTION_MASK_ISA_POPCNT) + def_or_undef (pfile, "__POPCNT__"); + if (isa_flag & OPTION_MASK_ISA_FSGSBASE) + def_or_undef (pfile, "__FSGSBASE__"); + if (isa_flag & OPTION_MASK_ISA_RDRND) + def_or_undef (pfile, "__RDRND__"); + if (isa_flag & OPTION_MASK_ISA_F16C) + def_or_undef (pfile, "__F16C__"); + if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE)) + def_or_undef (pfile, "__SSE_MATH__"); + if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE2)) + def_or_undef (pfile, "__SSE2_MATH__"); +} + + +/* Function to tell the preprocessor about the defines for the current + target. */ +void +ix86_target_macros (cpp_reader *pfile, bool iso_c) +{ + /* 32/64-bit won't change with target specific options, so do the assert= and + builtin_define_std calls here. */ + if (TARGET_64BIT) + { + cpp_assert (pfile, "cpu=3Dx86_64"); + cpp_assert (pfile, "machine=3Dx86_64"); + cpp_define (pfile, "__amd64"); + cpp_define (pfile, "__amd64__"); + cpp_define (pfile, "__x86_64"); + cpp_define (pfile, "__x86_64__"); + } + else + { + cpp_assert (pfile, "cpu=3Di386"); + cpp_assert (pfile, "machine=3Di386"); + define_builtin_macro_std (pfile, "i386", iso_c); + } + + ix86_target_macros_internal (ix86_isa_flags, + ix86_arch, + ix86_tune, + ix86_fpmath, + pfile, + cpp_define); +} + + /* If AVX is enabled then try vectorizing with both 256bit and 128bit vectors. */ =20 Index: gcc/config/darwin-protos.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/darwin-protos.h (revision 166272) +++ gcc/config/darwin-protos.h (working copy) @@ -92,6 +92,7 @@ extern void darwin_asm_declare_constant_ const_tree, HOST_WIDE_INT); extern bool darwin_binds_local_p (const_tree); extern void darwin_cpp_builtins (struct cpp_reader *); +extern void darwin_cpp_builtins_cfamily (struct cpp_reader *); =20 extern void darwin_init_cfstring_builtins (unsigned); extern tree darwin_fold_builtin (tree, int, tree *, bool); Index: gcc/config/sol2.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/sol2.h (revision 166272) +++ gcc/config/sol2.h (working copy) @@ -94,6 +94,10 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("__SVR4"); \ builtin_assert ("system=3Dunix"); \ builtin_assert ("system=3Dsvr4"); \ + TARGET_SUB_OS_CPP_BUILTINS(); \ + } while (0) +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do { \ /* For C++ we need to add some additional macro \ definitions required by the C++ standard \ library. */ \ @@ -105,7 +109,6 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("_LARGEFILE64_SOURCE=3D1"); \ builtin_define ("__EXTENSIONS__"); \ } \ - TARGET_SUB_OS_CPP_BUILTINS(); \ } while (0) =20 /* The system headers under Solaris 2 are C++-aware since 2.0. */ Index: gcc/config/avr/avr-protos.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/avr/avr-protos.h (revision 166272) +++ gcc/config/avr/avr-protos.h (working copy) @@ -22,7 +22,7 @@ =20 =20 extern int function_arg_regno_p (int r); -extern void avr_cpu_cpp_builtins (struct cpp_reader * pfile); +extern void avr_cpu_cpp_builtins (struct cpp_reader * pfile, bool iso_c); extern int avr_ret_register (void); extern enum reg_class avr_regno_reg_class (int r); extern void asm_globalize_label (FILE *file, const char *name); Index: gcc/config/avr/avr.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/avr/avr.c (revision 166272) +++ gcc/config/avr/avr.c (working copy) @@ -45,6 +45,8 @@ #include "target-def.h" #include "params.h" #include "df.h" +#include "cpplib.h" +#include "cppbuiltin.h" =20 /* Maximal allowed offset for an address in the LD command */ #define MAX_LD_OFFSET(MODE) (64 - (signed)GET_MODE_SIZE (MODE)) @@ -6157,4 +6159,58 @@ unsigned int avr_case_values_threshold ( return (!AVR_HAVE_JMP_CALL || TARGET_CALL_PROLOGUES) ? 8 : 17; } =20 + +/* Worker function for TARGET_CPU_CPP_BUILTINS. */ + +void +avr_cpu_cpp_builtins (struct cpp_reader *pfile, bool iso_c) +{ + define_builtin_macro_std (pfile, "AVR", iso_c); + + if (avr_current_arch->macro) + cpp_define (pfile, avr_current_arch->macro); + if (avr_extra_arch_macro) + cpp_define (pfile, avr_extra_arch_macro); + if (avr_current_arch->have_elpm) + cpp_define (pfile, "__AVR_HAVE_RAMPZ__"); + if (avr_current_arch->have_elpm) + cpp_define (pfile, "__AVR_HAVE_ELPM__"); + if (avr_current_arch->have_elpmx) + cpp_define (pfile, "__AVR_HAVE_ELPMX__"); + if (avr_current_arch->have_movw_lpmx) + { + cpp_define (pfile, "__AVR_HAVE_MOVW__"); + cpp_define (pfile, "__AVR_HAVE_LPMX__"); + } + if (avr_current_arch->asm_only) + cpp_define (pfile, "__AVR_ASM_ONLY__"); + if (avr_current_arch->have_mul) + { + cpp_define (pfile, "__AVR_ENHANCED__"); + cpp_define (pfile, "__AVR_HAVE_MUL__"); + } + if (avr_current_arch->have_jmp_call) + { + cpp_define (pfile, "__AVR_MEGA__"); + cpp_define (pfile, "__AVR_HAVE_JMP_CALL__"); + } + if (avr_current_arch->have_eijmp_eicall) + { + cpp_define (pfile, "__AVR_HAVE_EIJMP_EICALL__"); + cpp_define (pfile, "__AVR_3_BYTE_PC__"); + } + else + { + cpp_define (pfile, "__AVR_2_BYTE_PC__"); + } + + if (avr_current_device->short_sp) + cpp_define (pfile, "__AVR_HAVE_8BIT_SP__"); + else + cpp_define (pfile, "__AVR_HAVE_16BIT_SP__"); + + if (TARGET_NO_INTERRUPTS) + cpp_define (pfile, "__NO_INTERRUPTS__"); +} + #include "gt-avr.h" Index: gcc/config/avr/t-avr =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/avr/t-avr (revision 166272) +++ gcc/config/avr/t-avr (working copy) @@ -26,11 +26,6 @@ avr-devices.o: $(srcdir)/config/avr/avr- $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< =20=09 =20 -avr-c.o: $(srcdir)/config/avr/avr-c.c \ - $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H) - $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< -=09 - =20 LIB1ASMSRC =3D avr/libgcc.S LIB1ASMFUNCS =3D \ Index: gcc/config/avr/avr-c.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/avr/avr-c.c (revision 166272) +++ gcc/config/avr/avr-c.c (working copy) @@ -1,85 +0,0 @@ -/* Copyright (C) 2009=0D - Free Software Foundation, Inc.=0D - Contributed by Anatoly Sokolov (aesok@post.ru)=0D -=0D - This file is part of GCC.=0D -=0D - GCC is free software; you can redistribute it and/or modify=0D - it under the terms of the GNU General Public License as published by=0D - the Free Software Foundation; either version 3, or (at your option)=0D - any later version.=0D - =0D - GCC is distributed in the hope that it will be useful,=0D - but WITHOUT ANY WARRANTY; without even the implied warranty of=0D - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the=0D - GNU General Public License for more details.=0D - =0D - You should have received a copy of the GNU General Public License=0D - along with GCC; see the file COPYING3. If not see=0D - . */=0D -=0D -=0D -#include "config.h"=0D -#include "system.h"=0D -#include "coretypes.h"=0D -#include "tm.h"=0D -#include "tm_p.h"=0D -#include "cpplib.h"=0D -#include "tree.h"=0D -#include "c-family/c-common.h"=0D -=0D -/* Not included in avr.c since this requires C front end. */=0D -=0D -/* Worker function for TARGET_CPU_CPP_BUILTINS. */=0D -=0D -void=0D -avr_cpu_cpp_builtins (struct cpp_reader *pfile)=0D -{=0D - builtin_define_std ("AVR");=0D -=0D - if (avr_current_arch->macro)=0D - cpp_define (pfile, avr_current_arch->macro);=0D - if (avr_extra_arch_macro)=0D - cpp_define (pfile, avr_extra_arch_macro);=0D - if (avr_current_arch->have_elpm)=0D - cpp_define (pfile, "__AVR_HAVE_RAMPZ__");=0D - if (avr_current_arch->have_elpm)=0D - cpp_define (pfile, "__AVR_HAVE_ELPM__");=0D - if (avr_current_arch->have_elpmx)=0D - cpp_define (pfile, "__AVR_HAVE_ELPMX__");=0D - if (avr_current_arch->have_movw_lpmx)=0D - {=0D - cpp_define (pfile, "__AVR_HAVE_MOVW__");=0D - cpp_define (pfile, "__AVR_HAVE_LPMX__");=0D - }=0D - if (avr_current_arch->asm_only)=0D - cpp_define (pfile, "__AVR_ASM_ONLY__");=0D - if (avr_current_arch->have_mul)=0D - {=0D - cpp_define (pfile, "__AVR_ENHANCED__");=0D - cpp_define (pfile, "__AVR_HAVE_MUL__");=0D - }=0D - if (avr_current_arch->have_jmp_call)=0D - {=0D - cpp_define (pfile, "__AVR_MEGA__");=0D - cpp_define (pfile, "__AVR_HAVE_JMP_CALL__");=0D - }=0D - if (avr_current_arch->have_eijmp_eicall)=0D - {=0D - cpp_define (pfile, "__AVR_HAVE_EIJMP_EICALL__");=0D - cpp_define (pfile, "__AVR_3_BYTE_PC__");=0D - }=0D - else=0D - {=0D - cpp_define (pfile, "__AVR_2_BYTE_PC__");=0D - }=0D -=0D - if (avr_current_device->short_sp)=0D - cpp_define (pfile, "__AVR_HAVE_8BIT_SP__");=0D - else=0D - cpp_define (pfile, "__AVR_HAVE_16BIT_SP__");=0D -=0D - if (TARGET_NO_INTERRUPTS)=0D - cpp_define (pfile, "__NO_INTERRUPTS__");=0D -}=0D -=0D Index: gcc/config/avr/avr.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/avr/avr.h (revision 166272) +++ gcc/config/avr/avr.h (working copy) @@ -105,7 +105,7 @@ extern const struct mcu_type_s *avr_curr extern const struct mcu_type_s avr_mcu_types[]; extern const struct base_arch_s avr_arch_types[]; =20 -#define TARGET_CPU_CPP_BUILTINS() avr_cpu_cpp_builtins (pfile) +#define TARGET_CPU_CPP_BUILTINS() avr_cpu_cpp_builtins (pfile, iso_c) =20 #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) extern GTY(()) section *progmem_section; Index: gcc/config/ia64/hpux.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/ia64/hpux.h (revision 166272) +++ gcc/config/ia64/hpux.h (working copy) @@ -48,14 +48,18 @@ do { \ builtin_define("_INCLUDE_LONGLONG"); \ builtin_define("__STDC_EXT__"); \ builtin_define("_UINT128_T"); \ + if (TARGET_ILP32) \ + builtin_define("_ILP32"); \ +} while (0) + +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ +do { \ if (c_dialect_cxx () || !flag_iso) \ { \ builtin_define("_HPUX_SOURCE"); \ builtin_define("__STDCPP__"); \ builtin_define("_INCLUDE__STDC_A1_SOURCE"); \ } \ - if (TARGET_ILP32) \ - builtin_define("_ILP32"); \ } while (0) =20 #undef CPP_SPEC Index: gcc/config/rs6000/t-rs6000 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/rs6000/t-rs6000 (revision 166272) +++ gcc/config/rs6000/t-rs6000 (working copy) @@ -27,7 +27,7 @@ rs6000.o: $(CONFIG_H) $(SYSTEM_H) corety $(OBSTACK_H) $(TREE_H) $(EXPR_H) $(OPTABS_H) except.h function.h \ output.h $(BASIC_BLOCK_H) $(INTEGRATE_H) toplev.h $(GGC_H) $(HASHTAB_H) \ $(TM_P_H) $(TARGET_H) $(TARGET_DEF_H) langhooks.h reload.h gt-rs6000.h \ - cfglayout.h + cfglayout.h $(CPPLIB_H) cppbuiltin.h =20 rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.c \ $(srcdir)/config/rs6000/rs6000-protos.h \ Index: gcc/config/rs6000/rs6000-c.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/rs6000/rs6000-c.c (revision 166272) +++ gcc/config/rs6000/rs6000-c.c (working copy) @@ -82,7 +82,6 @@ rs6000_pragma_longcall (cpp_reader *pfil #define for, it's better to define a flag for everything. */ =20 #define builtin_define(TXT) cpp_define (pfile, TXT) -#define builtin_assert(TXT) cpp_assert (pfile, TXT) =20 /* Keep the AltiVec keywords handy for fast comparisons. */ static GTY(()) tree __vector_keyword; @@ -259,39 +258,10 @@ rs6000_macro_to_expand (cpp_reader *pfil } =20 void -rs6000_cpu_cpp_builtins (cpp_reader *pfile) +rs6000_cpu_cpp_builtins_cfamily (cpp_reader *pfile) { - if (TARGET_POWER2) - builtin_define ("_ARCH_PWR2"); - else if (TARGET_POWER) - builtin_define ("_ARCH_PWR"); - if (TARGET_POWERPC) - builtin_define ("_ARCH_PPC"); - if (TARGET_PPC_GPOPT) - builtin_define ("_ARCH_PPCSQ"); - if (TARGET_PPC_GFXOPT) - builtin_define ("_ARCH_PPCGR"); - if (TARGET_POWERPC64) - builtin_define ("_ARCH_PPC64"); - if (TARGET_MFCRF) - builtin_define ("_ARCH_PWR4"); - if (TARGET_POPCNTB) - builtin_define ("_ARCH_PWR5"); - if (TARGET_FPRND) - builtin_define ("_ARCH_PWR5X"); - if (TARGET_CMPB) - builtin_define ("_ARCH_PWR6"); - if (TARGET_MFPGPR) - builtin_define ("_ARCH_PWR6X"); - if (! TARGET_POWER && ! TARGET_POWER2 && ! TARGET_POWERPC) - builtin_define ("_ARCH_COM"); - if (TARGET_POPCNTD) - builtin_define ("_ARCH_PWR7"); if (TARGET_ALTIVEC) { - builtin_define ("__ALTIVEC__"); - builtin_define ("__VEC__=3D10206"); - /* Define the AltiVec syntactic elements. */ builtin_define ("__vector=3D__attribute__((altivec(vector__)))"); builtin_define ("__pixel=3D__attribute__((altivec(pixel__))) unsigne= d short"); @@ -312,27 +282,8 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfi cpp_get_callbacks (pfile)->macro_to_expand =3D rs6000_macro_to_expand; } } - if (rs6000_cpu =3D=3D PROCESSOR_CELL) - builtin_define ("__PPU__"); - if (TARGET_SPE) - builtin_define ("__SPE__"); - if (TARGET_PAIRED_FLOAT) - builtin_define ("__PAIRED__"); - if (TARGET_SOFT_FLOAT) - builtin_define ("_SOFT_FLOAT"); - if ((!(TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE))) - ||(TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_DOUBLE_FLOAT)) - builtin_define ("_SOFT_DOUBLE"); - /* Used by lwarx/stwcx. errata work-around. */ - if (rs6000_cpu =3D=3D PROCESSOR_PPC405) - builtin_define ("__PPC405__"); - /* Used by libstdc++. */ - if (TARGET_NO_LWSYNC) - builtin_define ("__NO_LWSYNC__"); if (TARGET_VSX) { - builtin_define ("__VSX__"); - /* For the VSX builtin functions identical to Altivec functions, jus= t map the altivec builtin into the vsx version (the altivec functions generate VSX code if -mvsx). */ @@ -363,68 +314,6 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfi builtin_define ("__builtin_vsx_xvnmsubasp=3D__builtin_vsx_xvnmsubsp"= ); builtin_define ("__builtin_vsx_xvnmsubmsp=3D__builtin_vsx_xvnmsubsp"= ); } - if (RS6000_RECIP_HAVE_RE_P (DFmode)) - builtin_define ("__RECIP__"); - if (RS6000_RECIP_HAVE_RE_P (SFmode)) - builtin_define ("__RECIPF__"); - if (RS6000_RECIP_HAVE_RSQRTE_P (DFmode)) - builtin_define ("__RSQRTE__"); - if (RS6000_RECIP_HAVE_RSQRTE_P (SFmode)) - builtin_define ("__RSQRTEF__"); - if (TARGET_RECIP_PRECISION) - builtin_define ("__RECIP_PRECISION__"); - - /* Tell users they can use __builtin_bswap{16,64}. */ - builtin_define ("__HAVE_BSWAP__"); - - /* May be overridden by target configuration. */ - RS6000_CPU_CPP_ENDIAN_BUILTINS(); - - if (TARGET_LONG_DOUBLE_128) - { - builtin_define ("__LONG_DOUBLE_128__"); - builtin_define ("__LONGDOUBLE128"); - } - - switch (rs6000_current_abi) - { - case ABI_V4: - builtin_define ("_CALL_SYSV"); - break; - case ABI_AIX: - builtin_define ("_CALL_AIXDESC"); - builtin_define ("_CALL_AIX"); - break; - case ABI_DARWIN: - builtin_define ("_CALL_DARWIN"); - break; - default: - break; - } - - /* Let the compiled code know if 'f' class registers will not be availab= le. */ - if (TARGET_SOFT_FLOAT || !TARGET_FPRS) - builtin_define ("__NO_FPRS__"); - - /* Generate defines for Xilinx FPU. */ - if (rs6000_xilinx_fpu)=20 - { - builtin_define ("_XFPU"); - if (rs6000_single_float && ! rs6000_double_float) - { - if (rs6000_simple_fpu)=20 - builtin_define ("_XFPU_SP_LITE");=20 - else=20 - builtin_define ("_XFPU_SP_FULL"); - } - if (rs6000_double_float) - { - if (rs6000_simple_fpu)=20 - builtin_define ("_XFPU_DP_LITE"); - else - builtin_define ("_XFPU_DP_FULL"); - } - } } =20 =0C Index: gcc/config/rs6000/darwin.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/rs6000/darwin.h (revision 166272) +++ gcc/config/rs6000/darwin.h (working copy) @@ -65,6 +65,13 @@ } \ while (0) =20 +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do \ + { \ + darwin_cpp_builtins_cfamily (pfile); \ + } \ + while (0) + /* Generate branch islands stubs if this is true. */ extern int darwin_emit_branch_islands; =20 Index: gcc/config/rs6000/rs6000.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/rs6000/rs6000.c (revision 166272) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -57,6 +57,8 @@ #include "intl.h" #include "params.h" #include "tm-constrs.h" +#include "cpplib.h" +#include "cppbuiltin.h" #if TARGET_XCOFF #include "xcoffout.h" /* get declarations of xcoff_*_section_name */ #endif @@ -27260,4 +27262,124 @@ rs6000_expand_convert_si_to_sfdf (rtx de } } =20 +#define builtin_define(TXT) cpp_define (pfile, TXT) +#define builtin_assert(TXT) cpp_assert (pfile, TXT) + +void +rs6000_cpu_cpp_builtins (cpp_reader *pfile) +{ + if (TARGET_POWER2) + builtin_define ("_ARCH_PWR2"); + else if (TARGET_POWER) + builtin_define ("_ARCH_PWR"); + if (TARGET_POWERPC) + builtin_define ("_ARCH_PPC"); + if (TARGET_PPC_GPOPT) + builtin_define ("_ARCH_PPCSQ"); + if (TARGET_PPC_GFXOPT) + builtin_define ("_ARCH_PPCGR"); + if (TARGET_POWERPC64) + builtin_define ("_ARCH_PPC64"); + if (TARGET_MFCRF) + builtin_define ("_ARCH_PWR4"); + if (TARGET_POPCNTB) + builtin_define ("_ARCH_PWR5"); + if (TARGET_FPRND) + builtin_define ("_ARCH_PWR5X"); + if (TARGET_CMPB) + builtin_define ("_ARCH_PWR6"); + if (TARGET_MFPGPR) + builtin_define ("_ARCH_PWR6X"); + if (! TARGET_POWER && ! TARGET_POWER2 && ! TARGET_POWERPC) + builtin_define ("_ARCH_COM"); + if (TARGET_POPCNTD) + builtin_define ("_ARCH_PWR7"); + if (TARGET_ALTIVEC) + { + builtin_define ("__ALTIVEC__"); + builtin_define ("__VEC__=3D10206"); + } + if (rs6000_cpu =3D=3D PROCESSOR_CELL) + builtin_define ("__PPU__"); + if (TARGET_SPE) + builtin_define ("__SPE__"); + if (TARGET_PAIRED_FLOAT) + builtin_define ("__PAIRED__"); + if (TARGET_SOFT_FLOAT) + builtin_define ("_SOFT_FLOAT"); + if ((!(TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE))) + ||(TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_DOUBLE_FLOAT)) + builtin_define ("_SOFT_DOUBLE"); + /* Used by lwarx/stwcx. errata work-around. */ + if (rs6000_cpu =3D=3D PROCESSOR_PPC405) + builtin_define ("__PPC405__"); + /* Used by libstdc++. */ + if (TARGET_NO_LWSYNC) + builtin_define ("__NO_LWSYNC__"); + if (TARGET_VSX) + builtin_define ("__VSX__"); + if (RS6000_RECIP_HAVE_RE_P (DFmode)) + builtin_define ("__RECIP__"); + if (RS6000_RECIP_HAVE_RE_P (SFmode)) + builtin_define ("__RECIPF__"); + if (RS6000_RECIP_HAVE_RSQRTE_P (DFmode)) + builtin_define ("__RSQRTE__"); + if (RS6000_RECIP_HAVE_RSQRTE_P (SFmode)) + builtin_define ("__RSQRTEF__"); + if (TARGET_RECIP_PRECISION) + builtin_define ("__RECIP_PRECISION__"); + + /* Tell users they can use __builtin_bswap{16,64}. */ + builtin_define ("__HAVE_BSWAP__"); + + /* May be overridden by target configuration. */ + RS6000_CPU_CPP_ENDIAN_BUILTINS(); + + if (TARGET_LONG_DOUBLE_128) + { + builtin_define ("__LONG_DOUBLE_128__"); + builtin_define ("__LONGDOUBLE128"); + } + + switch (rs6000_current_abi) + { + case ABI_V4: + builtin_define ("_CALL_SYSV"); + break; + case ABI_AIX: + builtin_define ("_CALL_AIXDESC"); + builtin_define ("_CALL_AIX"); + break; + case ABI_DARWIN: + builtin_define ("_CALL_DARWIN"); + break; + default: + break; + } + + /* Let the compiled code know if 'f' class registers will not be availab= le. */ + if (TARGET_SOFT_FLOAT || !TARGET_FPRS) + builtin_define ("__NO_FPRS__"); + + /* Generate defines for Xilinx FPU. */ + if (rs6000_xilinx_fpu)=20 + { + builtin_define ("_XFPU"); + if (rs6000_single_float && ! rs6000_double_float) + { + if (rs6000_simple_fpu)=20 + builtin_define ("_XFPU_SP_LITE");=20 + else=20 + builtin_define ("_XFPU_SP_FULL"); + } + if (rs6000_double_float) + { + if (rs6000_simple_fpu)=20 + builtin_define ("_XFPU_DP_LITE"); + else + builtin_define ("_XFPU_DP_FULL"); + } + } +} + #include "gt-rs6000.h" Index: gcc/config/rs6000/rs6000.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/rs6000/rs6000.h (revision 166272) +++ gcc/config/rs6000/rs6000.h (working copy) @@ -634,6 +634,8 @@ extern unsigned char rs6000_recip_bits[] /* Target #defines. */ #define TARGET_CPU_CPP_BUILTINS() \ rs6000_cpu_cpp_builtins (pfile) +#define TARGET_CPU_CPP_BUILTINS_CFAMILY() \ + rs6000_cpu_cpp_builtins_cfamily (pfile) =20 /* This is used by rs6000_cpu_cpp_builtins to indicate the byte order we're compiling for. Some configurations may need to override it. */ Index: gcc/config/darwin.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/darwin.c (revision 166272) +++ gcc/config/darwin.c (working copy) @@ -50,6 +50,8 @@ along with GCC; see the file COPYING3.=20=20 #include "debug.h" #include "obstack.h" #include "lto-streamer.h" +#include "cpplib.h" +#include "cppbuiltin.h" =20 /* Darwin supports a feature called fix-and-continue, which is used for rapid turn around debugging. When code is compiled with the @@ -2017,6 +2019,49 @@ darwin_override_options (void) darwin_running_cxx =3D (strstr (lang_hooks.name, "C++") !=3D 0); } =20 +/* Return the value of darwin_macosx_version_min suitable for the + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, + so '10.4.2' becomes 1040. The lowest digit is always zero. + Print a warning if the version number can't be understood. */ +static const char * +version_as_macro (void) +{ + static char result[] =3D "1000"; + + if (strncmp (darwin_macosx_version_min, "10.", 3) !=3D 0) + goto fail; + if (! ISDIGIT (darwin_macosx_version_min[3])) + goto fail; + result[2] =3D darwin_macosx_version_min[3]; + if (darwin_macosx_version_min[4] !=3D '\0' + && darwin_macosx_version_min[4] !=3D '.') + goto fail; + + return result; + + fail: + error ("Unknown value %qs of -mmacosx-version-min", + darwin_macosx_version_min); + return "1000"; +} + +/* Define additional CPP flags for Darwin. */ + +void +darwin_cpp_builtins (cpp_reader *pfile) +{ + cpp_define (pfile, "__MACH__"); + cpp_define (pfile, "__APPLE__"); + + /* __APPLE_CC__ is defined as some old Apple include files expect it + to be defined and won't work if it isn't. */ + cpp_define (pfile, "__APPLE_CC__=3D1"); + + cpp_define_formatted (pfile, + "__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=3D%s", + version_as_macro()); +} + /* Add $LDBL128 suffix to long double builtins. */ =20 static void Index: gcc/config/darwin.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/darwin.h (revision 166272) +++ gcc/config/darwin.h (working copy) @@ -222,7 +222,7 @@ extern GTY(()) int darwin_ms_struct; } while (0) =20 /* Machine dependent cpp options. Don't add more options here, add - them to darwin_cpp_builtins in darwin-c.c. */ + them to darwin_cpp_builtins in darwin.c. */ =20 #undef CPP_SPEC #define CPP_SPEC "%{static:%{!dynamic:-D__STATIC__}}%{!static:-D__DYNAMIC_= _}" \ Index: gcc/config/pa/pa-hpux.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/pa/pa-hpux.h (revision 166272) +++ gcc/config/pa/pa-hpux.h (working copy) @@ -57,6 +57,21 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("__unix"); \ builtin_define ("__unix__"); \ builtin_define ("__STDC_EXT__"); \ + if (TARGET_SIO) \ + builtin_define ("_SIO"); \ + else \ + { \ + builtin_define ("__hp9000s700"); \ + builtin_define ("__hp9000s700__"); \ + builtin_define ("_WSIO"); \ + } \ + } \ + while (0) + +#undef TARGET_OS_CPP_BUILTINS_CFAMILY +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do \ + { \ if (c_dialect_cxx ()) \ { \ builtin_define ("_HPUX_SOURCE"); \ @@ -77,14 +92,6 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("PWB"); \ } \ } \ - if (TARGET_SIO) \ - builtin_define ("_SIO"); \ - else \ - { \ - builtin_define ("__hp9000s700"); \ - builtin_define ("__hp9000s700__"); \ - builtin_define ("_WSIO"); \ - } \ } \ while (0) =20 Index: gcc/config/pa/pa-hpux10.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/pa/pa-hpux10.h (revision 166272) +++ gcc/config/pa/pa-hpux10.h (working copy) @@ -39,6 +39,26 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("__unix"); \ builtin_define ("__unix__"); \ builtin_define ("__STDC_EXT__"); \ + if (flag_pa_unix >=3D 1995) \ + { \ + builtin_define ("_XOPEN_UNIX"); \ + builtin_define ("_XOPEN_SOURCE_EXTENDED"); \ + } \ + if (TARGET_SIO) \ + builtin_define ("_SIO"); \ + else \ + { \ + builtin_define ("__hp9000s700"); \ + builtin_define ("__hp9000s700__"); \ + builtin_define ("_WSIO"); \ + } \ + } \ + while (0) + +#undef TARGET_OS_CPP_BUILTINS_CFAMILY +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do \ + { \ if (c_dialect_cxx ()) \ { \ builtin_define ("_HPUX_SOURCE"); \ @@ -59,19 +79,6 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("PWB"); \ } \ } \ - if (flag_pa_unix >=3D 1995) \ - { \ - builtin_define ("_XOPEN_UNIX"); \ - builtin_define ("_XOPEN_SOURCE_EXTENDED"); \ - } \ - if (TARGET_SIO) \ - builtin_define ("_SIO"); \ - else \ - { \ - builtin_define ("__hp9000s700"); \ - builtin_define ("__hp9000s700__"); \ - builtin_define ("_WSIO"); \ - } \ } \ while (0) =20 Index: gcc/config/pa/pa-hpux11.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/pa/pa-hpux11.h (revision 166272) +++ gcc/config/pa/pa-hpux11.h (working copy) @@ -38,6 +38,23 @@ along with GCC; see the file COPYING3.=20=20 builtin_define ("__unix"); \ builtin_define ("__unix__"); \ builtin_define ("__STDC_EXT__"); \ + if (!TARGET_64BIT) \ + builtin_define ("_ILP32"); \ + if (TARGET_SIO) \ + builtin_define ("_SIO"); \ + else \ + { \ + builtin_define ("__hp9000s700"); \ + builtin_define ("__hp9000s700__"); \ + builtin_define ("_WSIO"); \ + } \ + } \ + while (0) + +#undef TARGET_OS_CPP_BUILTINS_CFAMILY +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do \ + { \ if (c_dialect_cxx ()) \ { \ builtin_define ("_HPUX_SOURCE"); \ @@ -61,8 +78,6 @@ along with GCC; see the file COPYING3.=20=20 } \ } \ } \ - if (!TARGET_64BIT) \ - builtin_define ("_ILP32"); \ if (flag_pa_unix >=3D 1995 && !flag_iso) \ { \ builtin_define ("_XOPEN_UNIX"); \ @@ -82,14 +97,6 @@ along with GCC; see the file COPYING3.=20=20 warning (0, "-munix=3D98 option required for C89 " \ "Amendment 1 features.\n"); \ } \ - if (TARGET_SIO) \ - builtin_define ("_SIO"); \ - else \ - { \ - builtin_define ("__hp9000s700"); \ - builtin_define ("__hp9000s700__"); \ - builtin_define ("_WSIO"); \ - } \ } \ while (0) =20 Index: gcc/config/pa/pa.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/pa/pa.h (revision 166272) +++ gcc/config/pa/pa.h (working copy) @@ -202,8 +202,6 @@ do { \ builtin_define_std ("hp800"); \ builtin_define_std ("hp9000"); \ builtin_define_std ("hp9k8"); \ - if (!c_dialect_cxx () && !flag_iso) \ - builtin_define ("hppa"); \ builtin_define_std ("spectrum"); \ builtin_define_std ("unix"); \ builtin_assert ("system=3Dbsd"); \ @@ -211,6 +209,14 @@ do { \ } \ while (0) =20 +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do \ + { \ + if (!c_dialect_cxx () && !flag_iso) \ + builtin_define ("hppa"); \ + } \ + while (0) + #define CC1_SPEC "%{pg:} %{p:}" =20 #define LINK_SPEC "%{mlinker-opt:-O} %{!shared:-u main} %{shared:-b}" Index: gcc/config/mips/linux.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/mips/linux.h (revision 166272) +++ gcc/config/mips/linux.h (working copy) @@ -44,6 +44,10 @@ along with GCC; see the file COPYING3.=20=20 #define TARGET_OS_CPP_BUILTINS() \ do { \ LINUX_TARGET_OS_CPP_BUILTINS(); \ + } while (0) + +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do { \ /* The GNU C++ standard library requires this. */ \ if (c_dialect_cxx ()) \ builtin_define ("_GNU_SOURCE"); \ Index: gcc/config/mips/iris6.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/mips/iris6.h (revision 166272) +++ gcc/config/mips/iris6.h (working copy) @@ -171,7 +171,12 @@ along with GCC; see the file COPYING3.=20=20 An alternative would be to support the SGI builtin \ type __long_long. */ \ builtin_define ("_LONGLONG"); \ - \ + } \ + while (0) + +#define TARGET_OS_CPP_BUILTINS_CFAMILY() \ + do \ + { \ /* IRIX 6.5.18 and above provide many ISO C99 \ features protected by the __c99 macro. \ libstdc++ v3 needs them as well. */ \ Index: gcc/config/mips/mips.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config/mips/mips.h (revision 166272) +++ gcc/config/mips/mips.h (working copy) @@ -320,14 +320,15 @@ enum mips_code_readable_setting { #define MIPS_CPP_SET_PROCESSOR(PREFIX, INFO) \ do \ { \ - char *macro, *p; \ + char *macro, *p, *s; \ \ macro =3D concat ((PREFIX), "_", (INFO)->name, NULL); \ for (p =3D macro; *p !=3D 0; p++) \ *p =3D TOUPPER (*p); \ \ builtin_define (macro); \ - builtin_define_with_value ((PREFIX), (INFO)->name, 1); \ + s =3D concat ((PREFIX), "=3D\"", (INFO)->name, "\"", NULL); \ + builtin_define (s); \ free (macro); \ } \ while (0) @@ -344,16 +345,6 @@ enum mips_code_readable_setting { builtin_define ("__mips__"); \ builtin_define ("_mips"); \ \ - /* We do this here because __mips is defined below and so we \ - can't use builtin_define_std. We don't ever want to define \ - "mips" for VxWorks because some of the VxWorks headers \ - construct include filenames from a root directory macro, \ - an architecture macro and a filename, where the architecture \ - macro expands to 'mips'. If we define 'mips' to 1, the \ - architecture macro expands to 1 as well. */ \ - if (!flag_iso && !TARGET_VXWORKS) \ - builtin_define ("mips"); \ - \ if (TARGET_64BIT) \ builtin_define ("__mips64"); \ \ @@ -515,6 +506,27 @@ enum mips_code_readable_setting { if (TARGET_OCTEON) \ builtin_define ("__OCTEON__"); \ \ + if (mips_abi =3D=3D ABI_EABI) \ + builtin_define ("__mips_eabi"); \ + \ + if (TARGET_CACHE_BUILTIN) \ + builtin_define ("__GCC_HAVE_BUILTIN_MIPS_CACHE"); \ + } \ + while (0) + +#define TARGET_CPU_CPP_BUILTINS_CFAMILY() \ + do \ + { \ + /* We do this here because __mips is already defined and so we \ + can't use builtin_define_std. We don't ever want to define \ + "mips" for VxWorks because some of the VxWorks headers \ + construct include filenames from a root directory macro, \ + an architecture macro and a filename, where the architecture \ + macro expands to 'mips'. If we define 'mips' to 1, the \ + architecture macro expands to 1 as well. */ \ + if (!flag_iso && !TARGET_VXWORKS) \ + builtin_define ("mips"); \ + \ /* Macros dependent on the C dialect. */ \ if (preprocessing_asm_p ()) \ { \ @@ -540,12 +552,6 @@ enum mips_code_readable_setting { builtin_define_std ("LANGUAGE_C"); \ builtin_define ("_LANGUAGE_C"); \ } \ - \ - if (mips_abi =3D=3D ABI_EABI) \ - builtin_define ("__mips_eabi"); \ - \ - if (TARGET_CACHE_BUILTIN) \ - builtin_define ("__GCC_HAVE_BUILTIN_MIPS_CACHE"); \ } \ while (0) =20 Index: gcc/config.gcc =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/config.gcc (revision 166272) +++ gcc/config.gcc (working copy) @@ -289,8 +289,6 @@ arm*-*-*) ;; avr-*-*) cpu_type=3Davr - c_target_objs=3D"avr-c.o" - cxx_target_objs=3D"avr-c.o" ;; bfin*-*) cpu_type=3Dbfin --Apple-Mail-33--872722161 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Content-length: 20 OK to commit? --Apple-Mail-33--872722161--