From: Ghjuvan Lacambre Date: Thu, 8 Dec 2022 08:58:28 +0000 (+0100) Subject: ada: output.adb: fix newline being inserted when buffer is full X-Git-Tag: basepoints/gcc-14~2235 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=238ff612f2fd88372c585753dd2faa73cb94cbb5;p=thirdparty%2Fgcc.git ada: output.adb: fix newline being inserted when buffer is full Before this commit, when GNAT needed to emit lines longer than the buffer, it accidentally inserted a newline in its output when attempting to flush its buffer. We fix this by using Flush_Buffer instead of Write_Eol in Write_Char. gcc/ada/ * output.adb (Write_Buffer): Use Flush_Buffer instead of Write_Eol. --- diff --git a/gcc/ada/output.adb b/gcc/ada/output.adb index 33d027ded8e3..497643d17ecc 100644 --- a/gcc/ada/output.adb +++ b/gcc/ada/output.adb @@ -422,10 +422,10 @@ package body Output is procedure Write_Char (C : Character) is begin - pragma Assert (Next_Col in Buffer'Range); - if Next_Col = Buffer'Length then - Write_Eol; + if Next_Col > Buffer'Length then + Flush_Buffer; end if; + pragma Assert (Next_Col in Buffer'Range); if C = ASCII.LF then Write_Eol;