https://gcc.gnu.org/g:256263b1d9036714b0a4fe2ab9fda84d3df8699c

commit r16-4981-g256263b1d9036714b0a4fe2ab9fda84d3df8699c
Author: Bob Duff <[email protected]>
Date:   Fri Oct 10 12:40:42 2025 -0400

    ada: Get rid of Sy/Sm mixing (Actions)
    
    We should not mix "syntactic" and "semantic" for the same field
    in different node kinds.
    
    The Actions field is both syntactic and semantic. This patch
    makes it always syntactic.
    
    No change in overall compiler behavior.
    
    gcc/ada/ChangeLog:
    
            * gen_il-gen.adb (N_Short_Circuit):
            Make Actions syntactic.
            (N_Case_Expression_Alternative): Likewise.
            * gen_il-gen-gen_nodes.adb (Create_Type):
            No longer exempt Actions from the syntactic/semantic ordering rule.
            (Check_For_Syntactic_Field_Mismatch):
            No longer exempt Actions from the syntactic/semantic mixing rule.
            * sinfo.ads (N_Compound_Statement):
            Add comment.

Diff:
---
 gcc/ada/gen_il-gen-gen_nodes.adb |  6 +++---
 gcc/ada/gen_il-gen.adb           | 19 ++++++++-----------
 gcc/ada/sinfo.ads                |  3 +++
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb
index 844faf3873b6..e123631bb013 100644
--- a/gcc/ada/gen_il-gen-gen_nodes.adb
+++ b/gcc/ada/gen_il-gen-gen_nodes.adb
@@ -301,7 +301,7 @@ begin -- Gen_IL.Gen.Gen_Nodes
    Ab (N_Short_Circuit, N_Subexpr,
        (Sy (Left_Opnd, Node_Id),
         Sy (Right_Opnd, Node_Id),
-        Sm (Actions, List_Id)));
+        Sy (Actions, List_Id, Default_No_List)));
 
    Cc (N_And_Then, N_Short_Circuit);
    Cc (N_Or_Else, N_Short_Circuit);
@@ -1161,9 +1161,9 @@ begin -- Gen_IL.Gen.Gen_Nodes
         Sm (Target, Node_Id)));
 
    Cc (N_Case_Expression_Alternative, Node_Kind,
-       (Sm (Actions, List_Id),
-        Sy (Discrete_Choices, List_Id),
+       (Sy (Discrete_Choices, List_Id),
         Sy (Expression, Node_Id, Default_Empty),
+        Sy (Actions, List_Id, Default_No_List),
         Sm (Has_SP_Choice, Flag)));
 
    Cc (N_Case_Statement_Alternative, Node_Kind,
diff --git a/gcc/ada/gen_il-gen.adb b/gcc/ada/gen_il-gen.adb
index 9a441f228e3f..26d0193702cc 100644
--- a/gcc/ada/gen_il-gen.adb
+++ b/gcc/ada/gen_il-gen.adb
@@ -167,7 +167,6 @@ package body Gen_IL.Gen is
 
       --  Check that syntactic fields precede semantic fields. Note that this
       --  check is happening before we compute inherited fields.
-      --  Exempt Actions from this rule, for now.
 
       declare
          Semantic_Seen : Boolean := False;
@@ -178,11 +177,8 @@ package body Gen_IL.Gen is
                   raise Illegal with
                     "syntactic fields must precede semantic ones " & Image (T);
                end if;
-
             else
-               if Fields (J).F /= Actions then
-                  Semantic_Seen := True;
-               end if;
+               Semantic_Seen := True;
             end if;
          end loop;
       end;
@@ -509,7 +505,7 @@ package body Gen_IL.Gen is
       Node_Field_Types_Used, Entity_Field_Types_Used : Type_Set;
 
       Setter_Needs_Parent : Field_Set :=
-        (Actions | Expression | Then_Actions | Else_Actions => True,
+        (Expression | Then_Actions | Else_Actions => True,
          others => False);
       --  Set of fields where the setter should set the Parent. True for
       --  syntactic fields of type Node_Id and List_Id, but with some
@@ -1300,12 +1296,13 @@ package body Gen_IL.Gen is
                      end if;
                   end loop;
 
-                  --  The following fields violate this rule. We might want to
-                  --  simplify by getting rid of these cases, but we allow them
-                  --  for now. At least, we don't want to add any new cases of
-                  --  syntactic/semantic mismatch.
+                  --  ???The following fields violate this rule. We might want
+                  --  to simplify by getting rid of these cases, but we allow
+                  --  them for now. At least, we don't want to add any new
+                  --  cases of syntactic/semantic mismatch.
+                  --  ???Just one case left.
 
-                  if F in Actions | Expression then
+                  if F in Expression then
                      pragma Assert (Syntactic_Seen and Semantic_Seen);
 
                   else
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 54a3d9b3416e..f6610b74e03e 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -7938,6 +7938,9 @@ package Sinfo is
       --  N_Compound_Statement
       --  Actions
 
+      --  Note that N_Compound_Statement is unrelated to the Ada syntax rule
+      --  for compound_statement.
+
       --------------
       -- Contract --
       --------------

Reply via email to