Commit 6480338a by Arnaud Charlet

[multiple changes]

2013-07-08  Robert Dewar  <dewar@adacore.com>

	* par-prag.adb (Process_Restrictions_Or_Restriction_Warnings):
	Recognize SPARK_05 as synonym for SPARK in restrictions pragma.
	* restrict.ads, restrict.adb (SPARK_Hides): Table moved to body, only
	referenced there.
	* scng.adb, sem_ch3.adb, sem_ch4.adb, sem_ch5.adb, sem_ch8.adb,
	sem_res.adb, sem_util.adb: Use restriction SPARK_05 instead of SPARK.
	* snames.ads-tmpl (Name_No_Obsolescent_Features): New entry.

2013-07-08  Vincent Celier  <celier@adacore.com>

	* gnatcmd.adb (Check_Files): Use a response file for gnatls
	when possible.

From-SVN: r200764
parent aa0dfa7e
2013-07-08 Robert Dewar <dewar@adacore.com>
* par-prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Recognize SPARK_05 as synonym for SPARK in restrictions pragma.
* restrict.ads, restrict.adb (SPARK_Hides): Table moved to body, only
referenced there.
* scng.adb, sem_ch3.adb, sem_ch4.adb, sem_ch5.adb, sem_ch8.adb,
sem_res.adb, sem_util.adb: Use restriction SPARK_05 instead of SPARK.
* snames.ads-tmpl (Name_No_Obsolescent_Features): New entry.
2013-07-08 Vincent Celier <celier@adacore.com>
* gnatcmd.adb (Check_Files): Use a response file for gnatls
when possible.
2013-07-08 Gary Dismukes <dismukes@adacore.com> 2013-07-08 Gary Dismukes <dismukes@adacore.com>
* freeze.adb: Minor typo fixes. * freeze.adb: Minor typo fixes.
......
...@@ -418,6 +418,7 @@ procedure GNATCmd is ...@@ -418,6 +418,7 @@ procedure GNATCmd is
if The_Command = Check or else if The_Command = Check or else
The_Command = Pretty or else The_Command = Pretty or else
The_Command = Metric or else The_Command = Metric or else
The_Command = List or else
The_Command = Stack The_Command = Stack
then then
Tempdir.Create_Temp_File (FD, Temp_File_Name); Tempdir.Create_Temp_File (FD, Temp_File_Name);
...@@ -552,12 +553,10 @@ procedure GNATCmd is ...@@ -552,12 +553,10 @@ procedure GNATCmd is
end if; end if;
if not Subunit then if not Subunit then
Last_Switches.Increment_Last; Add_To_Response_File
Last_Switches.Table (Last_Switches.Last) := (Get_Name_String
new String' (Unit.File_Names (Impl).Display_File),
(Get_Name_String Check_File => False);
(Unit.File_Names
(Impl).Display_File));
end if; end if;
end if; end if;
...@@ -570,10 +569,10 @@ procedure GNATCmd is ...@@ -570,10 +569,10 @@ procedure GNATCmd is
if All_Projects or else if All_Projects or else
Unit.File_Names (Spec).Project = Project Unit.File_Names (Spec).Project = Project
then then
Last_Switches.Increment_Last; Add_To_Response_File
Last_Switches.Table (Last_Switches.Last) := (Get_Name_String
new String'(Get_Name_String (Unit.File_Names (Spec).Display_File),
(Unit.File_Names (Spec).Display_File)); Check_File => False);
end if; end if;
end if; end if;
......
...@@ -235,15 +235,15 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is ...@@ -235,15 +235,15 @@ function Prag (Pragma_Node : Node_Id; Semi : Source_Ptr) return Node_Id is
if Id = No_Name if Id = No_Name
and then Nkind (Expr) = N_Identifier and then Nkind (Expr) = N_Identifier
then then
case Get_Restriction_Id (Chars (Expr)) is case Chars (Expr) is
when No_Obsolescent_Features => when Name_No_Obsolescent_Features =>
Set_Restriction (No_Obsolescent_Features, Pragma_Node); Set_Restriction (No_Obsolescent_Features, Pragma_Node);
Restriction_Warnings (No_Obsolescent_Features) := Restriction_Warnings (No_Obsolescent_Features) :=
Prag_Id = Pragma_Restriction_Warnings; Prag_Id = Pragma_Restriction_Warnings;
when SPARK => when Name_SPARK | Name_SPARK_05 =>
Set_Restriction (SPARK, Pragma_Node); Set_Restriction (SPARK_05, Pragma_Node);
Restriction_Warnings (SPARK) := Restriction_Warnings (SPARK_05) :=
Prag_Id = Pragma_Restriction_Warnings; Prag_Id = Pragma_Restriction_Warnings;
when others => when others =>
......
...@@ -41,6 +41,38 @@ with Uname; use Uname; ...@@ -41,6 +41,38 @@ with Uname; use Uname;
package body Restrict is package body Restrict is
-------------------------------
-- SPARK Restriction Control --
-------------------------------
-- SPARK HIDE directives allow the effect of the SPARK_05 restriction to be
-- turned off for a specified region of code, and the following tables are
-- the data structures used to keep track of these regions.
-- The table contains pairs of source locations, the first being the start
-- location for hidden region, and the second being the end location.
-- Note that the start location is included in the hidden region, while
-- the end location is excluded from it. (It typically corresponds to the
-- next token during scanning.)
type SPARK_Hide_Entry is record
Start : Source_Ptr;
Stop : Source_Ptr;
end record;
package SPARK_Hides is new Table.Table (
Table_Component_Type => SPARK_Hide_Entry,
Table_Index_Type => Natural,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 200,
Table_Name => "SPARK Hides");
--------------------------------
-- Package Local Declarations --
--------------------------------
Config_Cunit_Boolean_Restrictions : Save_Cunit_Boolean_Restrictions; Config_Cunit_Boolean_Restrictions : Save_Cunit_Boolean_Restrictions;
-- Save compilation unit restrictions set by config pragma files -- Save compilation unit restrictions set by config pragma files
...@@ -163,9 +195,9 @@ package body Restrict is ...@@ -163,9 +195,9 @@ package body Restrict is
is is
Msg_Issued : Boolean; Msg_Issued : Boolean;
Save_Error_Msg_Sloc : Source_Ptr; Save_Error_Msg_Sloc : Source_Ptr;
begin begin
if Force or else Comes_From_Source (Original_Node (N)) then if Force or else Comes_From_Source (Original_Node (N)) then
if Restriction_Check_Required (SPARK_05) if Restriction_Check_Required (SPARK_05)
and then Is_In_Hidden_Part_In_SPARK (Sloc (N)) and then Is_In_Hidden_Part_In_SPARK (Sloc (N))
then then
...@@ -189,11 +221,11 @@ package body Restrict is ...@@ -189,11 +221,11 @@ package body Restrict is
procedure Check_SPARK_Restriction (Msg1, Msg2 : String; N : Node_Id) is procedure Check_SPARK_Restriction (Msg1, Msg2 : String; N : Node_Id) is
Msg_Issued : Boolean; Msg_Issued : Boolean;
Save_Error_Msg_Sloc : Source_Ptr; Save_Error_Msg_Sloc : Source_Ptr;
begin begin
pragma Assert (Msg2'Length /= 0 and then Msg2 (Msg2'First) = '\'); pragma Assert (Msg2'Length /= 0 and then Msg2 (Msg2'First) = '\');
if Comes_From_Source (Original_Node (N)) then if Comes_From_Source (Original_Node (N)) then
if Restriction_Check_Required (SPARK_05) if Restriction_Check_Required (SPARK_05)
and then Is_In_Hidden_Part_In_SPARK (Sloc (N)) and then Is_In_Hidden_Part_In_SPARK (Sloc (N))
then then
......
...@@ -176,34 +176,6 @@ package Restrict is ...@@ -176,34 +176,6 @@ package Restrict is
Table_Increment => 200, Table_Increment => 200,
Table_Name => "Name_No_Dependences"); Table_Name => "Name_No_Dependences");
-------------------------------
-- SPARK Restriction Control --
-------------------------------
-- SPARK HIDE directives allow the effect of the SPARK_05 restriction to be
-- turned off for a specified region of code, and the following tables are
-- the data structures used to keep track of these regions.
-- The table contains pairs of source locations, the first being the start
-- location for hidden region, and the second being the end location.
-- Note that the start location is included in the hidden region, while
-- the end location is excluded from it. (It typically corresponds to the
-- next token during scanning.)
type SPARK_Hide_Entry is record
Start : Source_Ptr;
Stop : Source_Ptr;
end record;
package SPARK_Hides is new Table.Table (
Table_Component_Type => SPARK_Hide_Entry,
Table_Index_Type => Natural,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 200,
Table_Name => "SPARK Hides");
----------------- -----------------
-- Subprograms -- -- Subprograms --
----------------- -----------------
...@@ -380,7 +352,9 @@ package Restrict is ...@@ -380,7 +352,9 @@ package Restrict is
-- restrictions are set. -- restrictions are set.
procedure Set_Hidden_Part_In_SPARK (Loc1, Loc2 : Source_Ptr); procedure Set_Hidden_Part_In_SPARK (Loc1, Loc2 : Source_Ptr);
-- Insert a new hidden region range in the SPARK hides table -- Insert a new hidden region range in the SPARK hides table. The effect
-- is to hide any SPARK violation messages which are in the range Loc1 to
-- Loc2-1 (i.e. Loc2 is the first location for reenabling checks).
procedure Set_Profile_Restrictions procedure Set_Profile_Restrictions
(P : Profile_Name; (P : Profile_Name;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -1796,7 +1796,7 @@ package body Scng is ...@@ -1796,7 +1796,7 @@ package body Scng is
-- If the SPARK restriction is set for this unit, then generate -- If the SPARK restriction is set for this unit, then generate
-- a token Tok_SPARK_Hide for a SPARK HIDE directive. -- a token Tok_SPARK_Hide for a SPARK HIDE directive.
if Restriction_Check_Required (SPARK) if Restriction_Check_Required (SPARK_05)
and then Source (Start_Of_Comment) = '#' and then Source (Start_Of_Comment) = '#'
then then
declare declare
......
...@@ -2077,7 +2077,7 @@ package body Sem_Ch3 is ...@@ -2077,7 +2077,7 @@ package body Sem_Ch3 is
-- Start of processing for Analyze_Declarations -- Start of processing for Analyze_Declarations
begin begin
if Restriction_Check_Required (SPARK) then if Restriction_Check_Required (SPARK_05) then
Check_Later_Vs_Basic_Declarations (L, During_Parsing => False); Check_Later_Vs_Basic_Declarations (L, During_Parsing => False);
end if; end if;
...@@ -3242,7 +3242,7 @@ package body Sem_Ch3 is ...@@ -3242,7 +3242,7 @@ package body Sem_Ch3 is
-- Only call test if needed -- Only call test if needed
and then Restriction_Check_Required (SPARK) and then Restriction_Check_Required (SPARK_05)
and then not Is_SPARK_Initialization_Expr (E) and then not Is_SPARK_Initialization_Expr (E)
then then
Check_SPARK_Restriction Check_SPARK_Restriction
......
...@@ -991,7 +991,7 @@ package body Sem_Ch4 is ...@@ -991,7 +991,7 @@ package body Sem_Ch4 is
-- Start of processing for Analyze_Call -- Start of processing for Analyze_Call
begin begin
if Restriction_Check_Required (SPARK) then if Restriction_Check_Required (SPARK_05) then
Check_Mixed_Parameter_And_Named_Associations; Check_Mixed_Parameter_And_Named_Associations;
end if; end if;
......
...@@ -2867,7 +2867,7 @@ package body Sem_Ch5 is ...@@ -2867,7 +2867,7 @@ package body Sem_Ch5 is
-- we are in formal mode where goto statements are not allowed. -- we are in formal mode where goto statements are not allowed.
if Nkind (Nxt) = N_Label if Nkind (Nxt) = N_Label
and then not Restriction_Check_Required (SPARK) and then not Restriction_Check_Required (SPARK_05)
then then
return; return;
...@@ -2924,7 +2924,7 @@ package body Sem_Ch5 is ...@@ -2924,7 +2924,7 @@ package body Sem_Ch5 is
-- Now issue the warning (or error in formal mode) -- Now issue the warning (or error in formal mode)
if Restriction_Check_Required (SPARK) then if Restriction_Check_Required (SPARK_05) then
Check_SPARK_Restriction Check_SPARK_Restriction
("unreachable code is not allowed", Error_Node); ("unreachable code is not allowed", Error_Node);
else else
......
...@@ -5882,7 +5882,7 @@ package body Sem_Ch8 is ...@@ -5882,7 +5882,7 @@ package body Sem_Ch8 is
-- Selector name cannot be a character literal or an operator symbol in -- Selector name cannot be a character literal or an operator symbol in
-- SPARK, except for the operator symbol in a renaming. -- SPARK, except for the operator symbol in a renaming.
if Restriction_Check_Required (SPARK) then if Restriction_Check_Required (SPARK_05) then
if Nkind (Selector_Name (N)) = N_Character_Literal then if Nkind (Selector_Name (N)) = N_Character_Literal then
Check_SPARK_Restriction Check_SPARK_Restriction
("character literal cannot be prefixed", N); ("character literal cannot be prefixed", N);
...@@ -6222,7 +6222,7 @@ package body Sem_Ch8 is ...@@ -6222,7 +6222,7 @@ package body Sem_Ch8 is
-- Selector name is restricted in SPARK -- Selector name is restricted in SPARK
if Nkind (N) = N_Expanded_Name if Nkind (N) = N_Expanded_Name
and then Restriction_Check_Required (SPARK) and then Restriction_Check_Required (SPARK_05)
then then
if Is_Subprogram (P_Name) then if Is_Subprogram (P_Name) then
Check_SPARK_Restriction Check_SPARK_Restriction
......
...@@ -7028,7 +7028,7 @@ package body Sem_Res is ...@@ -7028,7 +7028,7 @@ package body Sem_Res is
-- Protect call to Matching_Static_Array_Bounds to avoid costly -- Protect call to Matching_Static_Array_Bounds to avoid costly
-- operation if not needed. -- operation if not needed.
if Restriction_Check_Required (SPARK) if Restriction_Check_Required (SPARK_05)
and then Base_Type (T) /= Standard_String and then Base_Type (T) /= Standard_String
and then Base_Type (Etype (L)) = Base_Type (Etype (R)) and then Base_Type (Etype (L)) = Base_Type (Etype (R))
and then Etype (L) /= Any_Composite -- or else L in error and then Etype (L) /= Any_Composite -- or else L in error
...@@ -7738,7 +7738,7 @@ package body Sem_Res is ...@@ -7738,7 +7738,7 @@ package body Sem_Res is
-- Protect call to Matching_Static_Array_Bounds to avoid costly -- Protect call to Matching_Static_Array_Bounds to avoid costly
-- operation if not needed. -- operation if not needed.
if Restriction_Check_Required (SPARK) if Restriction_Check_Required (SPARK_05)
and then Base_Type (Left_Typ) = Base_Type (Right_Typ) and then Base_Type (Left_Typ) = Base_Type (Right_Typ)
and then Left_Typ /= Any_Composite -- or Left_Opnd in error and then Left_Typ /= Any_Composite -- or Left_Opnd in error
and then Right_Typ /= Any_Composite -- or Right_Opnd in error and then Right_Typ /= Any_Composite -- or Right_Opnd in error
...@@ -8483,7 +8483,7 @@ package body Sem_Res is ...@@ -8483,7 +8483,7 @@ package body Sem_Res is
-- Protect call to Matching_Static_Array_Bounds to avoid costly -- Protect call to Matching_Static_Array_Bounds to avoid costly
-- operation if not needed. -- operation if not needed.
if Restriction_Check_Required (SPARK) if Restriction_Check_Required (SPARK_05)
and then Is_Array_Type (Target_Typ) and then Is_Array_Type (Target_Typ)
and then Is_Array_Type (Etype (Expr)) and then Is_Array_Type (Etype (Expr))
and then Etype (Expr) /= Any_Composite -- or else Expr in error and then Etype (Expr) /= Any_Composite -- or else Expr in error
...@@ -9625,7 +9625,7 @@ package body Sem_Res is ...@@ -9625,7 +9625,7 @@ package body Sem_Res is
-- Protect call to Matching_Static_Array_Bounds to avoid costly -- Protect call to Matching_Static_Array_Bounds to avoid costly
-- operation if not needed. -- operation if not needed.
if Restriction_Check_Required (SPARK) if Restriction_Check_Required (SPARK_05)
and then Is_Array_Type (Target_Typ) and then Is_Array_Type (Target_Typ)
and then Is_Array_Type (Operand_Typ) and then Is_Array_Type (Operand_Typ)
and then Operand_Typ /= Any_Composite -- or else Operand in error and then Operand_Typ /= Any_Composite -- or else Operand in error
......
...@@ -4582,7 +4582,7 @@ package body Sem_Util is ...@@ -4582,7 +4582,7 @@ package body Sem_Util is
-- Declaring a homonym is not allowed in SPARK ... -- Declaring a homonym is not allowed in SPARK ...
if Present (C) if Present (C)
and then Restriction_Check_Required (SPARK) and then Restriction_Check_Required (SPARK_05)
then then
declare declare
Enclosing_Subp : constant Node_Id := Enclosing_Subprogram (Def_Id); Enclosing_Subp : constant Node_Id := Enclosing_Subprogram (Def_Id);
...@@ -12982,7 +12982,7 @@ package body Sem_Util is ...@@ -12982,7 +12982,7 @@ package body Sem_Util is
-- subprogram bodies. Detect those cases by testing whether -- subprogram bodies. Detect those cases by testing whether
-- Process_End_Label was called for a body (Typ = 't') or a package. -- Process_End_Label was called for a body (Typ = 't') or a package.
if Restriction_Check_Required (SPARK) if Restriction_Check_Required (SPARK_05)
and then (Typ = 't' or else Ekind (Ent) = E_Package) and then (Typ = 't' or else Ekind (Ent) = E_Package)
then then
Error_Msg_Node_1 := Endl; Error_Msg_Node_1 := Endl;
......
...@@ -733,6 +733,7 @@ package Snames is ...@@ -733,6 +733,7 @@ package Snames is
Name_No_Dynamic_Attachment : constant Name_Id := N + $; Name_No_Dynamic_Attachment : constant Name_Id := N + $;
Name_No_Dynamic_Interrupts : constant Name_Id := N + $; Name_No_Dynamic_Interrupts : constant Name_Id := N + $;
Name_No_Implementation_Extensions : constant Name_Id := N + $; Name_No_Implementation_Extensions : constant Name_Id := N + $;
Name_No_Obsolescent_Features : constant Name_Id := N + $;
Name_No_Requeue : constant Name_Id := N + $; Name_No_Requeue : constant Name_Id := N + $;
Name_No_Requeue_Statements : constant Name_Id := N + $; Name_No_Requeue_Statements : constant Name_Id := N + $;
Name_No_Specification_Of_Aspect : constant Name_Id := N + $; Name_No_Specification_Of_Aspect : constant Name_Id := N + $;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment