aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-05-29 20:57:53 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-15 09:42:41 -0400
commit98e663f5979ad0686d7ed79a3c8ff7445f5fab18 (patch)
tree9190a63f00efc8ee457bd65bebde2ee8d3cb2e75 /gcc
parent8cd5951d68b98425beec4a632abcdc3c559074a4 (diff)
downloadgcc-98e663f5979ad0686d7ed79a3c8ff7445f5fab18.zip
gcc-98e663f5979ad0686d7ed79a3c8ff7445f5fab18.tar.gz
gcc-98e663f5979ad0686d7ed79a3c8ff7445f5fab18.tar.bz2
[Ada] Cleanup condition for an effectively volatile array type
gcc/ada/ * sem_prag.adb (Atomic_Components): Simplify with Ekind_In. (Complex_Representation): Fix type of E_Id, which just like when for pragma Atomic_Components will hold an N_Identifier node, not an entity. * sem_util.adb (Is_Effectively_Volatile): Refactor to avoid unnecessary computation.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_prag.adb6
-rw-r--r--gcc/ada/sem_util.adb30
2 files changed, 18 insertions, 18 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 24053d5..2895a9c 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -13626,9 +13626,7 @@ package body Sem_Prag is
if (Nkind (D) = N_Full_Type_Declaration and then Is_Array_Type (E))
or else
(Nkind (D) = N_Object_Declaration
- and then (Ekind (E) = E_Constant
- or else
- Ekind (E) = E_Variable)
+ and then Ekind_In (E, E_Constant, E_Variable)
and then Nkind (Object_Definition (D)) =
N_Constrained_Array_Definition)
or else
@@ -14258,7 +14256,7 @@ package body Sem_Prag is
-- pragma Complex_Representation ([Entity =>] LOCAL_NAME);
when Pragma_Complex_Representation => Complex_Representation : declare
- E_Id : Entity_Id;
+ E_Id : Node_Id;
E : Entity_Id;
Ent : Entity_Id;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 7823373..ddd4d27 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -15615,22 +15615,24 @@ package body Sem_Util is
-- effectively volatile.
elsif Is_Array_Type (Id) then
- declare
- Anc : Entity_Id := Base_Type (Id);
- begin
- if Is_Private_Type (Anc) then
- Anc := Full_View (Anc);
- end if;
+ if Has_Volatile_Components (Id) then
+ return True;
+ else
+ declare
+ Anc : Entity_Id := Base_Type (Id);
+ begin
+ if Is_Private_Type (Anc) then
+ Anc := Full_View (Anc);
+ end if;
- -- Test for presence of ancestor, as the full view of a private
- -- type may be missing in case of error.
+ -- Test for presence of ancestor, as the full view of a
+ -- private type may be missing in case of error.
- return
- Has_Volatile_Components (Id)
- or else
- (Present (Anc)
- and then Is_Effectively_Volatile (Component_Type (Anc)));
- end;
+ return
+ Present (Anc)
+ and then Is_Effectively_Volatile (Component_Type (Anc));
+ end;
+ end if;
-- A protected type is always volatile