From 02ddf1568180e41117d6d2804636e64775ac37b6 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Mon, 25 Apr 2005 06:43:46 +0000 Subject: gas/ 2005-04-25 Jan Beulich * macro.c (macro_expand_body): Replace locals indicator parameters with actual macro_entry. New local variables macro_line and err. Don't return when encountering an error, just record the fact. Detect local symbol name colliding with parameter. Track line number inside of macro expansion. (do_formals): Move local variable name to wider scope. Check parameter of the same name doesn't already exist. In MRI mode, also check it doesn't collide with the argument count pseudo-parameter). (define_macro): Add file and line number parameters. Remove local variable namestr. New local variable error. Initialize macro_entry members file, line, and name. Don't return when encountering an error, just record the fact. Use %s in some diagnostics for read.c to insert the macro name. Free macro_entry on error. (macro_expand): Pass macro_entry to macro_epand_body. Don't return when encountering an error, just record the fact. (expand_irp): Don't return when encountering an error, just record the fact. * macro.h (macro_struct): New members name, file, and line. (define_macro): Add file and line number parameters. * read.c (s_macro): Pass file and line to define_macro. Tag warning regarding pseudo-op redefinition with the file/line that macro definition started at. gas/testsuite/ 2005-04-25 Jan Beulich * gas/macros/badarg.s: Add tests for collisions between/among macro parameters and local symbols. * gas/macros/badarg.l: Adjust. --- gas/read.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gas/read.c') diff --git a/gas/read.c b/gas/read.c index 7938a57..b83f140 100644 --- a/gas/read.c +++ b/gas/read.c @@ -2338,9 +2338,9 @@ s_macro (int ignore ATTRIBUTE_UNUSED) if (line_label != NULL) sb_add_string (&label, S_GET_NAME (line_label)); - err = define_macro (0, &s, &label, get_line_sb, &name); + err = define_macro (0, &s, &label, get_line_sb, file, line, &name); if (err != NULL) - as_bad_where (file, line, "%s", err); + as_bad_where (file, line, err, name); else { if (line_label != NULL) @@ -2355,7 +2355,9 @@ s_macro (int ignore ATTRIBUTE_UNUSED) || (!flag_m68k_mri && *name == '.' && hash_find (po_hash, name + 1) != NULL)) - as_warn (_("attempt to redefine pseudo-op `%s' ignored"), + as_warn_where (file, + line, + _("attempt to redefine pseudo-op `%s' ignored"), name); } -- cgit v1.1