+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.
-- --
-- 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- --
-- 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;
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;
-- 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
--
-- 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#
--
-- 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.
-- --
-- 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- --
-- 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
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;