diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ca30efc6fe..ea4a8d8b192 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,22 @@ +2007-03-09 Geoffrey Keating + + * gcc.c: Document %{, in big comment at top. + (input_suffix_matches): Remove special handling for .s and + .S. + (input_spec_matches): New. + (handle_braces): Handle %{,. + (validate_switches): ',' indicates a value which is not a switch. + * config/alpha/osf.h (ASM_FINAL_SPEC): Use %{, rather than %{. + to detect assembler input. + * config/i386/sol2.h (CPP_SPEC): Likewise. + * config/rs6000/sysv4.h (ASM_SPEC): Likewise. + * config/rs6000/vxworks.h (ASM_SPEC): Likewise. + * config/rs6000/lynx.h (ASM_SPEC): Likewise. + * config/rs6000/linux64.h (ASM_SPEC_COMMON): Likewise. + * config/i386/darwin.h (DARWIN_MINVERSION_SPEC): Objective-C plus + -m64 causes deployment target to default to 10.5. + * config/rs6000/darwin.h (DARWIN_MINVERSION_SPEC): Likewise. + 2007-03-09 Richard Henderson PR target/26090 diff --git a/gcc/config/alpha/osf.h b/gcc/config/alpha/osf.h index b62435aa6b7..f7aaf4d4606 100644 --- a/gcc/config/alpha/osf.h +++ b/gcc/config/alpha/osf.h @@ -121,7 +121,7 @@ Boston, MA 02110-1301, USA. */ %{K: -I %b.o~} \ %{!K: %{save-temps: -I %b.o~}} \ %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \ - %{.s:%i} %{!.s:%g.s}}}" + %{,assembler:%i;:%g.s}}}" #else #define ASM_FINAL_SPEC "\ @@ -130,7 +130,7 @@ Boston, MA 02110-1301, USA. */ %{K: -I %b.o~} \ %{!K: %{save-temps: -I %b.o~}} \ %{c:%W{o*}%{!o*:-o %b.o}}%{!c:-o %U.o} \ - %{.s:%i} %{!.s:%g.s}}}" + %{,assembler:%i;:%g.s}}}" #endif diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h index e507d59f6ec..15fbd88f5b6 100644 --- a/gcc/config/i386/darwin.h +++ b/gcc/config/i386/darwin.h @@ -84,7 +84,11 @@ Boston, MA 02110-1301, USA. */ #define DARWIN_SUBARCH_SPEC DARWIN_ARCH_SPEC /* Determine a minimum version based on compiler options. */ -#define DARWIN_MINVERSION_SPEC "10.4" +#define DARWIN_MINVERSION_SPEC \ + "%{!m64|fgnu-runtime:10.4; \ + ,objective-c|,objc-cpp-output:10.5; \ + ,objective-c++|,objective-c++-cpp-output:10.5; \ + :10.4} #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h index 7593071030e..8df92e3b29c 100644 --- a/gcc/config/i386/sol2.h +++ b/gcc/config/i386/sol2.h @@ -51,7 +51,7 @@ Boston, MA 02110-1301, USA. */ /* Solaris 2/Intel as chokes on #line directives. */ #undef CPP_SPEC -#define CPP_SPEC "%{.S:-P} %(cpp_subtarget)" +#define CPP_SPEC "%{,assembler-with-cpp:-P} %(cpp_subtarget)" /* FIXME: Removed -K PIC from generic Solaris 2 ASM_SPEC: the native assembler gives many warnings: R_386_32 relocation is used for symbol ".text". */ diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index 6aa7d65a40b..23e387b21fc 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -122,9 +122,12 @@ "%{!m64:%:version-compare(!> 10.4 mmacosx-version-min= crt2.o%s)}" /* Determine a minimum version based on compiler options. */ -#define DARWIN_MINVERSION_SPEC \ - "%{m64:10.4; \ - shared-libgcc:10.3; \ +#define DARWIN_MINVERSION_SPEC \ + "%{m64:%{fgnu-runtime:10.4; \ + ,objective-c|,objc-cpp-output:10.5; \ + ,objective-c++|,objective-c++-cpp-output:10.5; \ + :10.4}; \ + shared-libgcc:10.3; \ :10.1}" #undef SUBTARGET_EXTRA_SPECS diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 8937dcd7b72..00853fe34d7 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -165,7 +165,7 @@ extern int dot_symbols; #define ASM_SPEC64 "-a64" #define ASM_SPEC_COMMON "%(asm_cpu) \ -%{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \ +%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \ %{v:-V} %{Qy:} %{!Qn:-Qy} %{Wa,*:%*} \ %{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian}" diff --git a/gcc/config/rs6000/lynx.h b/gcc/config/rs6000/lynx.h index ab2d16f24ca..0dbd747aab5 100644 --- a/gcc/config/rs6000/lynx.h +++ b/gcc/config/rs6000/lynx.h @@ -54,8 +54,7 @@ #undef ASM_SPEC #define ASM_SPEC \ "%(asm_cpu) \ - %{.s: %{mregnames} %{mno-regnames}} \ - %{.S: %{mregnames} %{mno-regnames}}" + %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" #undef STARTFILE_SPEC #undef ENDFILE_SPEC diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 0b1eb1ebb4d..1aad6afe6d7 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -578,7 +578,7 @@ extern int fixuplabelno; /* Override svr4.h definition. */ #undef ASM_SPEC #define ASM_SPEC "%(asm_cpu) \ -%{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \ +%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \ %{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \ %{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \ %{memb|msdata|msdata=eabi: -memb} \ diff --git a/gcc/config/rs6000/vxworks.h b/gcc/config/rs6000/vxworks.h index f15369c7ab2..2bd7872f8c3 100644 --- a/gcc/config/rs6000/vxworks.h +++ b/gcc/config/rs6000/vxworks.h @@ -84,7 +84,7 @@ VXWORKS_ADDITIONAL_CPP_SPEC #define ASM_SPEC \ "%(asm_cpu) \ - %{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \ + %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \ %{v:-v} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \ %{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} -mbig" diff --git a/gcc/gcc.c b/gcc/gcc.c index 7a5056a5ba0..878f0441229 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -516,15 +516,18 @@ or with constant text in a single argument. part of that switch that matched the '*'. %{.S:X} substitutes X, if processing a file with suffix S. %{!.S:X} substitutes X, if NOT processing a file with suffix S. - + %{,S:X} substitutes X, if processing a file which will use spec S. + %{!,S:X} substitutes X, if NOT processing a file which will use spec S. + %{S|T:X} substitutes X if either -S or -T was given to CC. This may be - combined with !, ., and * as above binding stronger than the OR. + combined with '!', '.', ',', and '*' as above binding stronger + than the OR. If %* appears in X, all of the alternatives must be starred, and only the first matching alternative is substituted. %{S:X; if S was given to CC, substitutes X; T:Y; else if T was given to CC, substitutes Y; :D} else substitutes D. There can be as many clauses as you need. - This may be combined with ., !, |, and * as above. + This may be combined with '.', '!', ',', '|', and '*' as above. %(Spec) processes a specification defined in a specs file as *Spec: %[Spec] as above, but put __ around -D arguments @@ -5529,27 +5532,24 @@ handle_spec_function (const char *p) static inline bool input_suffix_matches (const char *atom, const char *end_atom) { - /* We special case the semantics of {.s:...} and {.S:...} and their - negative variants. Instead of testing the input filename suffix, - we test whether the input source file is an assembler file or an - assembler-with-cpp file respectively. This allows us to correctly - handle the -x command line option. */ - - if (atom + 1 == end_atom - && input_file_compiler - && input_file_compiler->suffix) - { - if (*atom == 's') - return !strcmp (input_file_compiler->suffix, "@assembler"); - if (*atom == 'S') - return !strcmp (input_file_compiler->suffix, "@assembler-with-cpp"); - } - return (input_suffix && !strncmp (input_suffix, atom, end_atom - atom) && input_suffix[end_atom - atom] == '\0'); } +/* Subroutine of handle_braces. Returns true if the current + input file's spec name matches the atom bracketed by ATOM and END_ATOM. */ +static bool +input_spec_matches (const char *atom, const char *end_atom) +{ + return (input_file_compiler + && input_file_compiler->suffix + && input_file_compiler->suffix[0] != '\0' + && !strncmp (input_file_compiler->suffix + 1, atom, + end_atom - atom) + && input_file_compiler->suffix[end_atom - atom + 1] == '\0'); +} + /* Subroutine of handle_braces. Returns true if a switch matching the atom bracketed by ATOM and END_ATOM appeared on the command line. */ @@ -5613,6 +5613,7 @@ handle_braces (const char *p) const char *orig = p; bool a_is_suffix; + bool a_is_spectype; bool a_is_starred; bool a_is_negated; bool a_matched; @@ -5633,8 +5634,12 @@ handle_braces (const char *p) goto invalid; /* Scan one "atom" (S in the description above of %{}, possibly - with !, ., or * modifiers). */ - a_matched = a_is_suffix = a_is_starred = a_is_negated = false; + with '!', '.', '@', ',', or '*' modifiers). */ + a_matched = false; + a_is_suffix = false; + a_is_starred = false; + a_is_negated = false; + a_is_spectype = false; SKIP_WHITE(); if (*p == '!') @@ -5643,6 +5648,8 @@ handle_braces (const char *p) SKIP_WHITE(); if (*p == '.') p++, a_is_suffix = true; + else if (*p == ',') + p++, a_is_spectype = true; atom = p; while (ISIDNUM(*p) || *p == '-' || *p == '+' || *p == '=' @@ -5660,7 +5667,7 @@ handle_braces (const char *p) /* Substitute the switch(es) indicated by the current atom. */ ordered_set = true; if (disjunct_set || n_way_choice || a_is_negated || a_is_suffix - || atom == end_atom) + || a_is_spectype || atom == end_atom) goto invalid; mark_matching_switches (atom, end_atom, a_is_starred); @@ -5679,7 +5686,8 @@ handle_braces (const char *p) if (atom == end_atom) { if (!n_way_choice || disj_matched || *p == '|' - || a_is_negated || a_is_suffix || a_is_starred) + || a_is_negated || a_is_suffix || a_is_spectype + || a_is_starred) goto invalid; /* An empty term may appear as the last choice of an @@ -5690,28 +5698,30 @@ handle_braces (const char *p) } else { - if (a_is_suffix && a_is_starred) - goto invalid; + if ((a_is_suffix || a_is_spectype) && a_is_starred) + goto invalid; + + if (!a_is_starred) + disj_starred = false; - if (!a_is_starred) - disj_starred = false; - - /* Don't bother testing this atom if we already have a - match. */ - if (!disj_matched && !n_way_matched) - { - if (a_is_suffix) - a_matched = input_suffix_matches (atom, end_atom); - else - a_matched = switch_matches (atom, end_atom, a_is_starred); - - if (a_matched != a_is_negated) - { - disj_matched = true; - d_atom = atom; - d_end_atom = end_atom; - } - } + /* Don't bother testing this atom if we already have a + match. */ + if (!disj_matched && !n_way_matched) + { + if (a_is_suffix) + a_matched = input_suffix_matches (atom, end_atom); + else if (a_is_spectype) + a_matched = input_spec_matches (atom, end_atom); + else + a_matched = switch_matches (atom, end_atom, a_is_starred); + + if (a_matched != a_is_negated) + { + disj_matched = true; + d_atom = atom; + d_end_atom = end_atom; + } + } } if (*p == ':') @@ -6940,7 +6950,7 @@ next_member: p++; SKIP_WHITE (); - if (*p == '.') + if (*p == '.' || *p == ',') suffix = true, p++; atom = p;