elab4_pkg.ads
1.1 KB
-
[Ada] Suppression of elaboration-related warnings · 162ed06f
This patch changes the behavior of elaboration-related warnings as follows: * If a scenario or a target has [elaboration] warnings suppressed, then any further elaboration-related warnings along the paths rooted at the scenario are also suppressed. * Elaboration-related warnings related to task activation can now be suppressed when either the task object, task type, or the activation call have [elaboration] warnings suppressed. * Elaboration-related warnings related to calls can now be suppressed when either the target or the call have [elaboration] warnings suppressed. * Elaboration-related warnings related to instantiations can now be suppressed when the instantiation has [elaboration] warnings suppressed. The patch also cleans up the way the state of the Processing phase is updated with each new node along a path. It is now preferable to update the state in routines Process_Conditional_ABE_Activation_Impl Process_Conditional_ABE_Call Process_Conditional_ABE_Instantiation rather than within their language-specific versions. 2018-05-23 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * einfo.adb: Flag304 is now Is_Elaboration_Warnings_OK_Id. (Is_Elaboration_Warnings_OK_Id): New routine. (Set_Is_Elaboration_Warnings_OK_Id): New routine. (Write_Entity_Flags): Output Flag304. * einfo.ads: Add new attribute Is_Elaboration_Warnings_OK_Id along with occurrences in entities. (Is_Elaboration_Warnings_OK_Id): New routine along with pragma Inline. (Set_Is_Elaboration_Warnings_OK_Id): New routine along with pragma Inline. * sem_attr.adb (Analyze_Access_Attribute): Capture the state of elaboration warnings. * sem_ch3.adb (Analyze_Object_Declaration): Capture the state of elaboration warnings. * sem_ch6.adb (Analyze_Abstract_Subprogram_Declaration): Capture the state of elaboration warnings. (Analyze_Subprogram_Body_Helper): Capture the state of elaboration warnings. (Analyze_Subprogram_Declaration): Capture the state of elaboration warnings. * sem_ch9.adb (Analyze_Entry_Declaration): Capture the state of elaboration warnings. (Analyze_Single_Task_Declaration): Capture the state of elaboration warnings. (Analyze_Task_Type_Declaration): Capture the state of elaboration warnings. * sem_ch12.adb (Analyze_Generic_Package_Declaration): Capture the state of elaboration warnings. (Analyze_Generic_Subprogram_Declaration): Capture the state of elaboration warnings. * sem_elab.adb: Add a section on suppressing elaboration warnings. Type Processing_Attributes includes component Suppress_Warnings intended to suppress any elaboration warnings along a path in the graph. Update Initial_State to include a value for this component. Types Target_Attributes and Task_Attriutes include component Elab_Warnings_OK to indicate whether the target or task has elaboration warnings enabled. component Elab_Warnings_OK. (Build_Access_Marker): Propagate attribute Is_Elaboration_Warnings_OK_Node from the attribute to the generated call marker. (Extract_Instantiation_Attributes): Set the value for Elab_Warnings_OK. (Extract_Target_Attributes): Set the value for Elab_Warnings_OK. (Extract_Task_Attributes): Set the value for Elab_Warnings_OK. (Process_Conditional_ABE_Access): Suppress futher elaboration warnings when already in this mode or when the attribute or target have warnings suppressed. (Process_Conditional_ABE_Activation_Impl): Do not emit any diagnostics if warnings are suppressed. (Process_Conditional_ABE_Call): Suppress further elaboration warnings when already in this mode, or the target or call have warnings suppressed. (Process_Conditional_ABE_Call_Ada): Do not emit any diagnostics if warnings are suppressed. (Process_Conditional_ABE_Call_SPARK): Do not emit any diagnostics if warnings are suppressed. (Process_Conditional_ABE_Instantiation): Suppress further elaboration warnings when already in this mode or when the instantiation has warnings suppressed. (Process_Conditional_ABE_Instantiation_Ada): Do not emit any diagnostics if warnings are suppressed. (Process_Conditional_ABE_Variable_Assignment_Ada): Use the more specific Is_Elaboration_Warnings_OK_Id rather than Warnings_Off. (Process_Conditional_ABE_Variable_Assignment_SPARK): Use the more specific Is_Elaboration_Warnings_OK_Id rather than Warnings_Off. (Process_Task_Object): Suppress further elaboration warnings when already in this mode, or when the object, activation call, or task type have warnings suppressed. Update the processing state to indicate that the path goes through a task body. * sinfo.adb (Is_Elaboration_Warnings_OK_Node): Accept attribute references. (Set_Is_Elaboration_Warnings_OK_Node): Accept attribute references. * sinfo.ads: Attribute Is_Elaboration_Warnings_OK_Node now applies to attribute references. gcc/testsuite/ * gnat.dg/elab4.adb, gnat.dg/elab4_pkg.adb, gnat.dg/elab4_pkg.ads: New testcase. From-SVN: r260578
Hristian Kirtchev committed