[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
This commit is contained in:
Arnaud Charlet 2015-02-20 15:26:06 +01:00
parent cd8e18e73d
commit 9ec98e13b9
6 changed files with 84 additions and 8 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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;