aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch3.adb
diff options
context:
space:
mode:
authorMarc Poulhiès <poulhies@adacore.com>2022-02-01 12:20:51 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-11 08:53:21 +0000
commit4cfd39b0ff56c20db588385ee7be9853278ea142 (patch)
tree8998e730fa1ca002f23084b7c27f43554c152c3f /gcc/ada/sem_ch3.adb
parentc63b798f88aa82de32789b6a2ae5f387e58165c7 (diff)
downloadgcc-4cfd39b0ff56c20db588385ee7be9853278ea142.zip
gcc-4cfd39b0ff56c20db588385ee7be9853278ea142.tar.gz
gcc-4cfd39b0ff56c20db588385ee7be9853278ea142.tar.bz2
[Ada] New No_Local_Tagged_Types restriction
Add new configuration restriction No_Local_Tagged_Types. This new restriction ensures at compile time that all tagged types are only declared at the library level. gcc/ada/ * libgnat/s-rident.ads (Restriction_Id): Add No_Local_Tagged_Types, update comment for adding new GNAT specific restriction. * restrict.ads (Implementation_Restriction): Add No_Local_Tagged_Types. * sem_ch3.adb (Analyze_Full_Type_Declaration): Add check for tagged type at library level. * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst: Add No_Local_Tagged_Types description. * gnat_rm.texi: Regenerate.
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r--gcc/ada/sem_ch3.adb8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 6559c8f..133178f 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -3479,6 +3479,14 @@ package body Sem_Ch3 is
then
Check_Nonoverridable_Aspects;
end if;
+
+ -- Check for tagged type declaration at library level
+
+ if Is_Tagged_Type (T)
+ and then not Is_Library_Level_Entity (T)
+ then
+ Check_Restriction (No_Local_Tagged_Types, T);
+ end if;
end Analyze_Full_Type_Declaration;
----------------------------------