Commit 41c15e3e by Arnaud Charlet

[multiple changes]

2012-11-06  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_prag.adb: Add with and use clause for Sem_Ch8.
	(Expand_N_Pragma): Add a new variant to expand pragma Loop_Assertion.
	(Expand_Pragma_Loop_Assertion): New routine.
	* par-prag.adb (Prag): The semantic analysis of pragma
	Loop_Assertion is carried out by Analyze_Pragma. No need for
	checks in the parser.
	* sem_prag.adb: Add a reference position value for pragma
	Loop_Assertion in Sig_Flags.
	(Analyze_Pragma): Add semantic analysis for pragma Loop_Assertion.
	* snames.ads-tmpl: Add the following new names:
	Name_Decreases Name_Increases Name_Loop_Assertion.
	Add new pragma id Pragma_Loop_Assertion.

2012-11-06  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch5.adb: Identifier in iterator must have debug
	information.

From-SVN: r193211
parent 11e18556
2012-11-06 Hristian Kirtchev <kirtchev@adacore.com>
* exp_prag.adb: Add with and use clause for Sem_Ch8.
(Expand_N_Pragma): Add a new variant to expand pragma Loop_Assertion.
(Expand_Pragma_Loop_Assertion): New routine.
* par-prag.adb (Prag): The semantic analysis of pragma
Loop_Assertion is carried out by Analyze_Pragma. No need for
checks in the parser.
* sem_prag.adb: Add a reference position value for pragma
Loop_Assertion in Sig_Flags.
(Analyze_Pragma): Add semantic analysis for pragma Loop_Assertion.
* snames.ads-tmpl: Add the following new names:
Name_Decreases Name_Increases Name_Loop_Assertion.
Add new pragma id Pragma_Loop_Assertion.
2012-11-06 Ed Schonberg <schonberg@adacore.com>
* exp_ch5.adb: Identifier in iterator must have debug
information.
2012-11-06 Arnaud Charlet <charlet@adacore.com> 2012-11-06 Arnaud Charlet <charlet@adacore.com>
* gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Remove * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Remove
......
...@@ -3108,6 +3108,11 @@ package body Exp_Ch5 is ...@@ -3108,6 +3108,11 @@ package body Exp_Ch5 is
Expressions => Expressions =>
New_List (New_Occurrence_Of (Cursor, Loc)))); New_List (New_Occurrence_Of (Cursor, Loc))));
-- The defining identifier in the iterator is user-visible
-- and must be visible in the debugger.
Set_Debug_Info_Needed (Id);
-- If the container holds controlled objects, wrap the loop -- If the container holds controlled objects, wrap the loop
-- statements and element renaming declaration with a block. -- statements and element renaming declaration with a block.
-- This ensures that the result of Element (Cusor) is -- This ensures that the result of Element (Cusor) is
......
...@@ -1188,6 +1188,7 @@ begin ...@@ -1188,6 +1188,7 @@ begin
Pragma_Lock_Free | Pragma_Lock_Free |
Pragma_Locking_Policy | Pragma_Locking_Policy |
Pragma_Long_Float | Pragma_Long_Float |
Pragma_Loop_Assertion |
Pragma_Machine_Attribute | Pragma_Machine_Attribute |
Pragma_Main | Pragma_Main |
Pragma_Main_Storage | Pragma_Main_Storage |
......
...@@ -11284,6 +11284,84 @@ package body Sem_Prag is ...@@ -11284,6 +11284,84 @@ package body Sem_Prag is
Set_Standard_Fpt_Formats; Set_Standard_Fpt_Formats;
end Long_Float; end Long_Float;
--------------------
-- Loop_Assertion --
--------------------
-- pragma Loop_Assertion (
-- [[Invariant =>] boolean_EXPRESSION],
-- {CHANGE_MODE => discrete_EXPRESSION} );
--
-- CHANGE_MODE ::= Increases | Decreases
when Pragma_Loop_Assertion => Loop_Assertion : declare
Arg : Node_Id;
Expr : Node_Id;
Seen : Boolean := False;
Stmt : Node_Id;
begin
GNAT_Pragma;
S14_Pragma;
-- Completely ignore if disabled
if Check_Disabled (Pname) then
Rewrite (N, Make_Null_Statement (Loc));
Analyze (N);
return;
end if;
-- Verify that the pragma appears inside a loop
Stmt := N;
while Present (Stmt) and then Nkind (Stmt) /= N_Loop_Statement loop
Stmt := Parent (Stmt);
end loop;
if No (Stmt) then
Error_Pragma ("pragma % must appear inside a loop");
end if;
Check_At_Least_N_Arguments (1);
-- Process the arguments
Arg := Arg1;
while Present (Arg) loop
Expr := Expression (Arg);
-- All expressions are preanalyzed because they will be
-- relocated during expansion and analyzed in their new
-- context.
if Chars (Arg) = Name_Invariant or else Arg_Count = 1 then
-- Only one invariant is allowed in the pragma
if Seen then
Error_Pragma_Arg
("only one invariant allowed in pragma %", Arg);
else
Seen := True;
Preanalyze_And_Resolve (Expr, Any_Boolean);
end if;
elsif Chars (Arg) = Name_Increases
or else Chars (Arg) = Name_Decreases
then
Preanalyze_And_Resolve (Expr, Any_Discrete);
-- Illegal argument
else
Error_Pragma_Arg ("argument & not allowed in pragma %", Arg);
end if;
Next (Arg);
end loop;
end Loop_Assertion;
----------------------- -----------------------
-- Machine_Attribute -- -- Machine_Attribute --
----------------------- -----------------------
...@@ -15428,6 +15506,7 @@ package body Sem_Prag is ...@@ -15428,6 +15506,7 @@ package body Sem_Prag is
Pragma_Lock_Free => -1, Pragma_Lock_Free => -1,
Pragma_Locking_Policy => -1, Pragma_Locking_Policy => -1,
Pragma_Long_Float => -1, Pragma_Long_Float => -1,
Pragma_Loop_Assertion => -1,
Pragma_Machine_Attribute => -1, Pragma_Machine_Attribute => -1,
Pragma_Main => -1, Pragma_Main => -1,
Pragma_Main_Storage => -1, Pragma_Main_Storage => -1,
......
...@@ -405,6 +405,7 @@ package Snames is ...@@ -405,6 +405,7 @@ package Snames is
Name_License : constant Name_Id := N + $; -- GNAT Name_License : constant Name_Id := N + $; -- GNAT
Name_Locking_Policy : constant Name_Id := N + $; Name_Locking_Policy : constant Name_Id := N + $;
Name_Long_Float : constant Name_Id := N + $; -- VMS Name_Long_Float : constant Name_Id := N + $; -- VMS
Name_Loop_Assertion : constant Name_Id := N + $; -- GNAT
Name_No_Run_Time : constant Name_Id := N + $; -- GNAT Name_No_Run_Time : constant Name_Id := N + $; -- GNAT
Name_No_Strict_Aliasing : constant Name_Id := N + $; -- GNAT Name_No_Strict_Aliasing : constant Name_Id := N + $; -- GNAT
Name_Normalize_Scalars : constant Name_Id := N + $; Name_Normalize_Scalars : constant Name_Id := N + $;
...@@ -670,6 +671,7 @@ package Snames is ...@@ -670,6 +671,7 @@ package Snames is
Name_Component_Size_4 : constant Name_Id := N + $; Name_Component_Size_4 : constant Name_Id := N + $;
Name_Copy : constant Name_Id := N + $; Name_Copy : constant Name_Id := N + $;
Name_D_Float : constant Name_Id := N + $; Name_D_Float : constant Name_Id := N + $;
Name_Decreases : constant Name_Id := N + $;
Name_Descriptor : constant Name_Id := N + $; Name_Descriptor : constant Name_Id := N + $;
Name_Disable : constant Name_Id := N + $; Name_Disable : constant Name_Id := N + $;
Name_Dot_Replacement : constant Name_Id := N + $; Name_Dot_Replacement : constant Name_Id := N + $;
...@@ -689,6 +691,7 @@ package Snames is ...@@ -689,6 +691,7 @@ package Snames is
Name_GPL : constant Name_Id := N + $; Name_GPL : constant Name_Id := N + $;
Name_IEEE_Float : constant Name_Id := N + $; Name_IEEE_Float : constant Name_Id := N + $;
Name_Ignore : constant Name_Id := N + $; Name_Ignore : constant Name_Id := N + $;
Name_Increases : constant Name_Id := N + $;
Name_Info : constant Name_Id := N + $; Name_Info : constant Name_Id := N + $;
Name_Internal : constant Name_Id := N + $; Name_Internal : constant Name_Id := N + $;
Name_Link_Name : constant Name_Id := N + $; Name_Link_Name : constant Name_Id := N + $;
...@@ -1675,6 +1678,7 @@ package Snames is ...@@ -1675,6 +1678,7 @@ package Snames is
Pragma_License, Pragma_License,
Pragma_Locking_Policy, Pragma_Locking_Policy,
Pragma_Long_Float, Pragma_Long_Float,
Pragma_Loop_Assertion,
Pragma_No_Run_Time, Pragma_No_Run_Time,
Pragma_No_Strict_Aliasing, Pragma_No_Strict_Aliasing,
Pragma_Normalize_Scalars, Pragma_Normalize_Scalars,
......
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