public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5027] [Ada] Return a valid value when handling Constraint_Error
@ 2021-11-09 9:46 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-11-09 9:46 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0803fd245a35c4b465cdefff20364f0f6e9f6fa7
commit r12-5027-g0803fd245a35c4b465cdefff20364f0f6e9f6fa7
Author: Etienne Servais <servais@adacore.com>
Date: Tue Oct 26 18:08:47 2021 +0200
[Ada] Return a valid value when handling Constraint_Error
gcc/ada/
* scng.adb (Set_Start_Column): Return Column_Number'Last when
handling Constraint_Error. Plus reformat a strangely 7 level if
loop.
Diff:
---
gcc/ada/scng.adb | 55 ++++++++-----------------------------------------------
1 file changed, 8 insertions(+), 47 deletions(-)
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb
index fb42e30bb2f..3c62337a7c2 100644
--- a/gcc/ada/scng.adb
+++ b/gcc/ada/scng.adb
@@ -2701,52 +2701,13 @@ package body Scng is
Tabs_Loop : loop
- -- Inner loop scans past blanks as fast as possible, bumping Scan_Ptr
- -- past the blanks and adjusting Start_Column to account for them.
-
- Blanks_Loop : loop
- if Source (Scan_Ptr) = ' ' then
- if Source (Scan_Ptr + 1) = ' ' then
- if Source (Scan_Ptr + 2) = ' ' then
- if Source (Scan_Ptr + 3) = ' ' then
- if Source (Scan_Ptr + 4) = ' ' then
- if Source (Scan_Ptr + 5) = ' ' then
- if Source (Scan_Ptr + 6) = ' ' then
- Scan_Ptr := Scan_Ptr + 7;
- Start_Column := Start_Column + 7;
- else
- Scan_Ptr := Scan_Ptr + 6;
- Start_Column := Start_Column + 6;
- exit Blanks_Loop;
- end if;
- else
- Scan_Ptr := Scan_Ptr + 5;
- Start_Column := Start_Column + 5;
- exit Blanks_Loop;
- end if;
- else
- Scan_Ptr := Scan_Ptr + 4;
- Start_Column := Start_Column + 4;
- exit Blanks_Loop;
- end if;
- else
- Scan_Ptr := Scan_Ptr + 3;
- Start_Column := Start_Column + 3;
- exit Blanks_Loop;
- end if;
- else
- Scan_Ptr := Scan_Ptr + 2;
- Start_Column := Start_Column + 2;
- exit Blanks_Loop;
- end if;
- else
- Scan_Ptr := Scan_Ptr + 1;
- Start_Column := Start_Column + 1;
- exit Blanks_Loop;
- end if;
- else
- exit Blanks_Loop;
- end if;
+ -- Inner loop scans past blanks, bumping Scan_Ptr past the blanks and
+ -- adjusting Start_Column to account for them.
+
+ Blanks_Loop :
+ while Source (Scan_Ptr) = ' ' loop
+ Scan_Ptr := Scan_Ptr + 1;
+ Start_Column := Start_Column + 1;
end loop Blanks_Loop;
-- Outer loop keeps going only if a horizontal tab follows
@@ -2771,7 +2732,7 @@ package body Scng is
exception
when Constraint_Error =>
- return Start_Column;
+ return Column_Number'Last;
end Set_Start_Column;
end Scng;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-09 9:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 9:46 [gcc r12-5027] [Ada] Return a valid value when handling Constraint_Error Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).