diff options
author | Hristian Kirtchev <kirtchev@adacore.com> | 2015-10-16 10:54:13 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2015-10-16 12:54:13 +0200 |
commit | 1af4455aacd8aeb3a4ca59e7024cc8a0829e4134 (patch) | |
tree | 092351961339d6743fc1f4b6f5b750838d3bb3e7 /gcc/ada/sem_ch3.adb | |
parent | f7bad97d6316243751539113e0063cd6e5712491 (diff) | |
download | gcc-1af4455aacd8aeb3a4ca59e7024cc8a0829e4134.zip gcc-1af4455aacd8aeb3a4ca59e7024cc8a0829e4134.tar.gz gcc-1af4455aacd8aeb3a4ca59e7024cc8a0829e4134.tar.bz2 |
exp_ch3.adb (Expand_N_Full_Type_Declaration): Do not capture, set and restore the Ghost mode.
2015-10-16 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch3.adb (Expand_N_Full_Type_Declaration): Do not capture,
set and restore the Ghost mode.
(Expand_N_Object_Declaration): Do not capture, set and restore the
Ghost mode.
(Freeze_Type): Redo the capture and restore of the Ghost mode.
(Restore_Globals): Removed.
* exp_ch5.adb (Expand_N_Assignment_Statement): Redo the capture
and restore of the Ghost mode.
(Restore_Globals): Removed.
* exp_ch6.adb (Expand_N_Procedure_Call_Statement):
Redo the capture and restore of the Ghost mode.
(Expand_N_Subprogram_Body): Redo the capture, set and restore
of the Ghost mode.
(Expand_N_Subprogram_Declaration): Do not
capture, set and restore the Ghost mode.
(Restore_Globals): Removed.
* exp_ch7.adb (Expand_N_Package_Body): Redo the capture, set
and restore of the Ghost mode.
(Expand_N_Package_Declaration): Do not capture, set and restore the
Ghost mode.
* exp_ch8.adb (Expand_N_Exception_Renaming_Declaration):
Redo the capture and restore of the Ghost mode.
(Expand_N_Object_Renaming_Declaration): Redo
the capture and restore of the Ghost mode.
(Expand_N_Package_Renaming_Declaration):
Redo the capture and restore of the Ghost mode.
(Expand_N_Subprogram_Renaming_Declaration): Redo the capture
and restore of the Ghost mode.
* exp_ch11.adb Remove with and use clauses for Ghost.
(Expand_N_Exception_Declaration): Do not capture, set and restore
the Ghost mode.
* exp_disp.adb (Make_DT): Redo the capture and restore of the
Ghost mode.
(Restore_Globals): Removed.
* exp_prag.adb (Expand_Pragma_Check): Do not capture, set
and restore the Ghost mode.
(Expand_Pragma_Contract_Cases):
Redo the capture and restore of the Ghost mode. Preserve the
original context of contract cases by setting / resetting the
In_Assertion_Expr counter.
(Expand_Pragma_Initial_Condition):
Redo the capture and restore of the Ghost mode.
(Expand_Pragma_Loop_Variant): Redo the capture and restore of
the Ghost mode.
(Restore_Globals): Removed.
* exp_util.adb (Make_Predicate_Call): Redo the capture and
restore of the Ghost mode.
(Restore_Globals): Removed.
* freeze.adb (Freeze_Entity): Redo the capture and restore of
the Ghost mode.
(Restore_Globals): Removed.
* ghost.adb (Check_Ghost_Context): Remove the RM reference from
the error message.
(Is_OK_Statement): Account for statements
that appear in assertion expressions.
(Is_Subject_To_Ghost):
Moved from spec.
* ghost.ads (Is_Subject_To_Ghost): Moved to body.
* rtsfind.ads (Load_RTU): Redo the capture and restore of the
Ghost mode.
* sem.adb Add with and use clauses for Ghost.
(Analyze): Redo
the capture and restore of the Ghost mode. Set the Ghost mode
when analyzing a declaration.
(Do_Analyze): Redo the capture
and restore of the Ghost mode.
* sem_ch3.adb (Analyze_Full_Type_Declaration): Do not capture, set
and restore the Ghost mode.
(Analyze_Incomplete_Type_Decl):
Do not capture, set and restore the Ghost mode.
(Analyze_Number_Declaration): Do not capture, set and restore the
Ghost mode.
(Analyze_Object_Declaration): Do not capture, set and
restore the Ghost mode.
(Analyze_Private_Extension_Declaration):
Do not capture, set and restore the Ghost mode.
(Analyze_Subtype_Declaration): Do not capture, set and restore
the Ghost mode.
(Restore_Globals): Removed.
* sem_ch5.adb (Analyze_Assignment): Redo the capture and restore
of the Ghost mode.
(Restore_Globals): Removed.
* sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration):
Do not capture, set and restore the Ghost mode.
(Analyze_Procedure_Call): Redo the capture and restore of the
Ghost mode.
(Analyze_Subprogram_Body_Helper): Redo the capture
and restore of the Ghost mode. (Analyze_Subprogram_Declaration):
Do not capture, set and restore the Ghost mode.
(Restore_Globals): Removed.
* sem_ch7.adb (Analyze_Package_Body_Helper): Redo the capture and
restore of the Ghost mode.
(Analyze_Package_Declaration):
Do not capture, set and restore the Ghost mode.
(Analyze_Private_Type_Declaration): Do not capture, set and
restore the Ghost mode.
(Restore_Globals): Removed.
* sem_ch8.adb (Analyze_Exception_Renaming): Do not capture,
set and restore the Ghost mode.
(Analyze_Generic_Renaming): Do not capture, set and restore the Ghost
mode.
(Analyze_Object_Renaming): Do not capture, set and restore the
Ghost mode.
(Analyze_Package_Renaming): Do not capture, set and restore the Ghost
mode.
(Analyze_Subprogram_Renaming): Do not capture, set and restore the
Ghost mode.
(Restore_Globals): Removed.
* sem_ch11.adb (Analyze_Exception_Declaration): Do not capture,
set and restore the Ghost mode.
* sem_ch12.adb (Analyze_Generic_Package_Declaration):
Do not capture, set and restore the Ghost mode.
(Analyze_Generic_Subprogram_Declaration): Do not capture, set
and restore the Ghost mode.
* sem_ch13.adb (Build_Invariant_Procedure_Declaration): Redo
the capture and restore of the Ghost mode.
* sem_prag.adb (Analyze_Contract_Cases_In_Decl_Part):
Redo the capture and restore of the Ghost mode.
(Analyze_External_Property_In_Decl_Part):
Redo the capture and restore of the Ghost mode.
(Analyze_Initial_Condition_In_Decl_Part): Redo the
capture and restore of the Ghost mode. (Analyze_Pragma):
Do not capture, set and restore the Ghost mode for Assert.
Redo the capture and restore of the Ghost mode for Check. Do
not capture and restore the Ghost mode for Invariant.
(Analyze_Pre_Post_Condition_In_Decl_Part): Redo the capture and
restore of the Ghost mode.
* sem_res.adb (Resolve): Capture, set and restore the Ghost mode
when resolving a declaration.
* sem_util.adb (Build_Default_Init_Cond_Procedure_Body):
Redo the capture and restore of the Ghost mode.
(Build_Default_Init_Cond_Procedure_Declaration): Redo the capture
and restore of the Ghost mode.
From-SVN: r228871
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r-- | gcc/ada/sem_ch3.adb | 129 |
1 files changed, 17 insertions, 112 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 62cc791..9fec595 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -2556,9 +2556,8 @@ package body Sem_Ch3 is ----------------------------------- procedure Analyze_Full_Type_Declaration (N : Node_Id) is - Def : constant Node_Id := Type_Definition (N); - Def_Id : constant Entity_Id := Defining_Identifier (N); - GM : constant Ghost_Mode_Type := Ghost_Mode; + Def : constant Node_Id := Type_Definition (N); + Def_Id : constant Entity_Id := Defining_Identifier (N); T : Entity_Id; Prev : Entity_Id; @@ -2576,9 +2575,6 @@ package body Sem_Ch3 is -- list later in Sem_Disp.Check_Operation_From_Incomplete_Type (which -- is called from Process_Incomplete_Dependents). - procedure Restore_Globals; - -- Restore the values of all saved global variables - ------------------------------------ -- Check_Ops_From_Incomplete_Type -- ------------------------------------ @@ -2616,26 +2612,11 @@ package body Sem_Ch3 is end if; end Check_Ops_From_Incomplete_Type; - --------------------- - -- Restore_Globals -- - --------------------- - - procedure Restore_Globals is - begin - Ghost_Mode := GM; - end Restore_Globals; - -- Start of processing for Analyze_Full_Type_Declaration begin Prev := Find_Type_Name (N); - -- The type declaration may be subject to pragma Ghost with policy - -- Ignore. Set the mode now to ensure that any nodes generated during - -- analysis and expansion are properly flagged as ignored Ghost. - - Set_Ghost_Mode (N, Prev); - -- The full view, if present, now points to the current type. If there -- is an incomplete partial view, set a link to it, to simplify the -- retrieval of primitive operations of the type. @@ -2773,7 +2754,6 @@ package body Sem_Ch3 is end if; if Etype (T) = Any_Type then - Restore_Globals; return; end if; @@ -2914,8 +2894,6 @@ package body Sem_Ch3 is Analyze_Aspect_Specifications (N, Def_Id); end if; end if; - - Restore_Globals; end Analyze_Full_Type_Declaration; ---------------------------------- @@ -2923,18 +2901,12 @@ package body Sem_Ch3 is ---------------------------------- procedure Analyze_Incomplete_Type_Decl (N : Node_Id) is - F : constant Boolean := Is_Pure (Current_Scope); - GM : constant Ghost_Mode_Type := Ghost_Mode; - T : Entity_Id; + F : constant Boolean := Is_Pure (Current_Scope); + T : Entity_Id; begin Check_SPARK_05_Restriction ("incomplete type is not allowed", N); - -- The incomplete type declaration may be subject to pragma Ghost with - -- policy Ignore. Set the mode now to ensure that any nodes generated - -- during analysis and expansion are properly flagged as ignored Ghost. - - Set_Ghost_Mode (N); Generate_Definition (Defining_Identifier (N)); -- Process an incomplete declaration. The identifier must not have been @@ -2984,11 +2956,6 @@ package body Sem_Ch3 is Set_Private_Dependents (T, New_Elmt_List); Set_Is_Pure (T, F); - - -- Restore the original Ghost mode once analysis and expansion have - -- taken place. - - Ghost_Mode := GM; end Analyze_Incomplete_Type_Decl; ----------------------------------- @@ -3063,37 +3030,13 @@ package body Sem_Ch3 is -------------------------------- procedure Analyze_Number_Declaration (N : Node_Id) is - GM : constant Ghost_Mode_Type := Ghost_Mode; - - procedure Restore_Globals; - -- Restore the values of all saved global variables - - --------------------- - -- Restore_Globals -- - --------------------- - - procedure Restore_Globals is - begin - Ghost_Mode := GM; - end Restore_Globals; - - -- Local variables - E : constant Node_Id := Expression (N); Id : constant Entity_Id := Defining_Identifier (N); Index : Interp_Index; It : Interp; T : Entity_Id; - -- Start of processing for Analyze_Number_Declaration - begin - -- The number declaration may be subject to pragma Ghost with policy - -- Ignore. Set the mode now to ensure that any nodes generated during - -- analysis and expansion are properly flagged as ignored Ghost. - - Set_Ghost_Mode (N); - Generate_Definition (Id); Enter_Name (Id); @@ -3113,8 +3056,6 @@ package body Sem_Ch3 is Set_Etype (Id, Universal_Integer); Set_Ekind (Id, E_Named_Integer); Set_Is_Frozen (Id, True); - - Restore_Globals; return; end if; @@ -3216,8 +3157,6 @@ package body Sem_Ch3 is Set_Ekind (Id, E_Constant); Set_Never_Set_In_Source (Id, True); Set_Is_True_Constant (Id, True); - - Restore_Globals; return; end if; @@ -3231,8 +3170,6 @@ package body Sem_Ch3 is Rewrite (E, Make_Integer_Literal (Sloc (N), 1)); Set_Etype (E, Any_Type); end if; - - Restore_Globals; end Analyze_Number_Declaration; ----------------------------- @@ -3406,9 +3343,8 @@ package body Sem_Ch3 is -------------------------------- procedure Analyze_Object_Declaration (N : Node_Id) is - Loc : constant Source_Ptr := Sloc (N); - GM : constant Ghost_Mode_Type := Ghost_Mode; - Id : constant Entity_Id := Defining_Identifier (N); + Loc : constant Source_Ptr := Sloc (N); + Id : constant Entity_Id := Defining_Identifier (N); Act_T : Entity_Id; T : Entity_Id; @@ -3437,9 +3373,6 @@ package body Sem_Ch3 is -- Any other relevant delayed aspects on object declarations ??? - procedure Restore_Globals; - -- Restore the values of all saved global variables - ----------------- -- Count_Tasks -- ----------------- @@ -3518,14 +3451,9 @@ package body Sem_Ch3 is return False; end Delayed_Aspect_Present; - --------------------- - -- Restore_Globals -- - --------------------- + -- Local variables - procedure Restore_Globals is - begin - Ghost_Mode := GM; - end Restore_Globals; + Save_Ghost_Mode : constant Ghost_Mode_Type := Ghost_Mode; -- Start of processing for Analyze_Object_Declaration @@ -3580,9 +3508,10 @@ package body Sem_Ch3 is end if; end if; - -- The object declaration may be subject to pragma Ghost with policy - -- Ignore. Set the mode now to ensure that any nodes generated during - -- analysis and expansion are properly flagged as ignored Ghost. + -- The object declaration is Ghost when it is subject to pragma Ghost or + -- completes a deferred Ghost constant. Set the mode now to ensure that + -- any nodes generated during analysis and expansion are properly marked + -- as Ghost. Set_Ghost_Mode (N, Prev_Entity); @@ -3866,7 +3795,7 @@ package body Sem_Ch3 is and then Analyzed (N) and then No (Expression (N)) then - Restore_Globals; + Ghost_Mode := Save_Ghost_Mode; return; end if; @@ -4139,7 +4068,7 @@ package body Sem_Ch3 is Freeze_Before (N, T); Set_Is_Frozen (Id); - Restore_Globals; + Ghost_Mode := Save_Ghost_Mode; return; else @@ -4522,7 +4451,7 @@ package body Sem_Ch3 is Check_No_Hidden_State (Id); end if; - Restore_Globals; + Ghost_Mode := Save_Ghost_Mode; end Analyze_Object_Declaration; --------------------------- @@ -4543,19 +4472,12 @@ package body Sem_Ch3 is ------------------------------------------- procedure Analyze_Private_Extension_Declaration (N : Node_Id) is - GM : constant Ghost_Mode_Type := Ghost_Mode; - Indic : constant Node_Id := Subtype_Indication (N); - T : constant Entity_Id := Defining_Identifier (N); + Indic : constant Node_Id := Subtype_Indication (N); + T : constant Entity_Id := Defining_Identifier (N); Parent_Base : Entity_Id; Parent_Type : Entity_Id; begin - -- The private extension declaration may be subject to pragma Ghost with - -- policy Ignore. Set the mode now to ensure that any nodes generated - -- during analysis and expansion are properly flagged as ignored Ghost. - - Set_Ghost_Mode (N); - -- Ada 2005 (AI-251): Decorate all names in list of ancestor interfaces if Is_Non_Empty_List (Interface_List (N)) then @@ -4769,11 +4691,6 @@ package body Sem_Ch3 is if Has_Aspects (N) then Analyze_Aspect_Specifications (N, T); end if; - - -- Restore the original Ghost mode once analysis and expansion have - -- taken place. - - Ghost_Mode := GM; end Analyze_Private_Extension_Declaration; --------------------------------- @@ -4784,18 +4701,11 @@ package body Sem_Ch3 is (N : Node_Id; Skip : Boolean := False) is - GM : constant Ghost_Mode_Type := Ghost_Mode; Id : constant Entity_Id := Defining_Identifier (N); R_Checks : Check_Result; T : Entity_Id; begin - -- The subtype declaration may be subject to pragma Ghost with policy - -- Ignore. Set the mode now to ensure that any nodes generated during - -- analysis and expansion are properly flagged as ignored Ghost. - - Set_Ghost_Mode (N); - Generate_Definition (Id); Set_Is_Pure (Id, Is_Pure (Current_Scope)); Init_Size_Align (Id); @@ -5393,11 +5303,6 @@ package body Sem_Ch3 is end if; Analyze_Dimension (N); - - -- Restore the original Ghost mode once analysis and expansion have - -- taken place. - - Ghost_Mode := GM; end Analyze_Subtype_Declaration; -------------------------------- |