diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-12-16 10:33:45 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-12-16 10:33:45 +0000 |
commit | d8468b976bb2721c32368e2a80591e77ca49250f (patch) | |
tree | d7fd7ad92d568545f6796febd4fa09361ad9e870 /gcc/ada | |
parent | bee69f33688293b0c5afdf737d03aca12a8fccb4 (diff) | |
download | gcc-d8468b976bb2721c32368e2a80591e77ca49250f.zip gcc-d8468b976bb2721c32368e2a80591e77ca49250f.tar.gz gcc-d8468b976bb2721c32368e2a80591e77ca49250f.tar.bz2 |
[Ada] Small consistency fix for Volatile_Full_Access objects
2019-12-16 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_util.adb (Is_Atomic_Or_VFA_Object): Also return true for
components whose type is Volatile_Full_Access or which are
subject to the aspect/pragma individually.
* sem_util.ads (Is_Atomic_Object_Entity): Small comment fix.
From-SVN: r279420
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 49 | ||||
-rw-r--r-- | gcc/ada/sem_util.ads | 2 |
3 files changed, 51 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e1952da..95e195d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-12-16 Eric Botcazou <ebotcazou@adacore.com> + + * sem_util.adb (Is_Atomic_Or_VFA_Object): Also return true for + components whose type is Volatile_Full_Access or which are + subject to the aspect/pragma individually. + * sem_util.ads (Is_Atomic_Object_Entity): Small comment fix. + 2019-12-16 Yannick Moy <moy@adacore.com> * exp_ch6.adb: Fix comment. diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 7ed717d..2c4ff68 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -13788,13 +13788,50 @@ package body Sem_Util is ----------------------------- function Is_Atomic_Or_VFA_Object (N : Node_Id) return Boolean is + function Is_VFA_Object (N : Node_Id) return Boolean; + -- Determine whether arbitrary node N denotes a reference to an object + -- which is Volatile_Full_Access. Modelled on Is_Atomic_Object above. + + function Is_VFA_Object_Entity (Id : Entity_Id) return Boolean; + -- Determine whether arbitrary entity Id denotes an object which is + -- Volatile_Full_Access. Modelled on Is_Atomic_Object_Entity above. + + --------------------- + -- Is_VFA_Object -- + --------------------- + + function Is_VFA_Object (N : Node_Id) return Boolean is + begin + if Is_Entity_Name (N) then + return Is_VFA_Object_Entity (Entity (N)); + + elsif Nkind (N) = N_Indexed_Component then + return Is_Volatile_Full_Access (Etype (N)); + + elsif Nkind (N) = N_Selected_Component then + return + Is_Volatile_Full_Access (Etype (N)) + or else Is_Volatile_Full_Access (Entity (Selector_Name (N))); + end if; + + return False; + end Is_VFA_Object; + + ---------------------------- + -- Is_VFA_Object_Entity -- + ---------------------------- + + function Is_VFA_Object_Entity (Id : Entity_Id) return Boolean is + begin + return + Is_Object (Id) + and then (Is_Volatile_Full_Access (Id) + or else + Is_Volatile_Full_Access (Etype (Id))); + end Is_VFA_Object_Entity; + begin - return Is_Atomic_Object (N) - or else (Is_Entity_Name (N) - and then Is_Object (Entity (N)) - and then (Is_Volatile_Full_Access (Entity (N)) - or else - Is_Volatile_Full_Access (Etype (Entity (N))))); + return Is_Atomic_Object (N) or else Is_VFA_Object (N); end Is_Atomic_Or_VFA_Object; ---------------------- diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 89fa579..a665b5e 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -1535,7 +1535,7 @@ package Sem_Util is function Is_Atomic_Object_Entity (Id : Entity_Id) return Boolean; -- Determine whether arbitrary entity Id denotes an atomic object as per - -- Ada RM C.6(12). + -- Ada RM C.6(7). function Is_Atomic_Or_VFA_Object (N : Node_Id) return Boolean; -- Determine whether arbitrary node N denotes a reference to an object |