]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Simplify iteration when printing error message spans
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 1 Jul 2021 13:40:00 +0000 (15:40 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 21 Sep 2021 15:24:55 +0000 (15:24 +0000)
gcc/ada/

* errout.adb (Write_Source_Code_Lines): Use Cur_Loc before
incrementing it, so that we don't need to decrement it.

gcc/ada/errout.adb

index c859d8c5110ad3f9e0c2c7d99316412b91525cf2..0b10d41181bb8ac2756cf2b562f33e84b2d45c11 100644 (file)
@@ -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;