This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Suppress certain gas error message line numbers
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Fri, 18 Mar 2011 21:46:30 +1030
- Subject: Suppress certain gas error message line numbers
Messages emitted by gas when it discovers a problem after parsing the
input file, eg. the recent .size errors, report the last line of the
file as the source of the error. This is incorrect and misleading.
Fixed by suppressing the line number for such messages.
gas/
* input-scrub.c (line_numberT): Delete.
(input_scrub_close): Reset line counters.
* messages.c (as_show_where): Don't print invalid line number.
(as_warn_internal, as_bad_internal): Likewise.
gas/testsuite/
* gas/elf/bad-size.err: Adjust expected error.
* gas/i386/bad-size.warn: Likewise.
* gas/i386/inval-equ-2.l: Likewise.
* gas/symver/symver2.l: Likewise.
Index: gas/input-scrub.c
===================================================================
RCS file: /cvs/src/src/gas/input-scrub.c,v
retrieving revision 1.24
diff -u -p -r1.24 input-scrub.c
--- gas/input-scrub.c 28 Feb 2011 18:32:52 -0000 1.24
+++ gas/input-scrub.c 18 Mar 2011 02:50:22 -0000
@@ -1,6 +1,6 @@
/* input_scrub.c - Break up input buffers into whole numbers of lines.
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 2000, 2001, 2003, 2005, 2006, 2007, 2008
+ 2000, 2001, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -100,10 +100,9 @@ int macro_nest;
static char *physical_input_file;
static char *logical_input_file;
-typedef unsigned int line_numberT; /* 1-origin line number in a source file. */
+/* 1-origin line number in a source file. */
/* A line ends in '\n' or eof. */
-
-static line_numberT physical_input_line;
+static unsigned int physical_input_line;
static int logical_input_line;
/* Struct used to save the state of the input handler during include files */
@@ -115,7 +114,7 @@ struct input_save {
unsigned int buffer_length;
char * physical_input_file;
char * logical_input_file;
- line_numberT physical_input_line;
+ unsigned int physical_input_line;
int logical_input_line;
int sb_index;
sb from_sb;
@@ -304,6 +303,8 @@ void
input_scrub_close (void)
{
input_file_close ();
+ physical_input_line = 0;
+ logical_input_line = -1;
}
char *
Index: gas/messages.c
===================================================================
RCS file: /cvs/src/src/gas/messages.c,v
retrieving revision 1.23
diff -u -p -r1.23 messages.c
--- gas/messages.c 3 Jun 2010 07:36:04 -0000 1.23
+++ gas/messages.c 18 Mar 2011 02:50:23 -0000
@@ -1,6 +1,6 @@
/* messages.c - error reporter -
Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
- 2003, 2004, 2005, 2006, 2007, 2008
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -113,7 +113,12 @@ as_show_where (void)
as_where (&file, &line);
identify (file);
if (file)
- fprintf (stderr, "%s:%u: ", file, line);
+ {
+ if (line != 0)
+ fprintf (stderr, "%s:%u: ", file, line);
+ else
+ fprintf (stderr, "%s: ", file);
+ }
}
/* Send to stderr a string as a warning, and locate warning
@@ -146,7 +151,12 @@ as_warn_internal (char *file, unsigned i
identify (file);
if (file)
- fprintf (stderr, "%s:%u: ", file, line);
+ {
+ if (line != 0)
+ fprintf (stderr, "%s:%u: ", file, line);
+ else
+ fprintf (stderr, "%s: ", file);
+ }
fprintf (stderr, _("Warning: "));
fputs (buffer, stderr);
(void) putc ('\n', stderr);
@@ -207,7 +217,12 @@ as_bad_internal (char *file, unsigned in
identify (file);
if (file)
- fprintf (stderr, "%s:%u: ", file, line);
+ {
+ if (line != 0)
+ fprintf (stderr, "%s:%u: ", file, line);
+ else
+ fprintf (stderr, "%s: ", file);
+ }
fprintf (stderr, _("Error: "));
fputs (buffer, stderr);
(void) putc ('\n', stderr);
Index: gas/testsuite/gas/elf/bad-size.err
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/elf/bad-size.err,v
retrieving revision 1.3
diff -u -p -r1.3 bad-size.err
--- gas/testsuite/gas/elf/bad-size.err 7 Mar 2011 05:42:53 -0000 1.3
+++ gas/testsuite/gas/elf/bad-size.err 18 Mar 2011 02:52:08 -0000
@@ -1,2 +1,2 @@
.*bad-size\.s: Assembler messages:
-.*bad-size\.s:6: Error: .*
+.*bad-size\.s:.* Error: .*
Index: gas/testsuite/gas/i386/bad-size.warn
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/bad-size.warn,v
retrieving revision 1.1
diff -u -p -r1.1 bad-size.warn
--- gas/testsuite/gas/i386/bad-size.warn 16 Mar 2011 12:58:26 -0000 1.1
+++ gas/testsuite/gas/i386/bad-size.warn 18 Mar 2011 02:52:08 -0000
@@ -1,2 +1,2 @@
.*bad-size\.s: Assembler messages:
-.*bad-size\.s:6: Warning: .*
+.*bad-size\.s: Warning: .*
Index: gas/testsuite/gas/i386/inval-equ-2.l
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/inval-equ-2.l,v
retrieving revision 1.1
diff -u -p -r1.1 inval-equ-2.l
--- gas/testsuite/gas/i386/inval-equ-2.l 3 Mar 2008 15:28:58 -0000 1.1
+++ gas/testsuite/gas/i386/inval-equ-2.l 18 Mar 2011 02:52:08 -0000
@@ -1,7 +1,7 @@
.*: Assembler messages:
-.*:8: Error: .*
-.*:8: Error: .*
-.*:8: Error: .*
+.*: Error: .*
+.*: Error: .*
+.*: Error: .*
GAS LISTING .*
Index: gas/testsuite/gas/symver/symver2.l
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/symver/symver2.l,v
retrieving revision 1.1
diff -u -p -r1.1 symver2.l
--- gas/testsuite/gas/symver/symver2.l 13 Nov 2000 21:36:14 -0000 1.1
+++ gas/testsuite/gas/symver/symver2.l 18 Mar 2011 02:52:10 -0000
@@ -1,2 +1,2 @@
.*: Assembler messages:
-.*:8: Error: invalid attempt to declare external version name as default in symbol `foo@@version1'
+.*: Error: invalid attempt to declare external version name as default in symbol `foo@@version1'
--
Alan Modra
Australia Development Lab, IBM