PR gas/5895
authorNick Clifton <nickc@redhat.com>
Thu, 13 Mar 2008 10:51:33 +0000 (10:51 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 13 Mar 2008 10:51:33 +0000 (10:51 +0000)
   * read.c (s_mexit): Warn if attempting to exit a macro when not
   inside a macro definition.

   * gas/macros/exit.s: New test case.
   * gas/macros/macros.exp: Run the new test, expect it to produce an
   error result.

gas/ChangeLog
gas/read.c
gas/testsuite/ChangeLog
gas/testsuite/gas/macros/exit.s [new file with mode: 0644]
gas/testsuite/gas/macros/macros.exp

index d15b8b9edf233f75a81b1f8a17cd99eec0352629..4e9ec9a29242f35679f03fb43702892f779b0a5e 100644 (file)
@@ -1,3 +1,9 @@
+2008-03-13  Evandro Menezes  <evandro@yahoo.com>
+
+       PR gas/5895
+       * read.c (s_mexit): Warn if attempting to exit a macro when not
+       inside a macro definition.
+
 2008-03-13  Alan Modra  <amodra@bigpond.net.au>
 
        * Makefile.am: Run "make dep-am".
index 8163c5ababb1af2623235adae18be12fde2ec601..ec69c4e7a90f84a6f01025f133e5e6dd432c2175 100644 (file)
@@ -2554,8 +2554,13 @@ s_macro (int ignore ATTRIBUTE_UNUSED)
 void
 s_mexit (int ignore ATTRIBUTE_UNUSED)
 {
-  cond_exit_macro (macro_nest);
-  buffer_limit = input_scrub_next_buffer (&input_line_pointer);
+  if (macro_nest)
+    {
+      cond_exit_macro (macro_nest);
+      buffer_limit = input_scrub_next_buffer (&input_line_pointer);
+    }
+  else
+    as_warn (_("ignoring macro exit outside a macro definition."));
 }
 
 /* Switch in and out of MRI mode.  */
index 8ebab2e651db8d2c3d32fb29c6964873a41e050e..951ecb57b4202d63056cd1d30718b48b0276bce7 100644 (file)
@@ -1,3 +1,10 @@
+2008-03-13  Nick Clifton  <nickc@redhat.com>
+
+       PR gas/5895
+       * gas/macros/exit.s: New test case.
+       * gas/macros/macros.exp: Run the new test, expect it to produce an
+       error result.
+
 2008-03-09  Paul Brook  <paul@codesourcery.com>
 
        * gas/arm/vfpv3-d16-bad.d: New test.
diff --git a/gas/testsuite/gas/macros/exit.s b/gas/testsuite/gas/macros/exit.s
new file mode 100644 (file)
index 0000000..502cff8
--- /dev/null
@@ -0,0 +1,8 @@
+
+.macro MAC
+       BAD_OP
+.endm
+
+.exitm
+
+       MAC
index 436923e53cc6d587434baf627cf4e67a126c7b20..f8d5c8012f4990a2c372481eff90b327848ebe3d 100644 (file)
@@ -77,3 +77,8 @@ run_list_test redef ""
 if [string match "" [lindex [gas_run ../all/excl.s "-o /dev/null" ""] 0]] {
     run_dump_test paren
 }
+
+# PR 58925: A .exitm pseudo-op outside of a macro definition
+#  prevented the assembler from parsing the rest of the file,
+#  and hence catching an erroroneous instruction.
+gas_test_error "exit.s" "" ".exitm outside of a macro"
This page took 0.027924 seconds and 4 git commands to generate.