From 5b59fbfa6bc766dd28a669e443d1ec08b32aa454 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 13 Mar 2008 10:51:33 +0000 Subject: [PATCH] PR gas/5895 * 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 | 6 ++++++ gas/read.c | 9 +++++++-- gas/testsuite/ChangeLog | 7 +++++++ gas/testsuite/gas/macros/exit.s | 8 ++++++++ gas/testsuite/gas/macros/macros.exp | 5 +++++ 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 gas/testsuite/gas/macros/exit.s diff --git a/gas/ChangeLog b/gas/ChangeLog index d15b8b9ed..4e9ec9a29 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2008-03-13 Evandro Menezes + + 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 * Makefile.am: Run "make dep-am". diff --git a/gas/read.c b/gas/read.c index 8163c5aba..ec69c4e7a 100644 --- a/gas/read.c +++ b/gas/read.c @@ -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. */ diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 8ebab2e65..951ecb57b 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2008-03-13 Nick Clifton + + 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 * 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 index 000000000..502cff849 --- /dev/null +++ b/gas/testsuite/gas/macros/exit.s @@ -0,0 +1,8 @@ + +.macro MAC + BAD_OP +.endm + +.exitm + + MAC diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp index 436923e53..f8d5c8012 100644 --- a/gas/testsuite/gas/macros/macros.exp +++ b/gas/testsuite/gas/macros/macros.exp @@ -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" -- 2.11.4.GIT