aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2021-02-09 14:23:37 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-15 06:19:26 -0400
commitd31c2b94331ea634e58a6bf9ce93241531819380 (patch)
tree5231b5e9c1d855a8eb8e0f1ea5467aafff2a0a3b /gcc
parent688fb8553bd589d6cfc71de467f38ae725199da9 (diff)
downloadgcc-d31c2b94331ea634e58a6bf9ce93241531819380.zip
gcc-d31c2b94331ea634e58a6bf9ce93241531819380.tar.gz
gcc-d31c2b94331ea634e58a6bf9ce93241531819380.tar.bz2
[Ada] Disable certain checks in predefined units
gcc/ada/ * sem_cat.adb (Check_Non_Static_Default_Expr): Allow nonstatic expression in predefined unit with pragma Preelaborate.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_cat.adb8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb
index dc07f78..92aa7ec 100644
--- a/gcc/ada/sem_cat.adb
+++ b/gcc/ada/sem_cat.adb
@@ -356,6 +356,14 @@ package body Sem_Cat is
if Present (Expression (Component_Decl))
and then Nkind (Expression (Component_Decl)) /= N_Null
and then not Is_OK_Static_Expression (Expression (Component_Decl))
+
+ -- If we're in a predefined unit, we can put whatever we like in a
+ -- preelaborated package, and in fact in some cases it's necessary
+ -- to bend the rules. Ada.Containers.Bounded_Hashed_Maps contains
+ -- some code that would not be considered preelaborable in user
+ -- code, for example.
+
+ and then not In_Predefined_Unit (Component_Decl)
then
Error_Msg_Sloc := Sloc (Component_Decl);
Error_Msg_F