From: Ronan Desplanques <desplanq...@adacore.com>

This patch rephrases some code in System.Value_R to make it easier to
read.

gcc/ada/ChangeLog:

        * libgnat/s-valuer.adb (Scan_Decimal_Digits, Scan_Integral_Digits):
        Minor rephrasing.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/libgnat/s-valuer.adb | 38 +++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/gcc/ada/libgnat/s-valuer.adb b/gcc/ada/libgnat/s-valuer.adb
index faedb884a6a..25f54079bfe 100644
--- a/gcc/ada/libgnat/s-valuer.adb
+++ b/gcc/ada/libgnat/s-valuer.adb
@@ -236,18 +236,17 @@ package body System.Value_R is
       Digit := As_Digit (Str (Index));
 
       loop
-         --  Check if base is correct. If the base is not specified, the digit
-         --  E or e cannot be considered as a base violation as it can be used
-         --  for exponentiation.
+         --  If the base is not explicitly specified, 'e' or 'E' marks the
+         --  beginning of the exponent part.
+
+         if not Base_Specified and then Digit = E_Digit then
+            return;
+         end if;
+
+         --  Check that Digit is a valid digit with respect to Base
 
          if Digit >= Base then
-            if Base_Specified then
-               Base_Violation := True;
-            elsif Digit = E_Digit then
-               return;
-            else
-               Base_Violation := True;
-            end if;
+            Base_Violation := True;
          end if;
 
          --  If precision limit has been reached, just ignore any remaining
@@ -426,18 +425,17 @@ package body System.Value_R is
       Digit := As_Digit (Str (Index));
 
       loop
-         --  Check if base is correct. If the base is not specified, the digit
-         --  E or e cannot be considered as a base violation as it can be used
-         --  for exponentiation.
+         --  If the base is not explicitly specified, 'e' or 'E' marks the
+         --  beginning of the exponent part.
+
+         if not Base_Specified and then Digit = E_Digit then
+            return;
+         end if;
+
+         --  Check that Digit is a valid digit with respect to Base
 
          if Digit >= Base then
-            if Base_Specified then
-               Base_Violation := True;
-            elsif Digit = E_Digit then
-               return;
-            else
-               Base_Violation := True;
-            end if;
+            Base_Violation := True;
          end if;
 
          --  If precision limit has been reached, just ignore any remaining
-- 
2.43.0

Reply via email to