aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/s-valrea.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-06-22 11:21:53 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2009-06-22 11:21:53 +0200
commite7d72fb99dbc80790185d67baed6a0ca7e8bbda8 (patch)
tree6d6b44b943763453e0e83639cca92341263a0474 /gcc/ada/s-valrea.adb
parent03456e44cfa6f5b10bf37689d497d05514dd47a4 (diff)
downloadgcc-e7d72fb99dbc80790185d67baed6a0ca7e8bbda8.zip
gcc-e7d72fb99dbc80790185d67baed6a0ca7e8bbda8.tar.gz
gcc-e7d72fb99dbc80790185d67baed6a0ca7e8bbda8.tar.bz2
[multiple changes]
2009-06-22 Robert Dewar <dewar@adacore.com> * sinput.adb, sinput.ads (Expr_First_Char, Expr_Last_Char): Replaced by Sloc_Range. * freeze.adb: Minor comment updates * s-valrea.adb (Bad_Based_Value): New procedure (Scan_Real): Raise exceptions with messages 2009-06-22 Matthew Gingell <gingell@adacore.com> * adaint.h: Complete previous change. 2009-06-22 Thomas Quinot <quinot@adacore.com> * exp_ch7.ads, exp_ch3.adb: Minor reformatting 2009-06-22 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Check_Overriding_Indicator): When style checks are enabled, emit warning when a non-controlling argument of the overriding operation appears out of place vis-a-vis of the formal of the overridden operation. From-SVN: r148782
Diffstat (limited to 'gcc/ada/s-valrea.adb')
-rw-r--r--gcc/ada/s-valrea.adb27
1 files changed, 21 insertions, 6 deletions
diff --git a/gcc/ada/s-valrea.adb b/gcc/ada/s-valrea.adb
index 8477772..2e8306a 100644
--- a/gcc/ada/s-valrea.adb
+++ b/gcc/ada/s-valrea.adb
@@ -89,6 +89,10 @@ package body System.Val_Real is
-- necessarily required in a case like this where the result is not
-- a machine number, but it is certainly a desirable behavior.
+ procedure Bad_Based_Value;
+ pragma No_Return (Bad_Based_Value);
+ -- Raise exception for bad based value
+
procedure Scanf;
-- Scans integer literal value starting at current character position.
-- For each digit encountered, Uval is multiplied by 10.0, and the new
@@ -98,6 +102,16 @@ package body System.Val_Real is
-- return P points past the last character. On entry, the current
-- character is known to be a digit, so a numeral is definitely present.
+ ---------------------
+ -- Bad_Based_Value --
+ ---------------------
+
+ procedure Bad_Based_Value is
+ begin
+ raise Constraint_Error with
+ "invalid based literal for 'Value";
+ end Bad_Based_Value;
+
-----------
-- Scanf --
-----------
@@ -181,7 +195,8 @@ package body System.Val_Real is
-- Any other initial character is an error
else
- raise Constraint_Error;
+ raise Constraint_Error with
+ "invalid character in 'Value string";
end if;
-- Deal with based case
@@ -219,7 +234,7 @@ package body System.Val_Real is
loop
if P > Max then
- raise Constraint_Error;
+ Bad_Based_Value;
elsif Str (P) in Digs then
Digit := Character'Pos (Str (P)) - Character'Pos ('0');
@@ -233,7 +248,7 @@ package body System.Val_Real is
Character'Pos (Str (P)) - (Character'Pos ('a') - 10);
else
- raise Constraint_Error;
+ Bad_Based_Value;
end if;
-- Save up trailing zeroes after the decimal point
@@ -267,7 +282,7 @@ package body System.Val_Real is
P := P + 1;
if P > Max then
- raise Constraint_Error;
+ Bad_Based_Value;
elsif Str (P) = '_' then
Scan_Underscore (Str, P, Ptr, Max, True);
@@ -282,7 +297,7 @@ package body System.Val_Real is
After_Point := 1;
if P > Max then
- raise Constraint_Error;
+ Bad_Based_Value;
end if;
end if;
@@ -358,7 +373,7 @@ package body System.Val_Real is
-- Here is where we check for a bad based number
if Bad_Base then
- raise Constraint_Error;
+ Bad_Based_Value;
-- If OK, then deal with initial minus sign, note that this processing
-- is done even if Uval is zero, so that -0.0 is correctly interpreted.