aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sinfo.adb
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2018-05-23 10:22:15 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-23 10:22:15 +0000
commit162ed06fb32b64802db9909e27c447527dd759ee (patch)
treeeb5a862c578f7df8ff465ba87e1b3ff3034fa3ef /gcc/ada/sinfo.adb
parent53b30c73574ee0109f2408a4ef61d10a4e4669d6 (diff)
downloadgcc-162ed06fb32b64802db9909e27c447527dd759ee.zip
gcc-162ed06fb32b64802db9909e27c447527dd759ee.tar.gz
gcc-162ed06fb32b64802db9909e27c447527dd759ee.tar.bz2
[Ada] Suppression of elaboration-related warnings
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
Diffstat (limited to 'gcc/ada/sinfo.adb')
-rw-r--r--gcc/ada/sinfo.adb2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb
index 4ab5614..acb3215 100644
--- a/gcc/ada/sinfo.adb
+++ b/gcc/ada/sinfo.adb
@@ -1929,6 +1929,7 @@ package body Sinfo is
(N : Node_Id) return Boolean is
begin
pragma Assert (False
+ or else NT (N).Nkind = N_Attribute_Reference
or else NT (N).Nkind = N_Call_Marker
or else NT (N).Nkind = N_Entry_Call_Statement
or else NT (N).Nkind = N_Function_Call
@@ -5392,6 +5393,7 @@ package body Sinfo is
(N : Node_Id; Val : Boolean := True) is
begin
pragma Assert (False
+ or else NT (N).Nkind = N_Attribute_Reference
or else NT (N).Nkind = N_Call_Marker
or else NT (N).Nkind = N_Entry_Call_Statement
or else NT (N).Nkind = N_Function_Call