mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 04:24:43 +00:00
gas: Improve file name in messages header
Message output from gas is prefixed with a line of the form: path/file.s: Assembler messages: Don't use the file name from the first message for this header. Instead, use the source file name specified in the command line.
This commit is contained in:
1
gas/as.h
1
gas/as.h
@@ -500,6 +500,7 @@ PRINTF_WHERE_LIKE (as_bad_where);
|
||||
PRINTF_WHERE_LIKE (as_warn_where);
|
||||
PRINTF_INDENT_LIKE (as_info_where);
|
||||
|
||||
void set_identify_name (const char *);
|
||||
void as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
|
||||
void signal_init (void);
|
||||
int had_errors (void);
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
extern const char *strsignal (int);
|
||||
#endif
|
||||
|
||||
static void identify (const char *);
|
||||
static void as_show_where (void);
|
||||
static void as_warn_internal (const char *, unsigned int, char *);
|
||||
static void as_bad_internal (const char *, unsigned int, char *);
|
||||
@@ -72,8 +71,16 @@ static void signal_crash (int) ATTRIBUTE_NORETURN;
|
||||
as_abort () is used for logic failure (assert or abort, signal).
|
||||
*/
|
||||
|
||||
static const char *ident_name;
|
||||
|
||||
void
|
||||
set_identify_name (const char *name)
|
||||
{
|
||||
ident_name = name;
|
||||
}
|
||||
|
||||
static void
|
||||
identify (const char *file)
|
||||
identify (void)
|
||||
{
|
||||
static int identified;
|
||||
|
||||
@@ -81,14 +88,8 @@ identify (const char *file)
|
||||
return;
|
||||
identified++;
|
||||
|
||||
if (!file)
|
||||
{
|
||||
unsigned int x;
|
||||
file = as_where (&x);
|
||||
}
|
||||
|
||||
if (file)
|
||||
fprintf (stderr, "%s: ", file);
|
||||
if (ident_name && *ident_name)
|
||||
fprintf (stderr, "%s: ", ident_name);
|
||||
fprintf (stderr, _("Assembler messages:\n"));
|
||||
}
|
||||
|
||||
@@ -121,7 +122,7 @@ as_show_where (void)
|
||||
unsigned int line;
|
||||
|
||||
file = as_where_top (&line);
|
||||
identify (file);
|
||||
identify ();
|
||||
if (file)
|
||||
{
|
||||
if (line != 0)
|
||||
@@ -185,7 +186,7 @@ as_warn_internal (const char *file, unsigned int line, char *buffer)
|
||||
context = true;
|
||||
}
|
||||
|
||||
identify (file);
|
||||
identify ();
|
||||
if (file)
|
||||
{
|
||||
if (line != 0)
|
||||
@@ -259,7 +260,7 @@ as_bad_internal (const char *file, unsigned int line, char *buffer)
|
||||
context = true;
|
||||
}
|
||||
|
||||
identify (file);
|
||||
identify ();
|
||||
if (file)
|
||||
{
|
||||
if (line != 0)
|
||||
|
||||
@@ -895,6 +895,8 @@ read_a_source_file (const char *name)
|
||||
found_comment = 0;
|
||||
#endif
|
||||
|
||||
set_identify_name (name);
|
||||
|
||||
buffer = input_scrub_new_file (name);
|
||||
|
||||
listing_file (name);
|
||||
|
||||
@@ -340,6 +340,8 @@ if { [is_elf_format] } then {
|
||||
run_list_test line
|
||||
}
|
||||
|
||||
run_list_test "line2" -I${srcdir}/$subdir
|
||||
|
||||
run_dump_test "pr25917"
|
||||
run_dump_test "bss"
|
||||
# Some targets treat .bss similar to .lcomm.
|
||||
|
||||
6
gas/testsuite/gas/elf/line2.inc
Normal file
6
gas/testsuite/gas/elf/line2.inc
Normal file
@@ -0,0 +1,6 @@
|
||||
.macro mac
|
||||
.warning "inside macro"
|
||||
.nop
|
||||
.endm
|
||||
|
||||
mac
|
||||
5
gas/testsuite/gas/elf/line2.l
Normal file
5
gas/testsuite/gas/elf/line2.l
Normal file
@@ -0,0 +1,5 @@
|
||||
.*line2\.s: Assembler messages:
|
||||
.*line2\.inc:2: Warning: inside macro
|
||||
.*line2\.inc:6: Info: macro invoked from here
|
||||
.*:2: Warning: inside macro
|
||||
.*line2\.s:3: Info: macro invoked from here
|
||||
3
gas/testsuite/gas/elf/line2.s
Normal file
3
gas/testsuite/gas/elf/line2.s
Normal file
@@ -0,0 +1,3 @@
|
||||
.include "line2.inc"
|
||||
|
||||
mac
|
||||
Reference in New Issue
Block a user