ada: Check all interfaces for valid iterator type
21 November 2023 at 14:54
ada: Ignore defered compile time errors without backend We defer some compile time warnings and errors until the backend has added the extra information needed. However it is not guaranteed that the backend has run by this point. Avoid checking these errors if the backend has not been activated and no code has been generated. gcc/ada/ * sem_prag.adb (Validate_Compile_Time_Warning_Errors): Avoid checking compile time warnings and errors if backend has not been activated.
ada: Implement Aspects as fields under nodes In the previous implementation Aspect Specifications were stored in a separate table and not directly under each node. This implementation included a lot of extra code that needed to be maintained manually. The new implementation stores Aspect_Specfications as a syntactic field under each node. This removes the extra code that was needed to store, traverse and clone aspects for nodes. gcc/ada/ * aspects.adb (Exchange_Aspects): Removed. This method was typically called after a Rewrite method. Now since the Rewrite switches the aspects between the new and the old node it is no longer needed. (Has_Aspects): Converted to a utility method that performs the same before as the previous Has_Aspects field did. Meaning it shows whether a node actually has aspects or not. (Copy_Aspects): New utility method that performs a deep copy of the From nodes aspects. (Aspect_Specfications): Removed. No longer needed. Replaced by the primitive operation for the Aspect_Specification fields. (Set_Aspect_Specifications): Likewise. (Aspect_Specifications_Hash_Table): Remove the table and all the utility methods for storing the old aspects. * aspects.ads: Likewise. * atree.adb (Copy_Separate_Tree): Remove custom code for aspects. (New_Copy): Likewise. (Replace): Likewise. (Rewrite): Likewise. * exp_ch3.adb (Expand_N_Object_Declaration): Keep the aspects from the old node. * exp_ch6.adb (Validate_Subprogram_Calls): Previously aspects were ignored because they were not on the tree. Explicitly ignore them here when traversing the tree. * exp_unst.adb (Build_Tables): Likewise * gen_il-fields.ads: Remove Has_Aspects and add Aspect_Specifications fields. * gen_il-gen-gen_nodes.adb: Add Aspect_Specification fields for all nodes that can have aspects. Additionally add Expression_Copy for Aspect_Speficiations to avoid reusing the Associated_Node for generic instantiation and aspect analysis. * ghost.adb (Remove_Ignored_Ghost_Node): Remove call to Remove_Aspects. The rewritten node is a Null_Statement that cannot have aspects and there is not anything to gain from removing them from the Orignal_Node of N since it technically is not part of the active tree. * inline.adb (Process_Formals_In_Aspects): Simplify code for node traversal. * par-ch13.adb: Avoid setting the parent explicitly for the Aspect_Specifications list. This is done explicitly in the setter. * par-ch6.adb: Likewise. * par_sco.adb (Traverse_Aspects): Handle early return. * sem_ch10.adb: Simplify code for Analyze_Aspect_Specifications. * sem_ch11.adb: Likewise. * sem_ch12.adb (Analyze_Formal_Derived_Interface_Type): Keep the aspects from the orignal node after rewrite. (Analyze_Formal_Derived_Type): Likewise. (Analyze_Formal_Interface_Type): Likewise. (Analyze_Formal_Object_Declaration): Simplify code for Analyze_Aspect_Specifications. (Analyze_Formal_Package_Declaration): Likewise. (Analyze_Formal_Subprogram_Declaration): Likewise. (Analyze_Formal_Type_Declaration): Likewise. (Analyze_Generic_Package_Declaration): Remove Exchange_Aspects. The new node already has the correct aspects after the rewrite. Also simplify code for Analyze_Aspect_Specifications. (Analyze_Generic_Subprogram_Declaration): Likewise. (Analyze_Package_Instantiation): Simplify code for Analyze_Aspect_Specifications. (Build_Instance_Compilation_Unit_Nodes): Remove explicit copy of aspects that is no longer needed. (Save_References): Update the traversal code to handle Aspect_Specifications in the tree. (Copy_Generic_Node): Remove explicit copy for aspects. New_Copy took care of that already. * sem_ch13.adb (Analyze_Aspect_Specifications): Add early return to simplify code for its calls. Avoid reusing the Entity(Associated_Node) field for storing the original expression. Instead use the new Expression_Copy field since Entity(Associated_Node) is also used in generic instantiation. (Analyze_Aspects_On_Subprogram_Body_Or_Stub): Simlify call to Analyze_Aspect_Specifications. (Check_Aspect_At_End_Of_Declarations): Use Expression_Copy instead of Entity. (Check_Aspect_At_Freeze_Point): Likewise. * sem_ch3.adb: Simplify calls to Analyze_Aspect_Specifications. * sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Simplify call to Analyze_Aspect_Specifications. (Analyze_Expression_Function): Keep the aspects from the original node after a rewrite. (Analyze_Generic_Subprogram_Body): Remove Exchange aspects that is no longer needed. Simplify call to Analyze_Aspect_Specifications. (Analyze_Null_Procedure): Keep the aspects from the original node after a rewrite. (Analyze_Subprogram_Body_Helper): Simplify calls to Analyze_Aspect_Specifications. (Analyze_Subprogram_Declaration): Likewise. * sem_ch7.adb (Analyze_Package_Body_Helper): Remove Exchange aspects that is no longer needed. Simplify call to Analyze_Aspect_Specifications. (Analyze_Package_Declaration): Simplify call to Analyze_Aspect_Specifications. (Analyze_Private_Type_Declaration): Likewise. * sem_ch8.adb: Simplify calls to Analyze_Aspect_Specifications. * sem_ch9.adb (Analyze_Entry_Body): Simplify call to Analyze_Aspects_On_Subprogram_Body_Or_Stub. (Analyze_Entry_Declaration): Simplify call to Analyze_Aspect_Specifications. (Analyze_Protected_Body): Likewise. (Analyze_Protected_Type_Declaration): Likewise. (Analyze_Single_Protected_Declaration): Keep the aspects from the original node after a rewrite. Simplify call to Analyze_Aspect_Specifications. (Analyze_Single_Task_Declaration): Likewise. (Analyze_Task_Body): Simplify call to Analyze_Aspect_Specifications. (Analyze_Task_Type_Declaration): Simplify calls to Analyze_Aspect_Specifications. * sem_dim.adb: Remove explicitly setting the parents for the Aspect_Specification list. * sem_disp.adb: Remove the with that is no longer required since Aspect_Specifications is a node operation now. * sem_util.adb (Copy_Node_With_Replacement): Remove explicit code for aspects. * treepr.adb (Print_Field): Remove the version that was used for printing aspects. (Print_Node): Remove aspect specific code.