diff options
Diffstat (limited to 'gcc/ada/s-valwch.adb')
-rw-r--r-- | gcc/ada/s-valwch.adb | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/ada/s-valwch.adb b/gcc/ada/s-valwch.adb index b2db5005adc..87e85464301 100644 --- a/gcc/ada/s-valwch.adb +++ b/gcc/ada/s-valwch.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -48,8 +48,7 @@ package body System.Val_WChar is WV : constant Unsigned_32 := Wide_Wide_Character'Pos (WC); begin if WV > 16#FFFF# then - raise Constraint_Error with - "out of range character for Value attribute"; + Bad_Value (Str); else return Wide_Character'Val (WV); end if; @@ -77,7 +76,7 @@ package body System.Val_WChar is -- Must be at least three characters if L - F < 2 then - raise Constraint_Error; + Bad_Value (Str); -- If just three characters, simple character case @@ -103,7 +102,7 @@ package body System.Val_WChar is P := P + 1; if P = Str'Last then - raise Constraint_Error; + Bad_Value (Str); end if; return Str (P); @@ -124,7 +123,7 @@ package body System.Val_WChar is end if; if P /= L - 1 then - raise Constraint_Error; + Bad_Value (Str); end if; return W; @@ -150,12 +149,12 @@ package body System.Val_WChar is elsif Str (J) in 'a' .. 'f' then W := W - Character'Pos ('a') + 10; else - raise Constraint_Error; + Bad_Value (Str); end if; end loop; if W > 16#7FFF_FFFF# then - raise Constraint_Error; + Bad_Value (Str); else return Wide_Wide_Character'Val (W); end if; @@ -170,7 +169,7 @@ package body System.Val_WChar is exception when Constraint_Error => - raise Constraint_Error with "invalid string for value attribute"; + Bad_Value (Str); end Value_Wide_Wide_Character; end System.Val_WChar; |