diff options
author | Ed Schonberg <schonberg@adacore.com> | 2019-10-10 15:23:01 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-10-10 15:23:01 +0000 |
commit | c223b7646bff69adeea080fdddc499b30179efec (patch) | |
tree | 5526949bdb912eb87e39cb6ec3de4b67ffad456a /gcc/ada/sem_cat.adb | |
parent | 92219babbb18f8ee2590fe9e1040b0cc09d16b45 (diff) | |
download | gcc-c223b7646bff69adeea080fdddc499b30179efec.zip gcc-c223b7646bff69adeea080fdddc499b30179efec.tar.gz gcc-c223b7646bff69adeea080fdddc499b30179efec.tar.bz2 |
[Ada] Spurious visibility error in predicate in generic instance
2019-10-10 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_cat.adb (Set_Categorization_From_Pragma): Do not modify
any visibility settings if there are no compilation_unit pragmas
following the package declaration. Add comments for future
cleanup.
From-SVN: r276812
Diffstat (limited to 'gcc/ada/sem_cat.adb')
-rw-r--r-- | gcc/ada/sem_cat.adb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb index 663dca4..780fec9 100644 --- a/gcc/ada/sem_cat.adb +++ b/gcc/ada/sem_cat.adb @@ -721,9 +721,15 @@ package body Sem_Cat is -- The purpose is to set categorization flags before analyzing the -- unit itself, so as to diagnose violations of categorization as -- we process each declaration, even though the pragma appears after - -- the unit. - - if Nkind (P) /= N_Compilation_Unit then + -- the unit. This processing is only needsd if compilation unit + -- pragmas are present. + -- Note: this code may be incorrect in the unlikely case a child + -- genericc unit is instantiated as a child of its (non-generic) + -- parent, so that generic and insstance are siblings, + + if Nkind (P) /= N_Compilation_Unit + or else No (First (Pragmas_After (Aux_Decls_Node (P)))) + then return; end if; |