gcc.c (do_spec_1): Do not insert a space after a %* substitution unless...
* gcc.c (do_spec_1): Do not insert a space after a %* substitution unless it is the last part of a spec substring. * doc/invoke.texi (Spec Files): Document space insertion behaviour of %*. From-SVN: r204446
This commit is contained in:
parent
3a1a7897b7
commit
2599016338
@ -1,3 +1,10 @@
|
||||
2013-11-06 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* gcc.c (do_spec_1): Do not insert a space after a %* substitution
|
||||
unless it is the last part of a spec substring.
|
||||
* doc/invoke.texi (Spec Files): Document space insertion
|
||||
behaviour of %*.
|
||||
|
||||
2013-11-06 Christian Bruel <christian.bruel@st.com>
|
||||
|
||||
* gcc/config/sh/sh-mem.cc (sh_expand_cmpnstr, sh_expand_cmpstr):
|
||||
|
@ -10874,6 +10874,22 @@ appears somewhere in @code{X}, then @code{X} is substituted once
|
||||
for each matching switch, with the @code{%*} replaced by the part of
|
||||
that switch matching the @code{*}.
|
||||
|
||||
If @code{%*} appears as the last part of a spec sequence then a space
|
||||
will be added after the end of the last substitution. If there is more
|
||||
text in the sequence however then a space will not be generated. This
|
||||
allows the @code{%*} substitution to be used as part of a larger
|
||||
string. For example, a spec string like this:
|
||||
|
||||
@smallexample
|
||||
%@{mcu=*:--script=%*/memory.ld@}
|
||||
@end smallexample
|
||||
|
||||
when matching an option like @code{-mcu=newchip} will produce:
|
||||
|
||||
@smallexample
|
||||
--script=newchip/memory.ld
|
||||
@end smallexample
|
||||
|
||||
@item %@{.@code{S}:@code{X}@}
|
||||
Substitutes @code{X}, if processing a file with suffix @code{S}.
|
||||
|
||||
@ -17791,10 +17807,6 @@ These options are defined for the MSP430:
|
||||
|
||||
@table @gcctabopt
|
||||
|
||||
@item -msim
|
||||
@opindex msim
|
||||
Link the simulator runtime libraries.
|
||||
|
||||
@item -masm-hex
|
||||
@opindex masm-hex
|
||||
Force assembly output to always use hex constants. Normally such
|
||||
@ -17803,9 +17815,25 @@ testsuite and/or aesthetic purposes.
|
||||
|
||||
@item -mmcu=
|
||||
@opindex mmcu=
|
||||
Select the MCU to target. Note that there are two ``generic'' MCUs,
|
||||
@code{msp430} and @code{msp430x}, which should be used most of the
|
||||
time. This option is also passed to the assembler.
|
||||
Select the MCU to target. If the MCU supports the MSP430X ISA or the
|
||||
MSP430Xv2 ISA then gcc will make use of the extra instructions. A C
|
||||
preprocessor symbol will be defined based upon the MCU name, converted
|
||||
to upper case and pre- and post- fixed with @code{__}.
|
||||
|
||||
In addition two scripts will be added to the linker command line:
|
||||
@code{memory.ld} and @code{peripherals.ld}, with a search path based
|
||||
upon the MCU name.
|
||||
|
||||
Note that there are three ``generic'' MCUs: @code{msp430},
|
||||
@code{msp430x} and @code{msp430xv2}, which can be used if a specific
|
||||
MCU is not being targeted.
|
||||
|
||||
This option is also passed on to the assembler.
|
||||
|
||||
@item -msim
|
||||
@opindex msim
|
||||
Link to the simulator runtime libraries and linker script. Overrides
|
||||
any scripts that would be selected by the @option{-mmcu=} option.
|
||||
|
||||
@item -mlarge
|
||||
@opindex mlarge
|
||||
|
19
gcc/gcc.c
19
gcc/gcc.c
@ -388,7 +388,8 @@ or with constant text in a single argument.
|
||||
%2 process CC1PLUS_SPEC as a spec.
|
||||
%* substitute the variable part of a matched option. (See below.)
|
||||
Note that each comma in the substituted string is replaced by
|
||||
a single space.
|
||||
a single space. A space is appended after the last substition
|
||||
unless there is more text in current sequence.
|
||||
%<S remove all occurrences of -S from the command line.
|
||||
Note - this command is position dependent. % commands in the
|
||||
spec string before this one will see -S, % commands in the
|
||||
@ -422,7 +423,9 @@ or with constant text in a single argument.
|
||||
once, no matter how many such switches appeared. However,
|
||||
if %* appears somewhere in X, then X will be substituted
|
||||
once for each matching switch, with the %* replaced by the
|
||||
part of that switch that matched the '*'.
|
||||
part of that switch that matched the '*'. A space will be
|
||||
appended after the last substition unless there is more
|
||||
text in current sequence.
|
||||
%{.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.
|
||||
@ -5352,7 +5355,17 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
|
||||
{
|
||||
if (soft_matched_part[0])
|
||||
do_spec_1 (soft_matched_part, 1, NULL);
|
||||
do_spec_1 (" ", 0, NULL);
|
||||
/* Only insert a space after the substitution if it is at the
|
||||
end of the current sequence. So if:
|
||||
|
||||
"%{foo=*:bar%*}%{foo=*:one%*two}"
|
||||
|
||||
matches -foo=hello then it will produce:
|
||||
|
||||
barhello onehellotwo
|
||||
*/
|
||||
if (*p == 0 || *p == '}')
|
||||
do_spec_1 (" ", 0, NULL);
|
||||
}
|
||||
else
|
||||
/* Catch the case where a spec string contains something like
|
||||
|
Loading…
Reference in New Issue
Block a user