procedure Append_Enabled_Item (Item : Node_Id; List : in out List_Id) is
begin
- -- Do not chain ignored or disabled pragmas
+ -- Do not chain ignored or disabled pragmas. Note that disabled
+ -- pragmas are also considered ignored.
if Nkind (Item) = N_Pragma
- and then (Is_Ignored (Item) or else Is_Disabled (Item))
+ and then Is_Ignored_In_Codegen (Item)
then
null;
Get_Class_Wide_Pragma (Id, Pragma_Precondition);
begin
- if No (Prag) or else Is_Ignored (Prag) then
+ if No (Prag) or else Is_Ignored_In_Codegen (Prag) then
return;
end if;
-- Analyze_xxx_In_Decl_Part). The second part of the analysis will
-- not happen if the pragma is rewritten.
- if Assertion_Expression_Pragma (Prag_Id) and then Is_Ignored (N) then
+ if Assertion_Expression_Pragma (Prag_Id)
+ and then Is_Ignored_In_Codegen (N)
+ then
return;
-- Rewrite the pragma into a null statement when it is ignored using
elsif Should_Ignore_Pragma_Sem (N)
or else (Prag_Id = Pragma_Default_Scalar_Storage_Order
- and then Ignore_Rep_Clauses)
+ and then Ignore_Rep_Clauses)
then
Rewrite (N, Make_Null_Statement (Sloc (N)));
return;
begin
-- Nothing to do if pragma is ignored
- if Is_Ignored (N) then
+ if Is_Ignored_In_Codegen (N) then
return;
end if;
-- Do nothing if pragma is not enabled. If pragma is disabled, it has
-- already been rewritten as a Null statement.
- if Is_Ignored (CCs) then
+ if Is_Ignored_In_Codegen (CCs) then
return;
-- Guard against malformed contract cases
-- Nothing to do when the pragma is ignored because its semantics are
-- suppressed.
- if Is_Ignored (IC_Prag) then
+ if Is_Ignored_In_Codegen (IC_Prag) then
return;
-- Nothing to do when the pragma or its argument are illegal because
-- Also do this in CodePeer mode, because the expanded code is too
-- complicated for CodePeer to analyse.
- if Is_Ignored (N)
+ if Is_Ignored_In_Codegen (N)
or else Chars (Last_Var) = Name_Structural
or else CodePeer_Mode
then
-- Do nothing if pragma is not present or is disabled.
-- Also ignore structural variants for execution.
- if Is_Ignored (Prag)
+ if Is_Ignored_In_Codegen (Prag)
or else Chars (Nlists.Last (Choices (Last_Variant))) = Name_Structural
then
return;
begin
-- The DIC pragma is ignored, nothing left to do
- if Is_Ignored (DIC_Prag) then
+ if Is_Ignored_In_Codegen (DIC_Prag) then
null;
-- Otherwise the DIC expression must be checked at run time.
begin
-- The invariant is ignored, nothing left to do
- if Is_Ignored (Prag) then
+ if Is_Ignored_In_Codegen (Prag) then
null;
-- Otherwise the invariant is checked. Build a pragma Check to verify
-- executable. This action must be performed very late because it
-- heavily alters the tree.
- if Operating_Mode = Generate_Code or else GNATprove_Mode then
+ if Operating_Mode = Generate_Code and not CodePeer_Mode then
Remove_Ignored_Ghost_Code;
end if;
Operating_Mode := Check_Semantics;
- -- Enable assertions, since they give valuable extra information for
- -- formal verification.
-
- Assertions_Enabled := True;
-
-- Disable validity checks, since it generates code raising
-- exceptions for invalid data, which confuses GNATprove. Invalid
-- data is directly detected by GNATprove's flow analysis.
-- Do not generate a with line for an ignored Ghost unit because
-- the unit does not have an ALI file.
- if Is_Ignored_Ghost_Entity (Cunit_Entity (Unum)) then
+ if Is_Ignored_Ghost_Entity_In_Codegen (Cunit_Entity (Unum)) then
goto Next_With_Line;
end if;
-- entity because neither the entity nor its references will
-- appear in the final tree.
- if Is_Ignored_Ghost_Entity (Ent) then
+ if Is_Ignored_Ghost_Entity_In_Codegen (Ent) then
goto Orphan_Continue;
end if;
-- entity because neither the entity nor its references will
-- appear in the final tree.
- if Is_Ignored_Ghost_Entity (Ent) then
+ if Is_Ignored_Ghost_Entity_In_Codegen (Ent) then
goto Continue;
end if;
SPARK_Mode_Pragma := SPARK_Mode_Pragma_Config;
else
- -- In GNATprove mode assertions should be always enabled, even
- -- when analysing internal units.
-
- if GNATprove_Mode then
- pragma Assert (Assertions_Enabled);
- null;
-
- elsif GNAT_Mode_Config then
+ if GNAT_Mode_Config then
Assertions_Enabled := Assertions_Enabled_Config;
else
Assertions_Enabled := False;
-- early transformation also avoids the generation of a useless loop
-- entry constant.
- if Present (Encl_Prag) and then Is_Ignored (Encl_Prag) then
+ if Present (Encl_Prag) and then Is_Ignored_In_Codegen (Encl_Prag) then
Rewrite (N, Relocate_Node (P));
Preanalyze_And_Resolve (N);
and then not Is_Ignored_Ghost_Entity (E)
then
if A_Id = Aspect_Pre then
- if Is_Ignored (Aspect) then
+ if Is_Ignored_In_Codegen (Aspect) then
Set_Ignored_Class_Preconditions (E,
New_Copy_Tree (Expr));
else
elsif No (Class_Postconditions (E))
and then No (Ignored_Class_Postconditions (E))
then
- if Is_Ignored (Aspect) then
+ if Is_Ignored_In_Codegen (Aspect) then
Set_Ignored_Class_Postconditions (E,
New_Copy_Tree (Expr));
else
-- which is needed to generate the corresponding predicate
-- function.
- if Is_Ignored_Ghost_Pragma (Prag) then
+ if Is_Ignored_Ghost_Pragma_In_Codegen (Prag) then
Add_Condition (New_Occurrence_Of (Standard_True, Sloc (Prag)));
else
-- "and"-in the Arg2 condition to evolving expression
- if not Is_Ignored_Ghost_Pragma (Prag) then
+ if not Is_Ignored_Ghost_Pragma_In_Codegen (Prag)
+ then
Add_Condition (Arg2_Copy);
end if;
end;
begin
if Pname = Name_Pre_Class then
- if Is_Ignored (N) then
+ if Is_Ignored_In_Codegen (N) then
Set_Ignored_Class_Preconditions (Subp_Id,
New_Copy_Tree (Expr));
else
end if;
else
- if Is_Ignored (N) then
+ if Is_Ignored_In_Codegen (N) then
Set_Ignored_Class_Postconditions (Subp_Id,
New_Copy_Tree (Expr));
else
Set_Is_Ignored (N, False);
else
- -- In CodePeer mode and GNATprove mode, we need to
- -- consider all assertions, unless they are disabled,
- -- because transformations of the AST may depend on
- -- assertions being checked.
+ Set_Is_Checked (N, False);
+ Set_Is_Ignored (N, True);
- if CodePeer_Mode or GNATprove_Mode then
- Set_Is_Checked (N, True);
- Set_Is_Ignored (N, False);
- else
- Set_Is_Checked (N, False);
- Set_Is_Ignored (N, True);
- end if;
end if;
end Handle_Dynamic_Predicate_Check;
-- False at compile time, and we do not want to delete this
-- warning when we delete the if statement.
- if Expander_Active and Is_Ignored (N) then
+ if Expander_Active and Is_Ignored_In_Codegen (N) then
Eloc := Sloc (Expr);
Rewrite (N,
Cond :=
New_Occurrence_Of
(Boolean_Literals
- (Expander_Active and then not Is_Ignored (N)),
+ (Expander_Active and then not Is_Ignored_In_Codegen (N)),
Loc);
- if not Is_Ignored (N) then
+ if not Is_Ignored_In_Codegen (N) then
Set_SCO_Pragma_Enabled (Loc);
end if;
when Name_Ignore
| Name_Off
=>
- -- In CodePeer mode and GNATprove mode, we need to
- -- consider all assertions, unless they are disabled.
- -- Force Is_Checked on ignored assertions, in particular
- -- because transformations of the AST may depend on
- -- assertions being checked (e.g. the translation of
- -- attribute 'Loop_Entry).
-
- if CodePeer_Mode or GNATprove_Mode then
- Set_Is_Checked (N, True);
- Set_Is_Ignored (N, False);
- else
- Set_Is_Checked (N, False);
- Set_Is_Ignored (N, True);
- end if;
+ Set_Is_Checked (N, False);
+ Set_Is_Ignored (N, True);
when Name_Check
| Name_On
end if;
end Is_Extended_Access_Type;
+ ----------------------------------------
+ -- Is_Ignored_Ghost_Entity_In_Codegen --
+ ----------------------------------------
+
+ function Is_Ignored_Ghost_Entity_In_Codegen (N : Entity_Id) return Boolean
+ is
+ begin
+ return
+ Is_Ignored_Ghost_Entity (N)
+ and then not GNATprove_Mode
+ and then not CodePeer_Mode;
+ end Is_Ignored_Ghost_Entity_In_Codegen;
+
+ ----------------------------------------
+ -- Is_Ignored_Ghost_Pragma_In_Codegen --
+ ----------------------------------------
+
+ function Is_Ignored_Ghost_Pragma_In_Codegen (N : Node_Id) return Boolean is
+ begin
+ return
+ Is_Ignored_Ghost_Pragma (N)
+ and then not GNATprove_Mode
+ and then not CodePeer_Mode;
+ end Is_Ignored_Ghost_Pragma_In_Codegen;
+
+ ---------------------------
+ -- Is_Ignored_In_Codegen --
+ ---------------------------
+
+ function Is_Ignored_In_Codegen (N : Node_Id) return Boolean is
+ begin
+ return
+ Is_Ignored (N) and then not GNATprove_Mode and then not CodePeer_Mode;
+ end Is_Ignored_In_Codegen;
+
---------------------------------
-- Side_Effect_Free_Statements --
---------------------------------
end if;
end if;
- -- In CodePeer mode and GNATprove mode, we need to consider all
- -- assertions, unless they are disabled. Force Name_Check on
- -- ignored assertions.
-
- if Kind in Name_Ignore | Name_Off
- and then (CodePeer_Mode or GNATprove_Mode)
- then
- Kind := Name_Check;
- end if;
-
return Kind;
end Policy_In_Effect;
function Predicate_Enabled (Typ : Entity_Id) return Boolean is
begin
- return Present (Predicate_Function (Typ))
- and then not Predicates_Ignored (Typ)
- and then not Predicate_Checks_Suppressed (Empty);
+ return
+ Present (Predicate_Function (Typ))
+ and then (GNATprove_Mode
+ or else (not Predicates_Ignored (Typ)
+ and then not Predicate_Checks_Suppressed (Empty)));
end Predicate_Enabled;
----------------------------------
-- . machine_emax = 2**14
-- . machine_emin = 3 - machine_emax
+ function Is_Ignored_Ghost_Entity_In_Codegen (N : Node_Id) return Boolean;
+ -- True if N Is_Ignored_Ghost_Entity and GNATProve_mode and Codepeer_Mode
+ -- are not active.
+
+ function Is_Ignored_Ghost_Pragma_In_Codegen (N : Node_Id) return Boolean;
+ -- True if N Is_Ignored_Ghost_Pragma and GNATProve_mode and Codepeer_Mode
+ -- are not active.
+
+ function Is_Ignored_In_Codegen (N : Node_Id) return Boolean;
+ -- True if N Is_Ignored and GNATProve_mode and Codepeer_Mode are not
+ -- active.
+
function Is_EVF_Expression (N : Node_Id) return Boolean;
-- Determine whether node N denotes a reference to a formal parameter of
-- a specific tagged type whose related subprogram is subject to pragma