* macro.c (getstring): Treat round parentheses in the same way as angle brackets.
(get_any_string): Likewise.
This commit is contained in:
Nick Clifton 2005-08-08 11:15:33 +00:00
parent 957c6e41da
commit df40eaf977
2 changed files with 23 additions and 8 deletions

View file

@ -1,3 +1,10 @@
2005-08-08 Nick Clifton <nickc@redhat.com>
PR 1070
* macro.c (getstring): Treat round parentheses in the same way as
angle brackets.
(get_any_string): Likewise.
2005-08-07 H.J. Lu <hongjiu.lu@intel.com> 2005-08-07 H.J. Lu <hongjiu.lu@intel.com>
PR gas/1118 PR gas/1118

View file

@ -306,14 +306,19 @@ getstring (int idx, sb *in, sb *acc)
{ {
while (idx < in->len while (idx < in->len
&& (in->ptr[idx] == '"' && (in->ptr[idx] == '"'
|| in->ptr[idx] == '('
|| (in->ptr[idx] == '<' && (macro_alternate || macro_mri)) || (in->ptr[idx] == '<' && (macro_alternate || macro_mri))
|| (in->ptr[idx] == '\'' && macro_alternate))) || (in->ptr[idx] == '\'' && macro_alternate)))
{ {
if (in->ptr[idx] == '<') if (in->ptr[idx] == '<'
|| in->ptr[idx] == '(')
{ {
int nest = 0; int nest = 0;
char start_char = in->ptr[idx];
char end_char = in->ptr[idx] == '<' ? '>' : ')';
idx++; idx++;
while ((in->ptr[idx] != '>' || nest) while ((in->ptr[idx] != end_char || nest)
&& idx < in->len) && idx < in->len)
{ {
if (in->ptr[idx] == '!') if (in->ptr[idx] == '!')
@ -323,9 +328,9 @@ getstring (int idx, sb *in, sb *acc)
} }
else else
{ {
if (in->ptr[idx] == '>') if (in->ptr[idx] == end_char)
nest--; nest--;
if (in->ptr[idx] == '<') if (in->ptr[idx] == start_char)
nest++; nest++;
sb_add_char (acc, in->ptr[idx++]); sb_add_char (acc, in->ptr[idx++]);
} }
@ -382,10 +387,10 @@ getstring (int idx, sb *in, sb *acc)
/* Fetch string from the input stream, /* Fetch string from the input stream,
rules: rules:
'Bxyx<whitespace> -> return 'Bxyza 'Bxyx<whitespace> -> return 'Bxyza
%<char> -> return string of decimal value of x %<expr> -> return string of decimal value of <expr>
"<string>" -> return string "string" -> return string
xyx<whitespace> -> return xyz (string) -> return string
*/ xyx<whitespace> -> return xyz. */
static int static int
get_any_string (int idx, sb *in, sb *out) get_any_string (int idx, sb *in, sb *out)
@ -404,6 +409,7 @@ get_any_string (int idx, sb *in, sb *out)
{ {
int val; int val;
char buf[20]; char buf[20];
/* Turns the next expression into a string. */ /* Turns the next expression into a string. */
/* xgettext: no-c-format */ /* xgettext: no-c-format */
idx = (*macro_expr) (_("% operator needs absolute expression"), idx = (*macro_expr) (_("% operator needs absolute expression"),
@ -414,6 +420,7 @@ get_any_string (int idx, sb *in, sb *out)
sb_add_string (out, buf); sb_add_string (out, buf);
} }
else if (in->ptr[idx] == '"' else if (in->ptr[idx] == '"'
|| in->ptr[idx] == '('
|| (in->ptr[idx] == '<' && (macro_alternate || macro_mri)) || (in->ptr[idx] == '<' && (macro_alternate || macro_mri))
|| (macro_alternate && in->ptr[idx] == '\'')) || (macro_alternate && in->ptr[idx] == '\''))
{ {
@ -443,6 +450,7 @@ get_any_string (int idx, sb *in, sb *out)
|| in->ptr[idx] == '\'') || in->ptr[idx] == '\'')
{ {
char tchar = in->ptr[idx]; char tchar = in->ptr[idx];
sb_add_char (out, in->ptr[idx++]); sb_add_char (out, in->ptr[idx++]);
while (idx < in->len while (idx < in->len
&& in->ptr[idx] != tchar) && in->ptr[idx] != tchar)