mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34: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_WHERE_LIKE (as_warn_where);
|
||||||
PRINTF_INDENT_LIKE (as_info_where);
|
PRINTF_INDENT_LIKE (as_info_where);
|
||||||
|
|
||||||
|
void set_identify_name (const char *);
|
||||||
void as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
|
void as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
|
||||||
void signal_init (void);
|
void signal_init (void);
|
||||||
int had_errors (void);
|
int had_errors (void);
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
extern const char *strsignal (int);
|
extern const char *strsignal (int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void identify (const char *);
|
|
||||||
static void as_show_where (void);
|
static void as_show_where (void);
|
||||||
static void as_warn_internal (const char *, unsigned int, char *);
|
static void as_warn_internal (const char *, unsigned int, char *);
|
||||||
static void as_bad_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).
|
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
|
static void
|
||||||
identify (const char *file)
|
identify (void)
|
||||||
{
|
{
|
||||||
static int identified;
|
static int identified;
|
||||||
|
|
||||||
@@ -81,14 +88,8 @@ identify (const char *file)
|
|||||||
return;
|
return;
|
||||||
identified++;
|
identified++;
|
||||||
|
|
||||||
if (!file)
|
if (ident_name && *ident_name)
|
||||||
{
|
fprintf (stderr, "%s: ", ident_name);
|
||||||
unsigned int x;
|
|
||||||
file = as_where (&x);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file)
|
|
||||||
fprintf (stderr, "%s: ", file);
|
|
||||||
fprintf (stderr, _("Assembler messages:\n"));
|
fprintf (stderr, _("Assembler messages:\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +122,7 @@ as_show_where (void)
|
|||||||
unsigned int line;
|
unsigned int line;
|
||||||
|
|
||||||
file = as_where_top (&line);
|
file = as_where_top (&line);
|
||||||
identify (file);
|
identify ();
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if (line != 0)
|
if (line != 0)
|
||||||
@@ -185,7 +186,7 @@ as_warn_internal (const char *file, unsigned int line, char *buffer)
|
|||||||
context = true;
|
context = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
identify (file);
|
identify ();
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if (line != 0)
|
if (line != 0)
|
||||||
@@ -259,7 +260,7 @@ as_bad_internal (const char *file, unsigned int line, char *buffer)
|
|||||||
context = true;
|
context = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
identify (file);
|
identify ();
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
if (line != 0)
|
if (line != 0)
|
||||||
|
|||||||
@@ -895,6 +895,8 @@ read_a_source_file (const char *name)
|
|||||||
found_comment = 0;
|
found_comment = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
set_identify_name (name);
|
||||||
|
|
||||||
buffer = input_scrub_new_file (name);
|
buffer = input_scrub_new_file (name);
|
||||||
|
|
||||||
listing_file (name);
|
listing_file (name);
|
||||||
|
|||||||
@@ -340,6 +340,8 @@ if { [is_elf_format] } then {
|
|||||||
run_list_test line
|
run_list_test line
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_list_test "line2" -I${srcdir}/$subdir
|
||||||
|
|
||||||
run_dump_test "pr25917"
|
run_dump_test "pr25917"
|
||||||
run_dump_test "bss"
|
run_dump_test "bss"
|
||||||
# Some targets treat .bss similar to .lcomm.
|
# 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