From: Nick Clifton Date: Tue, 9 Aug 2005 15:47:46 +0000 (+0000) Subject: PR 1070 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2f6178c175ba113600c532b8fc84e8d54beddb78;p=binutils-gdb.git PR 1070 * macro.c (getstring): Do not treat round parentheses exactly the same as angle brackets - the parentheses need to be preserved and passed on to the macro processing code. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 91756562276..83f90af5b52 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2005-08-09 Nick Clifton + + PR 1070 + * macro.c (getstring): Do not treat round parentheses exactly the + same as angle brackets - the parentheses need to be preserved and + passed on to the macro processing code. + 2005-08-08 Nick Clifton * config/tc-msp430.c (MSP430_ISA_21): Define. diff --git a/gas/macro.c b/gas/macro.c index fbe266612c3..eab3e66bbe6 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -310,12 +310,11 @@ getstring (int idx, sb *in, sb *acc) || (in->ptr[idx] == '<' && (macro_alternate || macro_mri)) || (in->ptr[idx] == '\'' && macro_alternate))) { - if (in->ptr[idx] == '<' - || in->ptr[idx] == '(') + if (in->ptr[idx] == '<') { int nest = 0; - char start_char = in->ptr[idx]; - char end_char = in->ptr[idx] == '<' ? '>' : ')'; + char start_char = '>'; + char end_char = '>'; idx++; while ((in->ptr[idx] != end_char || nest) @@ -337,6 +336,28 @@ getstring (int idx, sb *in, sb *acc) } idx++; } + else if (in->ptr[idx] == '(') + { + int nest = 0; + char c; + + do + { + c = in->ptr[idx]; + + if (c == '!') + c = in->ptr[++idx]; + else if (c == ')') + nest--; + else if (c == '(') + nest++; + + sb_add_char (acc, c); + idx++; + } + while ((c != ')' || nest) + && idx < in->len); + } else if (in->ptr[idx] == '"' || in->ptr[idx] == '\'') { char tchar = in->ptr[idx]; @@ -389,7 +410,7 @@ getstring (int idx, sb *in, sb *acc) 'Bxyx -> return 'Bxyza % -> return string of decimal value of "string" -> return string - (string) -> return string + (string) -> return (string-including-whitespaces) xyx -> return xyz. */ static int