aboutsummaryrefslogtreecommitdiff
path: root/gas/macro.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2023-02-14 08:34:03 +0100
committerJan Beulich <jbeulich@suse.com>2023-02-14 08:34:03 +0100
commit7545aa2dd2eb85a852f978dc0d93b3deb6f52536 (patch)
treeb8b08d57ca3ceb330a80a696f254d3d1bff9173f /gas/macro.c
parentf54cd6441de5c057b43ea1501c1b075984067e7c (diff)
downloadbinutils-7545aa2dd2eb85a852f978dc0d93b3deb6f52536.zip
binutils-7545aa2dd2eb85a852f978dc0d93b3deb6f52536.tar.gz
binutils-7545aa2dd2eb85a852f978dc0d93b3deb6f52536.tar.bz2
gas: improve interaction between read_a_source_file() and s_linefile()
read_a_source_file() would bump line numbers only when seeing a newline, whereas is_end_of_line[] indicates further end-of-line characters, in particular the nul character. s_linefile() attempts to compensate for the bump, but was too aggressive with this so far: It should only adjust when a newline ends the line. To facilitate such a check, the check for nothing else on the line needs to move ahead, which luckily is easily possible: The relevant two conditions match, and the function can simply return from the body of that earlier instance of the conditional. The more strict treatment in s_linefile() then requires an adjustment to buffer_and_nest()'s invocation of the function: The line terminator now needs to be a newline, not nul.
Diffstat (limited to 'gas/macro.c')
-rw-r--r--gas/macro.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gas/macro.c b/gas/macro.c
index 763bafb..f9f2d63 100644
--- a/gas/macro.c
+++ b/gas/macro.c
@@ -265,7 +265,7 @@ buffer_and_nest (const char *from, const char *to, sb *ptr,
{
char saved_eol_char = ptr->ptr[ptr->len];
- ptr->ptr[ptr->len] = '\0';
+ ptr->ptr[ptr->len] = '\n';
temp_ilp (ptr->ptr + i + 8);
s_linefile (0);
restore_ilp ();