diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb index ee6010a7444..a6b17184cb1 100644 --- a/gcc/ada/exp_ch11.adb +++ b/gcc/ada/exp_ch11.adb @@ -1031,7 +1031,7 @@ package body Exp_Ch11 is -- "hoisted" (i.e., Is_Statically_Allocated and not Is_Library_Level) -- entity must also be either Library_Level or hoisted. It turns out -- that this would be incompatible with the current treatment of an - -- object which is local to a subprogram, subject to an Export pragma, + -- object that is local to a subprogram, subject to an Export pragma, -- not subject to an address clause, and whose declaration contains -- references to other local (non-hoisted) objects (e.g., in the initial -- value expression). @@ -1558,7 +1558,7 @@ package body Exp_Ch11 is Build_Location_String (Buf, Loc); -- If the exception is a renaming, use the exception that it - -- renames (which might be a predefined exception, e.g.). + -- renames (which might be a predefined exception). if Present (Renamed_Entity (Id)) then Id := Renamed_Entity (Id); diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb index e123631bb01..e6e00ff986d 100644 --- a/gcc/ada/gen_il-gen-gen_nodes.adb +++ b/gcc/ada/gen_il-gen-gen_nodes.adb @@ -1290,7 +1290,7 @@ begin -- Gen_IL.Gen.Gen_Nodes Cc (N_Exception_Declaration, N_Declaration, (Sy (Defining_Identifier, Node_Id), Sy (Aspect_Specifications, List_Id, Default_No_List), - Sm (Expression, Node_Id), + Sy (Expression, Node_Id, Default_Empty), Sm (More_Ids, Flag), Sm (Prev_Ids, Flag))); diff --git a/gcc/ada/gen_il-gen.adb b/gcc/ada/gen_il-gen.adb index 26d0193702c..873c3cd7649 100644 --- a/gcc/ada/gen_il-gen.adb +++ b/gcc/ada/gen_il-gen.adb @@ -505,13 +505,11 @@ package body Gen_IL.Gen is Node_Field_Types_Used, Entity_Field_Types_Used : Type_Set; Setter_Needs_Parent : Field_Set := - (Expression | Then_Actions | Else_Actions => True, + (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 - -- exceptions. Expression is syntactic AND semantic, and the Parent - -- is needed. Then_Actions and Else_Actions are not syntactic, but the - -- Parent is needed. + -- syntactic fields of type Node_Id and List_Id. Then_Actions and + -- Else_Actions are not syntactic, but the Parent is needed. -- -- Computed in Check_For_Syntactic_Field_Mismatch. @@ -1296,26 +1294,15 @@ 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. - -- ???Just one case left. + if Syntactic_Seen and Semantic_Seen then + raise Illegal with + "syntactic/semantic mismatch for " & Image (F); + end if; - if F in Expression then - pragma Assert (Syntactic_Seen and Semantic_Seen); - - else - if Syntactic_Seen and Semantic_Seen then - raise Illegal with - "syntactic/semantic mismatch for " & Image (F); - end if; - - if Field_Table (F).Field_Type in Traversed_Field_Type - and then Syntactic_Seen - then - Setter_Needs_Parent (F) := True; - end if; + if Field_Table (F).Field_Type in Traversed_Field_Type + and then Syntactic_Seen + then + Setter_Needs_Parent (F) := True; end if; end; end if; diff --git a/gcc/ada/gen_il-gen.ads b/gcc/ada/gen_il-gen.ads index cb364ad65e2..149afe1dda9 100644 --- a/gcc/ada/gen_il-gen.ads +++ b/gcc/ada/gen_il-gen.ads @@ -48,14 +48,12 @@ -- If a field is syntactic, then the constructors in Nmake take a parameter to -- initialize that field. In addition, the tree-traversal routines in Atree -- (Traverse_Func and Traverse_Proc) traverse syntactic fields that are of --- type Node_Id (or subtypes of Node_Id) or List_Id. Finally, (with some --- exceptions documented in the body) the setter for a syntactic node or list --- field "Set_F (N, Val)" will set the Parent of Val to N, unless Val is Empty --- or Error[_List]. +-- type Node_Id (or subtypes of Node_Id) or List_Id. Finally, the setter for a +-- syntactic node or list field "Set_F (N, Val)" will set the Parent of Val to +-- N, unless Val is Empty or Error[_List]. -- --- Note that the same field can be syntactic in some node types but semantic --- in other node types. This is an added complexity that we might want to --- eliminate someday. We shouldn't add any new such cases. +-- No syntactic/semantic mixing: the same field cannot be syntactic in some +-- node types but semantic in other node types. -- -- A "program" written in the Gen_IL.Gen language consists of calls to the -- "Create_..." routines below, followed by a call to Compile, also below. In diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index f6610b74e03..8a35fdc4208 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -6839,10 +6839,16 @@ package Sinfo is -- N_Exception_Declaration -- Sloc points to EXCEPTION -- Defining_Identifier - -- Expression + -- Expression (see below) -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) + -- Expression is not present in the syntax; it is set during expansion. + -- An exception_declaration is treated by the back end like an object of + -- type Standard.Exception_Type, and Expression is the initial value. + -- Expression is a syntactic field to match the Expression fields of + -- other node kinds. + ------------------------------------------ -- 11.2 Handled Sequence Of Statements -- ------------------------------------------