]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Deconstruct flag Split_PPC since splitting now is done in expansion
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 31 Jan 2024 13:07:22 +0000 (14:07 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 13 May 2024 08:03:33 +0000 (10:03 +0200)
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.

gcc/ada/contracts.adb
gcc/ada/gen_il-fields.ads
gcc/ada/gen_il-gen-gen_nodes.adb
gcc/ada/gen_il-internals.adb
gcc/ada/par_sco.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_prag.adb
gcc/ada/sem_util.adb
gcc/ada/sinfo.ads
gcc/ada/treepr.adb

index c04d850b5322ccb9aeb9935f4bcda77d1a0895da..97f38735662325e3592587d3039f88c780c0c9cb 100644 (file)
@@ -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;
 
index 67074c60250e3363371c991208fe83f442329221..54a5703d1a5448f3afc2909ff71e630bc564fe7c 100644 (file)
@@ -386,7 +386,6 @@ package Gen_IL.Fields is
       Shift_Count_OK,
       Source_Type,
       Specification,
-      Split_PPC,
       Statements,
       Storage_Pool,
       Subpool_Handle_Name,
index 3a78ffb2009ca342547c4d322741ac3232f94cb8..f3dc215673a4b663b9ff449e95da27d2280dd113 100644 (file)
@@ -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),
index a0f55d39a4259315299006ae3ca43a3704fd7097..e08397f7d4e0bf5c2c856964edffad8c526815e3 100644 (file)
@@ -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 =>
index 144c13823695e2a604866f6907fc00bdf2278f45..83c1d001ee5354cc81c710864a4b34557944837c 100644 (file)
@@ -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
index efbc67f3c5d31c2e41ef43170da71e11e1a17095..0470ce10ac7a208892f910c4068132007248dc7f 100644 (file)
@@ -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
 
index 446a0b870d5f524082fe431ca8cee30b2d4f5c05..17f62d3dfb8a9fe5aba4e99e78d63ec19ffc2d52 100644 (file)
@@ -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 "
index b26054e336b520347dcc5607c289ca3e4d7cc15b..3ebee2968bcf88835e1c43b6ff78eaba601fb3f7 100644 (file)
@@ -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
index 03055039a1faeb0f12c28d433499a273699a1599..1166c68b9727332f6c30a8f66781bef5df6dadc9 100644 (file)
@@ -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
index bee4491efde0102bc3f69e0f3a428c61b8587f7e..7cad6cf1d29f3c8bb622d1909677f6c88fe55b6f 100644 (file)
@@ -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
index c5875f0a2be1d7f4d600b9bfc0259289df45f064..f02f7ece30ce3d153e282313c42bb929d90b8886 100644 (file)
@@ -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";