diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2024-04-08 18:00:05 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-06-10 11:03:57 +0200 |
commit | 7ec7b5ae9f1d9ade520bc9e658eae5f1d6e75055 (patch) | |
tree | db89be7680b5b8ddabbe3a26f59fdebe594dabf8 /gcc | |
parent | 9b0f70bf9391d5cc200e8122f54bc0297d4362b8 (diff) | |
download | gcc-7ec7b5ae9f1d9ade520bc9e658eae5f1d6e75055.zip gcc-7ec7b5ae9f1d9ade520bc9e658eae5f1d6e75055.tar.gz gcc-7ec7b5ae9f1d9ade520bc9e658eae5f1d6e75055.tar.bz2 |
ada: Refactor checks for Refined_Depends in generic instances
Code cleanup; semantics is unaffected.
gcc/ada/
* sem_prag.adb (Check_Dependency_Clause, Check_Output_States,
Report_Extra_Clauses): Remove multiple checks for being inside
an instance.
(Analyze_Refined_Depends_In_Decl_Part): Add single check for
being inside an instance.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_prag.adb | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 86a25dc..29f2765 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -27650,13 +27650,6 @@ package body Sem_Prag is -- Start of processing for Check_Dependency_Clause begin - -- Do not perform this check in an instance because it was already - -- performed successfully in the generic template. - - if In_Instance then - return; - end if; - -- Examine all refinement clauses and compare them against the -- dependence clause. @@ -27910,16 +27903,10 @@ package body Sem_Prag is -- Start of processing for Check_Output_States begin - -- Do not perform this check in an instance because it was already - -- performed successfully in the generic template. - - if In_Instance then - null; - -- Inspect the outputs of pragma Depends looking for a state with a -- visible refinement. - elsif Present (Spec_Outputs) then + if Present (Spec_Outputs) then Item_Elmt := First_Elmt (Spec_Outputs); while Present (Item_Elmt) loop Item := Node (Item_Elmt); @@ -28261,13 +28248,7 @@ package body Sem_Prag is Clause : Node_Id; begin - -- Do not perform this check in an instance because it was already - -- performed successfully in the generic template. - - if In_Instance then - null; - - elsif Present (Clauses) then + if Present (Clauses) then Clause := First (Clauses); while Present (Clause) loop SPARK_Msg_N @@ -28369,6 +28350,13 @@ package body Sem_Prag is Analyze_Depends_In_Decl_Part (N); + -- Do not perform these checks in an instance because they were already + -- performed successfully in the generic template. + + if In_Instance then + goto Leave; + end if; + -- Do not match dependencies against refinements if Refined_Depends is -- illegal to avoid emitting misleading error. |