aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-02-20 15:26:06 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2015-02-20 15:26:06 +0100
commit9ec98e13b932b9d8404d8d8d61357662e80b35d1 (patch)
treef950b17bcbf2a70920676833247f508791695dab /gcc
parentcd8e18e73d8b84988d3c495f3eb8b3baf960b04e (diff)
downloadgcc-9ec98e13b932b9d8404d8d8d61357662e80b35d1.zip
gcc-9ec98e13b932b9d8404d8d8d61357662e80b35d1.tar.gz
gcc-9ec98e13b932b9d8404d8d8d61357662e80b35d1.tar.bz2
[multiple changes]
2015-02-20 Tristan Gingold <gingold@adacore.com> * opt.ads (GNAT_Mode_Config): New variable. * opt.adb (Set_Opt_Config_Switches): Consider GNAT_Mode_Config to set Assertions_Enabled. * switch-c.adb (Scan_Front_End_Switches): Set GNAT_Mode_Config for -gnatg. 2015-02-20 Robert Dewar <dewar@adacore.com> * s-valllu.ads (Scan_Raw_Long_Long_Unsigned): Add an additional comment regarding the handling of unterminated fixed-point constants. * s-valuns.ads (Scan_Raw_Unsigned): Add comments corresponding to those previously added for System.Val_LLU.Scan_Raw_Long_Long_Unsigned. From-SVN: r220866
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog17
-rw-r--r--gcc/ada/opt.adb15
-rw-r--r--gcc/ada/opt.ads6
-rw-r--r--gcc/ada/s-valllu.ads11
-rw-r--r--gcc/ada/s-valuns.ads42
-rw-r--r--gcc/ada/switch-c.adb1
6 files changed, 84 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index fa9f2ee..55002a7 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,20 @@
+2015-02-20 Tristan Gingold <gingold@adacore.com>
+
+ * opt.ads (GNAT_Mode_Config): New variable.
+ * opt.adb (Set_Opt_Config_Switches): Consider GNAT_Mode_Config
+ to set Assertions_Enabled.
+ * switch-c.adb (Scan_Front_End_Switches): Set GNAT_Mode_Config
+ for -gnatg.
+
+2015-02-20 Robert Dewar <dewar@adacore.com>
+
+ * s-valllu.ads (Scan_Raw_Long_Long_Unsigned): Add an additional
+ comment regarding the handling of unterminated fixed-point
+ constants.
+ * s-valuns.ads (Scan_Raw_Unsigned): Add comments
+ corresponding to those previously added for
+ System.Val_LLU.Scan_Raw_Long_Long_Unsigned.
+
2015-02-20 Olivier Hainque <hainque@adacore.com>
* g-allein.ads, g-alveop.ads, g-alveop.adb: Code clean ups.
diff --git a/gcc/ada/opt.adb b/gcc/ada/opt.adb
index 0afab65..6468096 100644
--- a/gcc/ada/opt.adb
+++ b/gcc/ada/opt.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2015, 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- --
@@ -187,9 +187,10 @@ package body Opt is
-- we do not expect to get any warnings from compiling such a unit.
-- For an internal unit, assertions/debug pragmas are off unless this
- -- is the main unit and they were explicitly enabled. We also make
- -- sure we do not assume that values are necessarily valid and that
- -- SPARK_Mode is set to its configuration value.
+ -- is the main unit and they were explicitly enabled, or unless the
+ -- main unit was compiled in GNAT mode. We also make sure we do not
+ -- assume that values are necessarily valid and that SPARK_Mode is
+ -- set to its configuration value.
if Main_Unit then
Assertions_Enabled := Assertions_Enabled_Config;
@@ -198,7 +199,11 @@ package body Opt is
SPARK_Mode := SPARK_Mode_Config;
SPARK_Mode_Pragma := SPARK_Mode_Pragma_Config;
else
- Assertions_Enabled := False;
+ if GNAT_Mode_Config then
+ Assertions_Enabled := Assertions_Enabled_Config;
+ else
+ Assertions_Enabled := False;
+ end if;
Assume_No_Invalid_Values := False;
Check_Policy_List := Empty;
SPARK_Mode := None;
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index d144a5a..72a5280 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -2154,6 +2154,12 @@ package Opt is
-- GNAT
-- True if compiling in GNAT system mode (-gnatg switch)
+ GNAT_Mode_Config : Boolean := False;
+ -- GNAT
+ -- True if -gnatg switch is present. GNAT_Mode may be temporary set to
+ -- True during the analysis of a system unit, but GNAT_Mode_Config must
+ -- not changed once scanned.
+
-- Setting this switch has the following effects on the language that is
-- accepted. Note that several of the following have the effect of changing
-- an error to a warning. But warnings are usually treated as fatal errors
diff --git a/gcc/ada/s-valllu.ads b/gcc/ada/s-valllu.ads
index 612004a..216ce21 100644
--- a/gcc/ada/s-valllu.ads
+++ b/gcc/ada/s-valllu.ads
@@ -62,7 +62,7 @@ package System.Val_LLU is
--
-- Note: these rules correspond to the requirements for leaving the pointer
-- positioned in Text_IO.Get. Note that the rules as stated in the RM would
- -- seem to imply that for a case like
+ -- seem to imply that for a case like:
--
-- 8#12345670009#
--
@@ -92,6 +92,15 @@ package System.Val_LLU is
-- then the pointer is also left at the initial # character, but constraint
-- error is raised reflecting the encounter of an out of range digit.
--
+ -- Finally if we have an unterminated fixed-point constant where the final
+ -- # or : character is missing, Constraint_Error is raised and the pointer
+ -- is left pointing past the last digit, as in:
+ --
+ -- 8#22
+ --
+ -- This string results in a Constraint_Error with the pointer pointing
+ -- past the second 2.
+ --
-- Note: if Str is empty, i.e. if Max is less than Ptr, then this is a
-- special case of an all-blank string, and Ptr is unchanged, and hence
-- is greater than Max as required in this case.
diff --git a/gcc/ada/s-valuns.ads b/gcc/ada/s-valuns.ads
index 54df937..cdea740 100644
--- a/gcc/ada/s-valuns.ads
+++ b/gcc/ada/s-valuns.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2014, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2015, 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- --
@@ -61,7 +61,45 @@ package System.Val_Uns is
-- Constraint_Error is raised.
--
-- Note: these rules correspond to the requirements for leaving the pointer
- -- positioned in Text_IO.Get
+ -- positioned in Text_IO.Get. Note that the rules as stated in the RM would
+ -- seem to imply that for a case like:
+ --
+ -- 8#12345670009#
+ --
+ -- the pointer should be left at the first # having scanned out the longest
+ -- valid integer literal (8), but in fact in this case the pointer points
+ -- past the final # and Constraint_Error is raised. This is the behavior
+ -- expected for Text_IO and enforced by the ACATS tests.
+ --
+ -- If a based literal is malformed in that a character other than a valid
+ -- hexadecimal digit is encountered during scanning out the digits after
+ -- the # (this includes the case of using the wrong terminator, : instead
+ -- of # or vice versa) there are two cases. If all the digits before the
+ -- non-digit are in range of the base, as in
+ --
+ -- 8#100x00#
+ -- 8#100:
+ --
+ -- then in this case, the "base" value before the initial # is returned as
+ -- the result, and the pointer points to the initial # character on return.
+ --
+ -- If an out of range digit has been detected before the invalid character,
+ -- as in:
+ --
+ -- 8#900x00#
+ -- 8#900:
+ --
+ -- then the pointer is also left at the initial # character, but constraint
+ -- error is raised reflecting the encounter of an out of range digit.
+ --
+ -- Finally if we have an unterminated fixed-point constant where the final
+ -- # or : character is missing, Constraint_Error is raised and the pointer
+ -- is left pointing past the last digit, as in:
+ --
+ -- 8#22
+ --
+ -- This string results in a Constraint_Error with the pointer pointing
+ -- past the second 2.
--
-- Note: if Str is empty, i.e. if Max is less than Ptr, then this is a
-- special case of an all-blank string, and Ptr is unchanged, and hence
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index 4f2f06e..7e8f50e 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -821,6 +821,7 @@ package body Switch.C is
when 'g' =>
Ptr := Ptr + 1;
GNAT_Mode := True;
+ GNAT_Mode_Config := True;
Identifier_Character_Set := 'n';
System_Extend_Unit := Empty;
Warning_Mode := Treat_As_Error;