[PATCH] gas: improve interaction between read_a_source_file() and s_linefile()

Alan Modra amodra@gmail.com
Mon Feb 13 10:31:59 GMT 2023


On Mon, Feb 13, 2023 at 09:15:36AM +0100, Jan Beulich wrote:
> 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.

Looks good to me, thanks for sorting this out.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list