aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-03-07 15:27:06 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-16 08:42:02 +0000
commit4e8b88f36ce705d20dddc86f999539cc854ef401 (patch)
tree56244ea58d2ef331f7fff9caed2ed6082c4cbbfb /gcc/ada
parent457fb3369aec1e9d681853bcd33d77bb8da2f8ea (diff)
downloadgcc-4e8b88f36ce705d20dddc86f999539cc854ef401.zip
gcc-4e8b88f36ce705d20dddc86f999539cc854ef401.tar.gz
gcc-4e8b88f36ce705d20dddc86f999539cc854ef401.tar.bz2
[Ada] Pick volatile refinement property of a subtype from its base type
Volatile refinement properties (e.g. Async_Writers), which refine the Volatile aspect in SPARK, are inherited by subtypes from their base types. In particular, this patch fixes handling of those properties for subtypes of private types. gcc/ada/ * sem_util.adb (Type_Or_Variable_Has_Enabled_Property): Given a subtype recurse into its base type.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sem_util.adb10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 6cf3c70..b0cca08 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -12683,7 +12683,8 @@ package body Sem_Util is
then
return False;
- -- For a private type, may need to look at the full view
+ -- For a private type (including subtype of a private types), look at
+ -- the full view.
elsif Is_Private_Type (Item_Id) and then Present (Full_View (Item_Id))
then
@@ -12696,6 +12697,13 @@ package body Sem_Util is
return Type_Or_Variable_Has_Enabled_Property
(First_Subtype (Etype (Base_Type (Item_Id))));
+ -- For a subtype, the property will be inherited from its base type.
+
+ elsif Is_Type (Item_Id)
+ and then not Is_Base_Type (Item_Id)
+ then
+ return Type_Or_Variable_Has_Enabled_Property (Etype (Item_Id));
+
-- If not specified explicitly for an object and its type
-- is effectively volatile, then take result from the type.