Commit 273adcdf by Arnaud Charlet

[multiple changes]

2011-08-02  Jerome Guitton  <guitton@adacore.com>

	* a-except-2005.adb (Raise_From_Signal_Handler): Call
	Debug_Raise_Exception before propagation starts.

2011-08-02  Eric Botcazou  <ebotcazou@adacore.com>

	* exp_ch6.adb (Expand_Call): Guard restriction checks with a call
	to Restriction_Check_Required.
	* sem_ch3.adb (Analyze_Object_Declaration): Likewise.
	* sem_res.adb (Resolve_Call): Likewise.
	* sem_attr.adb (Check_Stream_Attribute): Likewise.

2011-08-02  Bob Duff  <duff@adacore.com>

	* stylesw.ads: Update comment.
	* style.adb: Minor: Use Error_Msg_NE instead of Error_Msg_N.
	* errout.ads: Remove obsolete comment.

2011-08-02  Javier Miranda  <miranda@adacore.com>

	* einfo.ads, einfo.adb (Is_Safe_To_Reevaluate): new function.
	(Set_Is_Safe_To_Reevaluate): new procedure.
	* sem_ch5.adb (Analyze_Assignment): Add one assertion to ensure that no
	assignment is allowed on safe-to-reevaluate variables.
	(Analyze_Iteration_Schine.Process_Bounds.One_Bound): Decorate the
	temporary created to remove side effects in expressions that use
	the secondary stack as safe-to-reevaluate.
	* exp_util.adb (Side_Effect_Free): Add missing code to handle well
	variables that are not true constants.

From-SVN: r177129
parent 6320f5e1
2011-08-02 Jerome Guitton <guitton@adacore.com>
* a-except-2005.adb (Raise_From_Signal_Handler): Call
Debug_Raise_Exception before propagation starts.
2011-08-02 Eric Botcazou <ebotcazou@adacore.com>
* exp_ch6.adb (Expand_Call): Guard restriction checks with a call
to Restriction_Check_Required.
* sem_ch3.adb (Analyze_Object_Declaration): Likewise.
* sem_res.adb (Resolve_Call): Likewise.
* sem_attr.adb (Check_Stream_Attribute): Likewise.
2011-08-02 Bob Duff <duff@adacore.com>
* stylesw.ads: Update comment.
* style.adb: Minor: Use Error_Msg_NE instead of Error_Msg_N.
* errout.ads: Remove obsolete comment.
2011-08-02 Javier Miranda <miranda@adacore.com>
* einfo.ads, einfo.adb (Is_Safe_To_Reevaluate): new function.
(Set_Is_Safe_To_Reevaluate): new procedure.
* sem_ch5.adb (Analyze_Assignment): Add one assertion to ensure that no
assignment is allowed on safe-to-reevaluate variables.
(Analyze_Iteration_Schine.Process_Bounds.One_Bound): Decorate the
temporary created to remove side effects in expressions that use
the secondary stack as safe-to-reevaluate.
* exp_util.adb (Side_Effect_Free): Add missing code to handle well
variables that are not true constants.
2011-08-02 Robert Dewar <dewar@adacore.com>
* sem_ch5.adb, sem_ch7.adb, einfo.ads, sem_util.adb, sem_util.ads,
......
......@@ -924,6 +924,7 @@ package body Ada.Exceptions is
begin
Exception_Data.Set_Exception_C_Msg (E, M);
Abort_Defer.all;
Debug_Raise_Exception (E => SSL.Exception_Data_Ptr (E));
Exception_Propagation.Propagate_Exception
(E => E, From_Signal_Handler => True);
end Raise_From_Signal_Handler;
......
......@@ -514,9 +514,9 @@ package body Einfo is
-- Is_Underlying_Record_View Flag246
-- OK_To_Rename Flag247
-- Has_Inheritable_Invariants Flag248
-- Is_Safe_To_Reevaluate Flag249
-- Has_Predicates Flag250
-- (unused) Flag249
-- (unused) Flag251
-- (unused) Flag252
-- (unused) Flag253
......@@ -2058,6 +2058,11 @@ package body Einfo is
return Flag209 (Id);
end Is_Return_Object;
function Is_Safe_To_Reevaluate (Id : E) return B is
begin
return Flag249 (Id);
end Is_Safe_To_Reevaluate;
function Is_Shared_Passive (Id : E) return B is
begin
return Flag60 (Id);
......@@ -4542,6 +4547,12 @@ package body Einfo is
Set_Flag209 (Id, V);
end Set_Is_Return_Object;
procedure Set_Is_Safe_To_Reevaluate (Id : E; V : B := True) is
begin
pragma Assert (Ekind (Id) = E_Variable);
Set_Flag249 (Id, V);
end Set_Is_Safe_To_Reevaluate;
procedure Set_Is_Shared_Passive (Id : E; V : B := True) is
begin
Set_Flag60 (Id, V);
......@@ -7501,6 +7512,7 @@ package body Einfo is
W ("Is_Remote_Types", Flag61 (Id));
W ("Is_Renaming_Of_Object", Flag112 (Id));
W ("Is_Return_Object", Flag209 (Id));
W ("Is_Safe_To_Reevaluate", Flag249 (Id));
W ("Is_Shared_Passive", Flag60 (Id));
W ("Is_Statically_Allocated", Flag28 (Id));
W ("Is_Tag", Flag78 (Id));
......
......@@ -2683,6 +2683,12 @@ package Einfo is
-- Present in all object entities. True if the object is the return
-- object of an extended_return_statement; False otherwise.
-- Is_Safe_To_Reevaluate (Flag249)
-- Present in all entities. Set in variables that are initialized by
-- means of an assignment statement. When initialized their contents
-- never change and hence they can be seen by the backend as constants.
-- See also Is_True_Constant.
-- Is_Scalar_Type (synthesized)
-- Applies to all entities, true for scalar types and subtypes
......@@ -2771,7 +2777,7 @@ package Einfo is
-- treated as a constant by the code generator. For a constant, it means
-- that the constant was not modified by generated code (e.g. to set a
-- discriminant in an init proc). Assignments by user or generated code
-- will reset this flag.
-- will reset this flag. See also Is_Safe_To_Reevaluate.
-- Is_Type (synthesized)
-- Applies to all entities, true for a type entity
......@@ -5659,6 +5665,7 @@ package Einfo is
-- Has_Volatile_Components (Flag87)
-- Is_Atomic (Flag85)
-- Is_Eliminated (Flag124)
-- Is_Safe_To_Reevaluate (Flag249)
-- Is_Shared_Passive (Flag60)
-- Is_True_Constant (Flag163)
-- Is_Volatile (Flag16)
......@@ -6165,6 +6172,7 @@ package Einfo is
function Is_Remote_Types (Id : E) return B;
function Is_Renaming_Of_Object (Id : E) return B;
function Is_Return_Object (Id : E) return B;
function Is_Safe_To_Reevaluate (Id : E) return B;
function Is_Shared_Passive (Id : E) return B;
function Is_Statically_Allocated (Id : E) return B;
function Is_Tag (Id : E) return B;
......@@ -6753,6 +6761,7 @@ package Einfo is
procedure Set_Is_Remote_Types (Id : E; V : B := True);
procedure Set_Is_Renaming_Of_Object (Id : E; V : B := True);
procedure Set_Is_Return_Object (Id : E; V : B := True);
procedure Set_Is_Safe_To_Reevaluate (Id : E; V : B := True);
procedure Set_Is_Shared_Passive (Id : E; V : B := True);
procedure Set_Is_Statically_Allocated (Id : E; V : B := True);
procedure Set_Is_Tag (Id : E; V : B := True);
......@@ -7480,6 +7489,7 @@ package Einfo is
pragma Inline (Is_Remote_Types);
pragma Inline (Is_Renaming_Of_Object);
pragma Inline (Is_Return_Object);
pragma Inline (Is_Safe_To_Reevaluate);
pragma Inline (Is_Scalar_Type);
pragma Inline (Is_Shared_Passive);
pragma Inline (Is_Signed_Integer_Type);
......@@ -7882,6 +7892,7 @@ package Einfo is
pragma Inline (Set_Is_Remote_Types);
pragma Inline (Set_Is_Renaming_Of_Object);
pragma Inline (Set_Is_Return_Object);
pragma Inline (Set_Is_Safe_To_Reevaluate);
pragma Inline (Set_Is_Shared_Passive);
pragma Inline (Set_Is_Statically_Allocated);
pragma Inline (Set_Is_Tag);
......
......@@ -624,8 +624,7 @@ package Errout is
-- (parameters ....)
-- Any message marked with this -- CODEFIX comment should not be modified
-- without appropriate coordination. If new messages are added which may
-- be susceptible to automatic codefix action, they are marked using:
-- without appropriate coordination.
------------------------------
-- Error Output Subprograms --
......
......@@ -2936,12 +2936,15 @@ package body Exp_Ch6 is
-- Check for violation of No_Abort_Statements
if Is_RTE (Subp, RE_Abort_Task) then
if Restriction_Check_Required (No_Abort_Statements)
and then Is_RTE (Subp, RE_Abort_Task)
then
Check_Restriction (No_Abort_Statements, Call_Node);
-- Check for violation of No_Dynamic_Attachment
elsif RTU_Loaded (Ada_Interrupts)
elsif Restriction_Check_Required (No_Dynamic_Attachment)
and then RTU_Loaded (Ada_Interrupts)
and then (Is_RTE (Subp, RE_Is_Reserved) or else
Is_RTE (Subp, RE_Is_Attached) or else
Is_RTE (Subp, RE_Current_Handler) or else
......
......@@ -1646,9 +1646,10 @@ package body Sem_Attr is
-- Check special case of Exception_Id and Exception_Occurrence which
-- are not allowed for restriction No_Exception_Registration.
if Is_RTE (P_Type, RE_Exception_Id)
or else
Is_RTE (P_Type, RE_Exception_Occurrence)
if Restriction_Check_Required (No_Exception_Registration)
and then (Is_RTE (P_Type, RE_Exception_Id)
or else
Is_RTE (P_Type, RE_Exception_Occurrence))
then
Check_Restriction (No_Exception_Registration, P);
end if;
......
......@@ -3671,8 +3671,9 @@ package body Sem_Ch3 is
-- Check for violation of No_Local_Timing_Events
if Is_RTE (Etype (Id), RE_Timing_Event)
if Restriction_Check_Required (No_Local_Timing_Events)
and then not Is_Library_Level_Entity (Id)
and then Is_RTE (Etype (Id), RE_Timing_Event)
then
Check_Restriction (No_Local_Timing_Events, N);
end if;
......
......@@ -257,6 +257,13 @@ package body Sem_Ch5 is
Analyze (Rhs);
Analyze (Lhs);
-- Ensure that we never do an assignment on a variable marked as
-- as Safe_To_Reevaluate.
pragma Assert (not Is_Entity_Name (Lhs)
or else Ekind (Entity (Lhs)) /= E_Variable
or else not Is_Safe_To_Reevaluate (Entity (Lhs)));
-- Start type analysis for assignment
T1 := Etype (Lhs);
......@@ -1603,7 +1610,7 @@ package body Sem_Ch5 is
Id := Make_Temporary (Loc, 'R', Original_Bound);
-- Here we make a declaration with a separate assignment
-- statement, and insert before loop header.
-- statement, and insert before loop header.
Decl :=
Make_Object_Declaration (Loc,
......@@ -1625,6 +1632,15 @@ package body Sem_Ch5 is
Insert_Actions (Parent (N), New_List (Decl, Assign));
-- Now that this temporary variable is initialized we decorate it
-- as safe-to-reevaluate to inform to the backend that no further
-- asignment will be issued and hence it can be handled as side
-- effect free. Note that this decoration must be done when the
-- assignment has been analyzed because otherwise it will be
-- rejected (see Analyze_Assignment).
Set_Is_Safe_To_Reevaluate (Id);
Rewrite (Original_Bound, New_Occurrence_Of (Id, Loc));
if Nkind (Assign) = N_Assignment_Statement then
......
......@@ -5702,9 +5702,10 @@ package body Sem_Res is
-- Check for violation of restriction No_Specific_Termination_Handlers
-- and warn on a potentially blocking call to Abort_Task.
if Is_RTE (Nam, RE_Set_Specific_Handler)
or else
Is_RTE (Nam, RE_Specific_Handler)
if Restriction_Check_Required (No_Specific_Termination_Handlers)
and then (Is_RTE (Nam, RE_Set_Specific_Handler)
or else
Is_RTE (Nam, RE_Specific_Handler))
then
Check_Restriction (No_Specific_Termination_Handlers, N);
......@@ -5717,7 +5718,8 @@ package body Sem_Res is
-- need to check the second argument to determine whether it is an
-- absolute or relative timing event.
if Is_RTE (Nam, RE_Set_Handler)
if Restriction_Check_Required (No_Relative_Delay)
and then Is_RTE (Nam, RE_Set_Handler)
and then Is_RTE (Etype (Next_Actual (First_Actual (N))), RE_Time_Span)
then
Check_Restriction (No_Relative_Delay, N);
......
......@@ -236,18 +236,14 @@ package body Style is
procedure Missing_Overriding (N : Node_Id; E : Entity_Id) is
begin
-- Note that Error_Msg_NE, which would be more natural to use here,
-- is not visible from this generic unit ???
Error_Msg_Name_1 := Chars (E);
if Style_Check_Missing_Overriding and then Comes_From_Source (N) then
if Nkind (N) = N_Subprogram_Body then
Error_Msg_N -- CODEFIX
("(style) missing OVERRIDING indicator in body of%", N);
Error_Msg_NE -- CODEFIX
("(style) missing OVERRIDING indicator in body of&", N, E);
else
Error_Msg_N -- CODEFIX
("(style) missing OVERRIDING indicator in declaration of%", N);
Error_Msg_NE -- CODEFIX
("(style) missing OVERRIDING indicator in declaration of&",
N, E);
end if;
end if;
end Missing_Overriding;
......
......@@ -174,8 +174,8 @@ package Stylesw is
Style_Check_Missing_Overriding : Boolean := False;
-- This can be set True by using the -gnatyO switch. If it is True, then
-- "[not] overriding" is required in subprogram declarations and bodies
-- where appropriate.
-- "overriding" is required in subprogram declarations and bodies where
-- appropriate. Note that "not overriding" is never required.
Style_Check_Mode_In : Boolean := False;
-- This can be set True by using -gnatyI. If True, it activates checking
......
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