@@ -2714,22 +2714,7 @@ package body Contracts is
-- Otherwise, add the item
else
- if No (List) then
- List := New_List;
- end if;
-
- -- If the pragma is a conjunct in a composite postcondition, it
- -- has been processed in reverse order. In the postcondition body
- -- it must appear before the others.
-
- if Nkind (Item) = N_Pragma
- and then From_Aspect_Specification (Item)
- and then Split_PPC (Item)
- then
- Prepend (Item, List);
- else
- Append (Item, List);
- end if;
+ Append_New (Item, List);
end if;
end Append_Enabled_Item;
@@ -386,7 +386,6 @@ package Gen_IL.Fields is
Shift_Count_OK,
Source_Type,
Specification,
- Split_PPC,
Statements,
Storage_Pool,
Subpool_Handle_Name,
@@ -1251,7 +1251,6 @@ begin -- Gen_IL.Gen.Gen_Nodes
(Sy (Identifier, Node_Id, Default_Empty),
Sy (Expression, Node_Id, Default_Empty),
Sy (Class_Present, Flag),
- Sy (Split_PPC, Flag),
Sm (Aspect_On_Partial_View, Flag),
Sm (Aspect_Rep_Item, Node_Id),
Sm (Entity_Or_Associated_Node, Node_Id), -- just Entity
@@ -1556,7 +1555,6 @@ begin -- Gen_IL.Gen.Gen_Nodes
(Sy (Pragma_Argument_Associations, List_Id, Default_No_List),
Sy (Pragma_Identifier, Node_Id),
Sy (Class_Present, Flag),
- Sy (Split_PPC, Flag),
Sm (Corresponding_Aspect, Node_Id),
Sm (From_Aspect_Specification, Flag),
Sm (Import_Interface_Present, Flag),
@@ -339,8 +339,6 @@ package body Gen_IL.Internals is
return "SPARK_Pragma";
when SPARK_Pragma_Inherited =>
return "SPARK_Pragma_Inherited";
- when Split_PPC =>
- return "Split_PPC";
when SSO_Set_High_By_Default =>
return "SSO_Set_High_By_Default";
when SSO_Set_Low_By_Default =>
@@ -1704,11 +1704,6 @@ package body Par_SCO is
while Present (AN) loop
AE := Expression (AN);
- -- SCOs are generated before semantic analysis/expansion:
- -- PPCs are not split yet.
-
- pragma Assert (not Split_PPC (AN));
-
C1 := ASCII.NUL;
case Get_Aspect_Id (AN) is
@@ -1776,12 +1776,12 @@ package body Sem_Ch13 is
Pragma_Name : Name_Id) return Node_Id;
-- This is a wrapper for Make_Pragma used for converting aspects
-- to pragmas. It takes care of Sloc (set from Loc) and building
- -- the pragma identifier from the given name. In addition the
- -- flags Class_Present and Split_PPC are set from the aspect
- -- node, as well as Is_Ignored. This routine also sets the
- -- From_Aspect_Specification in the resulting pragma node to
- -- True, and sets Corresponding_Aspect to point to the aspect.
- -- The resulting pragma is assigned to Aitem.
+ -- the pragma identifier from the given name. In addition the flag
+ -- Class_Present is set from the aspect node, as well as
+ -- Is_Ignored. This routine also sets the
+ -- From_Aspect_Specification in the resulting pragma node to True,
+ -- and sets Corresponding_Aspect to point to the aspect. The
+ -- resulting pragma is assigned to Aitem.
-------------------------------
-- Analyze_Aspect_Convention --
@@ -2703,8 +2703,7 @@ package body Sem_Ch13 is
Pragma_Argument_Associations => Args,
Pragma_Identifier =>
Make_Identifier (Sloc (Id), Pragma_Name),
- Class_Present => Class_Present (Aspect),
- Split_PPC => Split_PPC (Aspect));
+ Class_Present => Class_Present (Aspect));
-- Set additional semantic fields
@@ -11175,9 +11175,7 @@ package body Sem_Ch6 is
while Present (Prag) loop
Error_Msg_Sloc := Sloc (Prag);
- if Class_Present (Prag)
- and then not Split_PPC (Prag)
- then
+ if Class_Present (Prag) then
if Pragma_Name (Prag) = Name_Precondition then
Error_Msg_N
("info: & inherits `Pre''Class` aspect from "
@@ -5192,7 +5192,7 @@ package body Sem_Prag is
-- status in SCO.
-- ??? nothing checks that the pragma is in the main source unit
- if Is_Checked (N) and then not Split_PPC (N) then
+ if Is_Checked (N) then
Set_SCO_Pragma_Enabled (Loc);
end if;
@@ -14516,7 +14516,6 @@ package body Sem_Prag is
-- check for a dynamic predicate.
if Is_Checked (N)
- and then not Split_PPC (N)
and then Cname /= Name_Dynamic_Predicate
then
Set_SCO_Pragma_Enabled (Loc);
@@ -31996,13 +31995,10 @@ package body Sem_Prag is
Stmt := Prev (Prag);
while Present (Stmt) loop
- -- Skip prior pragmas, but check for duplicates. Pragmas produced
- -- by splitting a complex pre/postcondition are not considered to
- -- be duplicates.
+ -- Skip prior pragmas, but check for duplicates
if Nkind (Stmt) = N_Pragma then
if Do_Checks
- and then not Split_PPC (Stmt)
and then Original_Aspect_Pragma_Name (Stmt) = Prag_Nam
then
Duplication_Error
@@ -4131,16 +4131,7 @@ package body Sem_Util is
begin
-- Expr is the conjunct of an enclosing "and" expression
- return Nkind (Parent (Expr)) in N_Subexpr
-
- -- or Expr is a conjunct of an enclosing "and then"
- -- expression in a postcondition aspect that was split into
- -- multiple pragmas. The first conjunct has the "and then"
- -- expression as Original_Node, and other conjuncts have
- -- Split_PCC set to True.
-
- or else Nkind (Original_Node (Expr)) = N_And_Then
- or else Split_PPC (Prag);
+ return Nkind (Parent (Expr)) in N_Subexpr;
end Applied_On_Conjunct;
-----------------------
@@ -30514,56 +30505,18 @@ package body Sem_Util is
end if;
when N_Pragma =>
- declare
- Previous : constant Node_Id := Prev (Par);
- Prev_Expr : Node_Id;
- begin
- if Nkind (Previous) = N_Pragma and then
- Split_PPC (Previous)
- then
- -- A source-level postcondition of
- -- A and then B and then C
- -- results in
- -- pragma Postcondition (A);
- -- pragma Postcondition (B);
- -- pragma Postcondition (C);
- -- with Split_PPC set to True on all but the
- -- last pragma. We account for that here.
-
- Prev_Expr :=
- Expression (First
- (Pragma_Argument_Associations (Previous)));
-
- -- This Analyze call is needed in the case when
- -- Sem_Attr.Analyze_Attribute calls
- -- Eligible_For_Conditional_Evaluation. Without
- -- it, we end up passing an unanalyzed expression
- -- to Is_Known_On_Entry and that doesn't work.
-
- Analyze (Prev_Expr);
-
- Next_Element :=
- (Expr => Prev_Expr,
- Context => Short_Circuit_Op,
- Is_And_Then => True);
-
- return Determining_Expressions (Prev_Expr)
- & Next_Element;
- else
- pragma Assert
- (Get_Pragma_Id (Pragma_Name (Par)) in
- Pragma_Check
- | Pragma_Contract_Cases
- | Pragma_Exceptional_Cases
- | Pragma_Post
- | Pragma_Postcondition
- | Pragma_Post_Class
- | Pragma_Refined_Post
- | Pragma_Test_Case);
-
- return (1 .. 0 => <>); -- recursion terminates here
- end if;
- end;
+ pragma Assert
+ (Get_Pragma_Id (Pragma_Name (Par)) in
+ Pragma_Check
+ | Pragma_Contract_Cases
+ | Pragma_Exceptional_Cases
+ | Pragma_Post
+ | Pragma_Postcondition
+ | Pragma_Post_Class
+ | Pragma_Refined_Post
+ | Pragma_Test_Case);
+
+ return (1 .. 0 => <>); -- recursion terminates here
when N_Empty =>
-- This case should be impossible, but if it does
@@ -2314,14 +2314,6 @@ package Sinfo is
-- source type entity for the unchecked conversion instantiation
-- which gigi must do size validation for.
- -- Split_PPC
- -- When a Pre or Post aspect specification is processed, it is broken
- -- into AND THEN sections. The leftmost section has Split_PPC set to
- -- False, indicating that it is the original specification (e.g. for
- -- posting errors). For other sections, Split_PPC is set to True.
- -- This flag is set in both the N_Aspect_Specification node itself,
- -- and in the pragma which is generated from this node.
-
-- Storage_Pool
-- Present in N_Allocator, N_Free_Statement, N_Simple_Return_Statement,
-- and N_Extended_Return_Statement nodes. References the entity for the
@@ -2724,7 +2716,6 @@ package Sinfo is
-- Is_Delayed_Aspect
-- Is_Disabled
-- Import_Interface_Present
- -- Split_PPC set if corresponding aspect had Split_PPC set
-- Uneval_Old_Warn
-- Note: we should have a section on what pragmas are passed on to
@@ -7594,7 +7585,6 @@ package Sinfo is
-- Is_Delayed_Aspect
-- Is_Disabled
-- Is_Boolean_Aspect
- -- Split_PPC Set if split pre/post attribute
-- Aspect_On_Partial_View
-- Note: Aspect_Specification is an Ada 2012 feature
@@ -7609,11 +7599,6 @@ package Sinfo is
-- In the case of aspects of the form xxx'Class, the aspect identifier
-- is for xxx, and Class_Present is set to True.
- -- Note: When a Pre or Post aspect specification is processed, it is
- -- broken into AND THEN sections. The left most section has Split_PPC
- -- set to False, indicating that it is the original specification (e.g.
- -- for posting errors). For the other sections, Split_PPC is set True.
-
---------------------------------------------
-- 13.4 Enumeration representation clause --
---------------------------------------------
@@ -7969,9 +7954,7 @@ package Sinfo is
-- The ordering in the list is in LIFO fashion.
-- Note that there might be multiple preconditions or postconditions
- -- in this list, either because they come from separate pragmas in the
- -- source, or because a Pre (resp. Post) aspect specification has been
- -- broken into AND THEN sections. See Split_PPC for details.
+ -- in this list, because they come from separate pragmas in the source.
-- In GNATprove mode, the inherited classwide pre- and postconditions
-- (suitably specialized for the specific type of the overriding
@@ -301,8 +301,6 @@ package body Treepr is
return "SCIL_Target_Prim";
when F_Shift_Count_OK =>
return "Shift_Count_OK";
- when F_Split_PPC =>
- return "Split_PPC";
when F_TSS_Elist =>
return "TSS_Elist";
From: Piotr Trojanek <trojanek@adacore.com> Remove flag Split_PPC and all its uses. gcc/ada/ * contracts.adb (Append_Enabled_Item): Remove use of Split_PPC; simplify. * gen_il-fields.ads (Opt_Field_Enum): Remove flag definition. * gen_il-gen-gen_nodes.adb (N_Aspect_Specification, N_Pragma): Remove Split_PPC flags. * gen_il-internals.adb (Image): Remove use of Split_PPC. * par_sco.adb (Traverse_Aspects): Likewise. * sem_ch13.adb (Make_Aitem_Pragma): Likewise. * sem_ch6.adb (List_Inherited_Pre_Post_Aspects): Likewise. * sem_prag.adb (Analyze_Pre_Post_Condition, Analyze_Pragma, Find_Related_Declaration_Or_Body): Likewise. * sem_util.adb (Applied_On_Conjunct): Likewise. * sinfo.ads: Remove flag documentation. * treepr.adb (Image): Remove use of Split_PPC. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/contracts.adb | 17 +------- gcc/ada/gen_il-fields.ads | 1 - gcc/ada/gen_il-gen-gen_nodes.adb | 2 - gcc/ada/gen_il-internals.adb | 2 - gcc/ada/par_sco.adb | 5 --- gcc/ada/sem_ch13.adb | 15 +++---- gcc/ada/sem_ch6.adb | 4 +- gcc/ada/sem_prag.adb | 8 +--- gcc/ada/sem_util.adb | 73 ++++++-------------------------- gcc/ada/sinfo.ads | 19 +-------- gcc/ada/treepr.adb | 2 - 11 files changed, 25 insertions(+), 123 deletions(-)