From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1386) id C7C0F389942F; Mon, 5 Dec 2022 12:53:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C7C0F389942F Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jan Beulich To: bfd-cvs@sourceware.org Subject: [binutils-gdb] gas: avoid inserting extra newline in buffer_and_nest() X-Act-Checkin: binutils-gdb X-Git-Author: Jan Beulich X-Git-Refname: refs/heads/master X-Git-Oldrev: 07aeb917c4d379e8fca611aa7346e977a4061e17 X-Git-Newrev: fde7a8e4b007a29c7196fd5b017342899c367c00 Message-Id: <20221205125310.C7C0F389942F@sourceware.org> Date: Mon, 5 Dec 2022 12:53:10 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2022 12:53:10 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dfde7a8e4b007= a29c7196fd5b017342899c367c00 commit fde7a8e4b007a29c7196fd5b017342899c367c00 Author: Jan Beulich Date: Mon Dec 5 13:50:27 2022 +0100 gas: avoid inserting extra newline in buffer_and_nest() =20 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). =20 While there also switch to sb_add_string() instead of effectively open- coding it to some degree. Diff: --- gas/macro.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gas/macro.c b/gas/macro.c index c2a47684b15..3d5774ee5e1 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -142,10 +142,10 @@ buffer_and_nest (const char *from, const char *to, sb= *ptr, =20 as_where (&line); if (!flag_m68k_mri) - linefile =3D xasprintf ("\t.linefile %u .\n", line); + linefile =3D xasprintf ("\t.linefile %u .", line + 1); else - linefile =3D xasprintf ("\tlinefile %u .\n", line); - sb_add_buffer (ptr, linefile, strlen (linefile)); + linefile =3D xasprintf ("\tlinefile %u .", line + 1); + sb_add_string (ptr, linefile); xfree (linefile); }