-- The Ghost node is created within a Ghost region
- if Ghost_Mode = Check then
+ if Ghost_Config.Ghost_Mode = Check then
if Nkind (N) in N_Entity then
Set_Is_Checked_Ghost_Entity (N);
end if;
- elsif Ghost_Mode = Ignore then
+ elsif Ghost_Config.Ghost_Mode = Ignore then
if Nkind (N) in N_Entity then
Set_Is_Ignored_Ghost_Entity (N);
end if;
Def_Id : constant Entity_Id := Entity (N);
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Result : Boolean := False;
end if;
end if;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
return Result;
exception
when RE_Not_Available =>
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
return False;
end Freeze_Type;
Name_TSD : constant Name_Id :=
New_External_Name (Tname, 'B', Suffix_Index => -1);
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
AI : Elmt_Id;
Register_CG_Node (Typ);
<<Leave>>
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
return Result;
end Make_DT;
Wrapper_Decl_List : List_Id;
Wrapper_Body_List : List_Id := No_List;
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
begin
end if;
end if;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end SPARK_Freeze_Type;
end Exp_SPARK;
Loc : constant Source_Ptr := Sloc (Typ);
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
DIC_Prag : Node_Id;
end if;
<<Leave>>
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Build_DIC_Procedure_Body;
-------------------------------------
is
Loc : constant Source_Ptr := Sloc (Typ);
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
DIC_Prag : Node_Id;
end if;
<<Leave>>
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Build_DIC_Procedure_Declaration;
------------------------------------
-- Local variables
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Dummy : Entity_Id;
end if;
<<Leave>>
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Build_Invariant_Procedure_Body;
-------------------------------------------
is
Loc : constant Source_Ptr := Sloc (Typ);
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Proc_Decl : Node_Id;
end if;
<<Leave>>
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Build_Invariant_Procedure_Declaration;
------------------------
is
Loc : constant Source_Ptr := Sloc (Expr);
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Call : Node_Id;
Name => New_Occurrence_Of (Func_Id, Loc),
Parameter_Associations => Param_Assocs);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
return Call;
end Make_Predicate_Call;
-- Ghost mode.
procedure Expand (N : Node_Id) is
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
begin
end if;
<<Leave>>
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Expand;
---------------------------
is
Loc : constant Source_Ptr := Sloc (N);
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Atype : Entity_Id;
-- and Per-Object Expressions" will suppress the insertion, and the
-- freeze node will be dropped on the floor.
- if Saved_GM = Ignore
- and then Ghost_Mode /= Ignore
- and then Present (Ignored_Ghost_Region)
+ if Saved_Ghost_Config.Ghost_Mode = Ignore
+ and then Ghost_Config.Ghost_Mode /= Ignore
+ and then Present (Ghost_Config.Ignored_Ghost_Region)
then
Insert_Actions
- (Assoc_Node => Ignored_Ghost_Region,
+ (Assoc_Node => Ghost_Config.Ignored_Ghost_Region,
Ins_Actions => Result,
Spec_Expr_OK => True);
end if;
<<Leave>>
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
return Result;
end Freeze_Entity;
-- The context is Ghost when it appears within a Ghost package or
-- subprogram.
- if Ghost_Mode > None then
+ if Ghost_Config.Ghost_Mode > None then
return True;
-- Routine Expand_Record_Extension creates a parent subtype without
-- The context is ghost when it appears within a Ghost package or
-- subprogram.
- if Ghost_Mode > None then
+ if Ghost_Config.Ghost_Mode > None then
return;
-- The context is ghost if Formal is explicitly marked as ghost
-- The context is already within an ignored Ghost region. Maintain the
-- start of the outermost ignored Ghost region.
- if Present (Ignored_Ghost_Region) then
+ if Present (Ghost_Config.Ignored_Ghost_Region) then
null;
-- The current region is the outermost ignored Ghost region. Save its
-- starting node.
elsif Present (N) and then Mode = Ignore then
- Ignored_Ghost_Region := N;
+ Ghost_Config.Ignored_Ghost_Region := N;
-- Otherwise the current region is not ignored, nothing to save
else
- Ignored_Ghost_Region := Empty;
+ Ghost_Config.Ignored_Ghost_Region := Empty;
end if;
- Ghost_Mode := Mode;
+ Ghost_Config.Ghost_Mode := Mode;
end Install_Ghost_Region;
procedure Install_Ghost_Region (Mode : Name_Id; N : Node_Id) is
-- A body declared within a Ghost region is automatically Ghost
-- (SPARK RM 6.9(2)).
- elsif Ghost_Mode = Check then
+ elsif Ghost_Config.Ghost_Mode = Check then
Policy := Name_Check;
- elsif Ghost_Mode = Ignore then
+ elsif Ghost_Config.Ghost_Mode = Ignore then
Policy := Name_Ignore;
-- Inherit the "ghostness" of the previous declaration when the body
-- A completion elaborated in a Ghost region is automatically Ghost
-- (SPARK RM 6.9(2)).
- if Ghost_Mode = Check then
+ if Ghost_Config.Ghost_Mode = Check then
Policy := Name_Check;
- elsif Ghost_Mode = Ignore then
+ elsif Ghost_Config.Ghost_Mode = Ignore then
Policy := Name_Ignore;
-- The completion becomes Ghost when its initial declaration is also
-- A declaration elaborated in a Ghost region is automatically Ghost
-- (SPARK RM 6.9(2)).
- elsif Ghost_Mode = Check then
+ elsif Ghost_Config.Ghost_Mode = Check then
Policy := Name_Check;
- elsif Ghost_Mode = Ignore then
+ elsif Ghost_Config.Ghost_Mode = Ignore then
Policy := Name_Ignore;
-- A child package or subprogram declaration becomes Ghost when its
-- An instantiation declaration within a Ghost region is automatically
-- Ghost (SPARK RM 6.9(2)).
- elsif Ghost_Mode = Check then
+ elsif Ghost_Config.Ghost_Mode = Check then
Policy := Name_Check;
- elsif Ghost_Mode = Ignore then
+ elsif Ghost_Config.Ghost_Mode = Ignore then
Policy := Name_Ignore;
-- Inherit the "ghostness" of the generic unit, but the current Ghost
-- Restore_Ghost_Region --
--------------------------
- procedure Restore_Ghost_Region (Mode : Ghost_Mode_Type; N : Node_Id) is
+ procedure Restore_Ghost_Region (Config : Ghost_Config_Type) is
begin
- Ghost_Mode := Mode;
- Ignored_Ghost_Region := N;
+ Ghost_Config := Config;
end Restore_Ghost_Region;
--------------------
-- WARNING: this is a separate front end pass, care should be taken to keep
-- it optimized.
- procedure Restore_Ghost_Region (Mode : Ghost_Mode_Type; N : Node_Id);
+ procedure Restore_Ghost_Region (Config : Ghost_Config_Type);
pragma Inline (Restore_Ghost_Region);
-- Restore a Ghost region to a previous state described by mode Mode and
-- ignored region start node N. This routine must be used in conjunction
-- Possible legal modes that can be set by aspect/pragma Ghost as well as
-- value None, which indicates that no such aspect/pragma applies.
- Ghost_Mode : Ghost_Mode_Type := None;
+ type Ghost_Config_Type is record
+ Ghost_Mode : Ghost_Mode_Type := None;
+ -- The current Ghost mode in effect
+
+ Ignored_Ghost_Region : Node_Id := Empty;
+ -- The start of the current ignored Ghost region. This value must always
+ -- reflect the starting node of the outermost ignored Ghost region. If a
+ -- nested ignored Ghost region is entered, the value must remain
+ -- unchanged.
+ end record;
+
+ Ghost_Config : Ghost_Config_Type;
-- GNAT
- -- The current Ghost mode in effect
+ -- All relevant Ghost mode settings
Global_Discard_Names : Boolean := False;
-- GNAT, GNATBIND
-- use of -gnateu, causing subsequent unrecognized switches to result in
-- a warning rather than an error.
- Ignored_Ghost_Region : Node_Id := Empty;
- -- GNAT
- -- The start of the current ignored Ghost region. This value must always
- -- reflect the starting node of the outermost ignored Ghost region. If a
- -- nested ignored Ghost region is entered, the value must remain unchanged.
-
Implicit_Packing : Boolean := False;
-- GNAT
-- If set True, then a Size attribute clause on an array is allowed to
U : RT_Unit_Table_Record renames RT_Unit_Table (U_Id);
Priv_Par : constant Elist_Id := New_Elmt_List;
Lib_Unit : Node_Id;
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
Saved_ISMP : constant Boolean :=
Ignore_SPARK_Mode_Pragmas_In_Instance;
Saved_SM : constant SPARK_Mode_Type := SPARK_Mode;
procedure Restore_SPARK_Context is
begin
Ignore_SPARK_Mode_Pragmas_In_Instance := Saved_ISMP;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
end Restore_SPARK_Context;
declare
LibUnit : constant Node_Id := Unit (Cunit (U.Unum));
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
+ Saved_GM : constant Ghost_Mode_Type := Ghost_Config.Ghost_Mode;
Clause : Node_Id;
Withn : Node_Id;
-- later, after ignored ghost code is converted to a null
-- statement.
- Ghost_Mode := None;
+ Ghost_Config.Ghost_Mode := None;
Withn :=
Make_With_Clause (Standard_Location,
Name =>
Make_Unit_Name
(U, Defining_Unit_Name (Specification (LibUnit))));
- Ghost_Mode := Saved_GM;
+ Ghost_Config.Ghost_Mode := Saved_GM;
Set_Corresponding_Spec (Withn, U.Entity);
Set_First_Name (Withn);
-- is pulled within an ignored Ghost context because all this code will
-- disappear.
- if U_Id = System_Secondary_Stack and then Ghost_Mode /= Ignore then
+ if U_Id = System_Secondary_Stack
+ and then Ghost_Config.Ghost_Mode /= Ignore
+ then
Sec_Stack_Used := True;
end if;
-- Ghost mode.
procedure Analyze (N : Node_Id) is
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
begin
Expand_SPARK_Potential_Renaming (N);
end if;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze;
-- Version with check(s) suppressed
-- the Ghost mode.
procedure Do_Analyze is
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
Saved_ISMP : constant Boolean :=
Ignore_SPARK_Mode_Pragmas_In_Instance;
-- Save Ghost and SPARK mode-related data to restore on exit
Style_Max_Line_Length := Saved_ML;
Style_Check_Max_Line_Length := Saved_CML;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
Ignore_SPARK_Mode_Pragmas_In_Instance := Saved_ISMP;
end Do_Analyze;
Loc : constant Source_Ptr := Sloc (N);
Is_Abbrev : constant Boolean :=
Is_Abbreviated_Instance (Defining_Entity (N));
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
Saved_ISMP : constant Boolean :=
Ignore_SPARK_Mode_Pragmas_In_Instance;
Saved_SM : constant SPARK_Mode_Type := SPARK_Mode;
end if;
Ignore_SPARK_Mode_Pragmas_In_Instance := Saved_ISMP;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
Style_Check := Saved_Style_Check;
end if;
Ignore_SPARK_Mode_Pragmas_In_Instance := Saved_ISMP;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
Style_Check := Saved_Style_Check;
end Analyze_Package_Instantiation;
-- Local variables
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
Saved_ISMP : constant Boolean :=
Ignore_SPARK_Mode_Pragmas_In_Instance;
Saved_SM : constant SPARK_Mode_Type := SPARK_Mode;
end if;
Ignore_SPARK_Mode_Pragmas_In_Instance := Saved_ISMP;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
exception
end if;
Ignore_SPARK_Mode_Pragmas_In_Instance := Saved_ISMP;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
end Analyze_Subprogram_Instantiation;
-- the package body.
Saved_CS : constant Config_Switches_Type := Save_Config_Switches;
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
Saved_ISMP : constant Boolean :=
Ignore_SPARK_Mode_Pragmas_In_Instance;
Saved_LSST : constant Suppress_Stack_Entry_Ptr :=
Expander_Mode_Restore;
Restore_Config_Switches (Saved_CS);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
Restore_Warnings (Saved_Warn);
end Instantiate_Package_Body;
-- the subprogram body.
Saved_CS : constant Config_Switches_Type := Save_Config_Switches;
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
Saved_ISMP : constant Boolean :=
Ignore_SPARK_Mode_Pragmas_In_Instance;
Saved_LSST : constant Suppress_Stack_Entry_Ptr :=
Expander_Mode_Restore;
Restore_Config_Switches (Saved_CS);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
Restore_SPARK_Mode (Saved_SM, Saved_SMP);
Restore_Warnings (Saved_Warn);
end Instantiate_Subprogram_Body;
procedure Build_Predicate_Function (Typ : Entity_Id; N : Node_Id) is
Loc : constant Source_Ptr := Sloc (Typ);
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Expr : Node_Id;
end;
end if;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
if Restore_Scope then
Pop_Scope;
is
Loc : constant Source_Ptr := Sloc (Typ);
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Func_Decl : Node_Id;
Insert_After (Parent (Typ), Func_Decl);
Analyze (Func_Decl);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
return Func_Decl;
end Build_Predicate_Function_Declaration;
-- Local variables
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Prev_Entity : Entity_Id := Empty;
Check_No_Hidden_State (Id);
end if;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze_Object_Declaration;
---------------------------
-- Local variables
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Full_Indic : Node_Id;
end if;
<<Leave>>
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Process_Full_View;
-----------------------------------
-- Local variables
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
T1 : Entity_Id;
Analyze_Dimension (N);
<<Leave>>
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
-- If the right-hand side contains target names, expansion has been
-- disabled to prevent expansion that might move target names out of
-- A label declared within a Ghost region becomes Ghost (SPARK RM
-- 6.9(2)).
- if Ghost_Mode > None then
+ if Ghost_Config.Ghost_Mode > None then
Set_Is_Ghost_Entity (Id);
end if;
end Analyze_Implicit_Label_Declaration;
Loc : constant Source_Ptr := Sloc (N);
Spec : constant Node_Id := Specification (N);
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
Saved_ISMP : constant Boolean :=
Ignore_SPARK_Mode_Pragmas_In_Instance;
-- Save the Ghost and SPARK mode-related data to restore on exit
<<Leave>>
Ignore_SPARK_Mode_Pragmas_In_Instance := Saved_ISMP;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze_Null_Procedure;
-----------------------------
Loc : constant Source_Ptr := Sloc (N);
P : constant Node_Id := Name (N);
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Actual : Node_Id;
end if;
<<Leave>>
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze_Procedure_Call;
------------------------------
-- Local variables
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
Saved_EA : constant Boolean := Expander_Active;
Saved_ISMP : constant Boolean :=
Ignore_SPARK_Mode_Pragmas_In_Instance;
-- user entities, as internally generated entitities might still need
-- to be expanded (e.g. those generated for types).
- if Present (Ignored_Ghost_Region)
+ if Present (Ghost_Config.Ignored_Ghost_Region)
and then Comes_From_Source (Body_Id)
then
Expander_Active := False;
end if;
<<Leave>>
- if Present (Ignored_Ghost_Region) then
+ if Present (Ghost_Config.Ignored_Ghost_Region) then
Expander_Active := Saved_EA;
end if;
Ignore_SPARK_Mode_Pragmas_In_Instance := Saved_ISMP;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze_Subprogram_Body_Helper;
------------------------------------
-- Local variables
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
Saved_EA : constant Boolean := Expander_Active;
Saved_ISMP : constant Boolean :=
Ignore_SPARK_Mode_Pragmas_In_Instance;
-- user entities, as internally generated entities might still need
-- to be expanded (e.g. those generated for types).
- if Present (Ignored_Ghost_Region)
+ if Present (Ghost_Config.Ignored_Ghost_Region)
and then Comes_From_Source (Body_Id)
then
Expander_Active := False;
end if;
end if;
- if Present (Ignored_Ghost_Region) then
+ if Present (Ghost_Config.Ignored_Ghost_Region) then
Expander_Active := Saved_EA;
end if;
Ignore_SPARK_Mode_Pragmas_In_Instance := Saved_ISMP;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze_Package_Body_Helper;
---------------------------------
Arg1 : constant Node_Id :=
First (Pragma_Argument_Associations (N));
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Errors : Nat;
End_Scope;
end if;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end if;
Set_Is_Analyzed_Pragma (N);
CCases : constant Node_Id := Expression (Get_Argument (N, Spec_Id));
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
CCase : Node_Id;
Set_Is_Analyzed_Pragma (N);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze_Contract_Cases_In_Decl_Part;
----------------------------------
Exceptional_Contracts : constant Node_Id :=
Expression (Get_Argument (N, Spec_Id));
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Exceptional_Contract : Node_Id;
Set_Is_Analyzed_Pragma (N);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze_Exceptional_Cases_In_Decl_Part;
-------------------------------------
Exit_Contracts : constant Node_Id :=
Expression (Get_Argument (N, Spec_Id));
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Exit_Contract : Node_Id;
Set_Is_Analyzed_Pragma (N);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze_Exit_Cases_In_Decl_Part;
--------------------------------------------
Pack_Id : constant Entity_Id := Defining_Entity (Pack_Decl);
Expr : constant Node_Id := Expression (Get_Argument (N, Pack_Id));
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
begin
Preanalyze_And_Resolve (Expr, Standard_Boolean);
Set_Is_Analyzed_Pragma (N);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze_Initial_Condition_In_Decl_Part;
--------------------------------------
-- An abstract state declared within a Ghost region becomes
-- Ghost (SPARK RM 6.9(2)).
- if Ghost_Mode > None or else Is_Ghost_Entity (Pack_Id) then
+ if Ghost_Config.Ghost_Mode > None
+ or else Is_Ghost_Entity (Pack_Id)
+ then
Set_Is_Ghost_Entity (State_Id);
end if;
-- cannot occur within a Ghost subprogram or package
-- (SPARK RM 6.9(16)).
- if Ghost_Mode > None then
+ if Ghost_Config.Ghost_Mode > None then
Error_Pragma
("pragma % cannot appear within ghost subprogram or "
& "package");
-- Local variables
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Cname : Name_Id;
In_Assertion_Expr := In_Assertion_Expr - 1;
end if;
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Check;
--------------------------
-- region (SPARK RM 6.9(6)).
if Is_False (Expr_Value (Expr))
- and then Ghost_Mode > None
+ and then Ghost_Config.Ghost_Mode > None
then
Error_Pragma
("pragma % with value False cannot appear in enabled "
Expr : constant Node_Id := Expression (Get_Argument (N, Spec_Id));
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Errors : Nat;
Check_Postcondition_Use_In_Inlined_Subprogram (N, Spec_Id);
Set_Is_Analyzed_Pragma (N);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze_Pre_Post_Condition_In_Decl_Part;
---------------------------------------
Arg1 : constant Node_Id :=
First (Pragma_Argument_Associations (N));
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Errors : Nat;
Check_Postcondition_Use_In_Inlined_Subprogram (N, Spec_Id);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end if;
Set_Is_Analyzed_Pragma (N);
Variants : constant Node_Id := Expression (Get_Argument (N, Spec_Id));
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
Variant : Node_Id;
Set_Is_Analyzed_Pragma (N);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Analyze_Subprogram_Variant_In_Decl_Part;
------------------------------------
-- Local variables
- Saved_GM : constant Ghost_Mode_Type := Ghost_Mode;
- Saved_IGR : constant Node_Id := Ignored_Ghost_Region;
+ Saved_Ghost_Config : constant Ghost_Config_Type := Ghost_Config;
-- Save the Ghost-related attributes to restore on exit
-- Start of processing for Build_Elaboration_Entity
Set_Has_Qualified_Name (Elab_Ent);
Set_Has_Fully_Qualified_Name (Elab_Ent);
- Restore_Ghost_Region (Saved_GM, Saved_IGR);
+ Restore_Ghost_Region (Saved_Ghost_Config);
end Build_Elaboration_Entity;
--------------------------------
-- Mark the Ghost and SPARK mode in effect
if Modes then
- if Ghost_Mode = Ignore then
+ if Ghost_Config.Ghost_Mode = Ignore then
Set_Is_Ignored_Ghost_Node (N);
end if;