From: Piotr Trojanek Date: Thu, 1 Jul 2021 13:40:00 +0000 (+0200) Subject: [Ada] Simplify iteration when printing error message spans X-Git-Tag: basepoints/gcc-13~4583 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=255279b91ecc1872539f469453b6cb05ccb75b37;p=thirdparty%2Fgcc.git [Ada] Simplify iteration when printing error message spans gcc/ada/ * errout.adb (Write_Source_Code_Lines): Use Cur_Loc before incrementing it, so that we don't need to decrement it. --- diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index c859d8c5110a..0b10d41181bb 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -2693,9 +2693,7 @@ package body Errout is Write_Buffer_Char (Buf, Cur_Loc); end if; - Cur_Loc := Cur_Loc + 1; - - if Buf (Cur_Loc - 1) = ASCII.LF then + if Buf (Cur_Loc) = ASCII.LF then Cur_Line := Cur_Line + 1; -- Output ... for skipped lines @@ -2720,6 +2718,8 @@ package body Errout is Width); end if; end if; + + Cur_Loc := Cur_Loc + 1; end loop; end;