2006-02-28 Jan Beulich <jbeulich@novell.com>
PR/1070
* macro.c (getstring): Don't treat parentheses special anymore.
(get_any_string): Don't consider '(' and ')' as quoting anymore.
Special-case '(', ')', '[', and ']' when dealing with non-quoting
characters.
gas/testsuite/
2006-02-28 Jan Beulich <jbeulich@novell.com>
* gas/macros/paren[sd]: New.
* gas/macros/macros.exp: Run new test.
+2006-02-28 Jan Beulich <jbeulich@novell.com>
+
+ PR/1070
+ * macro.c (getstring): Don't treat parentheses special anymore.
+ (get_any_string): Don't consider '(' and ')' as quoting anymore.
+ Special-case '(', ')', '[', and ']' when dealing with non-quoting
+ characters.
+
2006-02-28 Mat <mat@csail.mit.edu>
* dwarf2dbg.c (get_filenum): Don't inadvertently decrease files_in_use.
2006-02-28 Mat <mat@csail.mit.edu>
* dwarf2dbg.c (get_filenum): Don't inadvertently decrease files_in_use.
{
while (idx < in->len
&& (in->ptr[idx] == '"'
{
while (idx < in->len
&& (in->ptr[idx] == '"'
|| (in->ptr[idx] == '<' && (macro_alternate || macro_mri))
|| (in->ptr[idx] == '\'' && macro_alternate)))
{
if (in->ptr[idx] == '<')
{
int nest = 0;
|| (in->ptr[idx] == '<' && (macro_alternate || macro_mri))
|| (in->ptr[idx] == '\'' && macro_alternate)))
{
if (in->ptr[idx] == '<')
{
int nest = 0;
- char start_char = '>';
- char end_char = '>';
-
- while ((in->ptr[idx] != end_char || nest)
+ while ((in->ptr[idx] != '>' || nest)
&& idx < in->len)
{
if (in->ptr[idx] == '!')
&& idx < in->len)
{
if (in->ptr[idx] == '!')
- if (in->ptr[idx] == end_char)
+ if (in->ptr[idx] == '>')
- if (in->ptr[idx] == start_char)
+ if (in->ptr[idx] == '<')
nest++;
sb_add_char (acc, in->ptr[idx++]);
}
}
idx++;
}
nest++;
sb_add_char (acc, in->ptr[idx++]);
}
}
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];
else if (in->ptr[idx] == '"' || in->ptr[idx] == '\'')
{
char tchar = in->ptr[idx];
sb_add_string (out, buf);
}
else if (in->ptr[idx] == '"'
sb_add_string (out, buf);
}
else if (in->ptr[idx] == '"'
|| (in->ptr[idx] == '<' && (macro_alternate || macro_mri))
|| (macro_alternate && in->ptr[idx] == '\''))
{
|| (in->ptr[idx] == '<' && (macro_alternate || macro_mri))
|| (macro_alternate && in->ptr[idx] == '\''))
{
+ char *br_buf = xmalloc(1);
+ char *in_br = br_buf;
+
+ *in_br = '\0';
- && in->ptr[idx] != ' '
- && in->ptr[idx] != '\t'
+ && (*in_br
+ || (in->ptr[idx] != ' '
+ && in->ptr[idx] != '\t'))
&& in->ptr[idx] != ','
&& (in->ptr[idx] != '<'
|| (! macro_alternate && ! macro_mri)))
{
&& in->ptr[idx] != ','
&& (in->ptr[idx] != '<'
|| (! macro_alternate && ! macro_mri)))
{
- if (in->ptr[idx] == '"'
- || in->ptr[idx] == '\'')
- {
- char tchar = in->ptr[idx];
+ char tchar = in->ptr[idx];
+ switch (tchar)
+ {
+ case '"':
+ case '\'':
sb_add_char (out, in->ptr[idx++]);
while (idx < in->len
&& in->ptr[idx] != tchar)
sb_add_char (out, in->ptr[idx++]);
if (idx == in->len)
return idx;
sb_add_char (out, in->ptr[idx++]);
while (idx < in->len
&& in->ptr[idx] != tchar)
sb_add_char (out, in->ptr[idx++]);
if (idx == in->len)
return idx;
+ break;
+ case '(':
+ case '[':
+ if (in_br > br_buf)
+ --in_br;
+ else
+ {
+ br_buf = xmalloc(strlen(in_br) + 2);
+ strcpy(br_buf + 1, in_br);
+ free(in_br);
+ in_br = br_buf;
+ }
+ *in_br = tchar;
+ break;
+ case ')':
+ if (*in_br == '(')
+ ++in_br;
+ break;
+ case ']':
+ if (*in_br == '[')
+ ++in_br;
+ break;
- sb_add_char (out, in->ptr[idx++]);
+ sb_add_char (out, tchar);
+ ++idx;
+2006-02-28 Jan Beulich <jbeulich@novell.com>
+
+ * gas/macros/paren[sd]: New.
+ * gas/macros/macros.exp: Run new test.
+
2006-02-27 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/i386.exp: Add merom and x86-64-merom.
2006-02-27 H.J. Lu <hongjiu.lu@intel.com>
* gas/i386/i386.exp: Add merom and x86-64-merom.
run_list_test end ""
run_list_test purge "--hash-size=8000"
run_list_test redef ""
run_list_test end ""
run_list_test purge "--hash-size=8000"
run_list_test redef ""
+
+# This test is valid only when '!' is not a comment character
+# (it is allowed to be a line comment character).
+if [string match "" [lindex [gas_run ../all/excl.s "-o /dev/null" ""] 0]] {
+ run_dump_test paren
+}
--- /dev/null
+#as: -f
+#objdump: -s -j .data
+#name parenthesized macro arguments
+
+.*: .*
+
+Contents of section .data:
+ 0000 01000202 020402.. ........ ........ ................
+#pass
--- /dev/null
+ .data
+ .macro m x
+ .byte (\x)
+ .endm
+
+ m (1)
+ m (!1)
+ m (1)+(1)
+ m 1+(1)
+ m (1 + 1)
+ m (1 + 1)*(1 + 1)
+ m (! 0)+(! 0)