mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 20:28:28 +08:00
gas: avoid inserting extra newline in buffer_and_nest()
In "-alm" listings I've noticed an odd blank line following the inserted .linefile one. This results from the explicit NL inserted being redundant with the one left in place from the original input line by all respective callers. Note that we need to compensate for the removed line by bumping the directive argument (which in turn is decremented again in s_linefile() before calling new_logical_line_flags(), and I have to confess that when putting together the original change I was a little puzzled by the imbalance of increments/decrements, but then I forgot to actually go look for the cause). While there also switch to sb_add_string() instead of effectively open- coding it to some degree.
This commit is contained in:
@ -142,10 +142,10 @@ buffer_and_nest (const char *from, const char *to, sb *ptr,
|
|||||||
|
|
||||||
as_where (&line);
|
as_where (&line);
|
||||||
if (!flag_m68k_mri)
|
if (!flag_m68k_mri)
|
||||||
linefile = xasprintf ("\t.linefile %u .\n", line);
|
linefile = xasprintf ("\t.linefile %u .", line + 1);
|
||||||
else
|
else
|
||||||
linefile = xasprintf ("\tlinefile %u .\n", line);
|
linefile = xasprintf ("\tlinefile %u .", line + 1);
|
||||||
sb_add_buffer (ptr, linefile, strlen (linefile));
|
sb_add_string (ptr, linefile);
|
||||||
xfree (linefile);
|
xfree (linefile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user