aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-03-04 17:46:30 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-16 08:42:02 +0000
commit07ee67a44d90380c3ab13587dd7d3f4714379d1f (patch)
treecf31ed675c0a9d58f9999b3a3843e623425282df /gcc/ada
parentca32b29ec3e92dcf8dda5c2501d0baf9dd1cb09d (diff)
downloadgcc-07ee67a44d90380c3ab13587dd7d3f4714379d1f.zip
gcc-07ee67a44d90380c3ab13587dd7d3f4714379d1f.tar.gz
gcc-07ee67a44d90380c3ab13587dd7d3f4714379d1f.tar.bz2
[Ada] Remove duplicated code for detecting enabled pragmas
Routines Is_Enabled and Is_Enabled_Pragma are identical (except for comments); remove this duplication. Cleanup related to handling of volatile refinement aspects in SPARK; behaviour is unaffected. gcc/ada/ * sem_util.adb (Is_Enabled): Remove; use Is_Enabled_Pragma instead.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sem_util.adb48
1 files changed, 4 insertions, 44 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index b7ebd4a..d53c435 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -12632,44 +12632,6 @@ package body Sem_Util is
function Type_Or_Variable_Has_Enabled_Property
(Item_Id : Entity_Id) return Boolean
is
- function Is_Enabled (Prag : Node_Id) return Boolean;
- -- Determine whether property pragma Prag (if present) denotes an
- -- enabled property.
-
- ----------------
- -- Is_Enabled --
- ----------------
-
- function Is_Enabled (Prag : Node_Id) return Boolean is
- Arg1 : Node_Id;
-
- begin
- if Present (Prag) then
- Arg1 := First (Pragma_Argument_Associations (Prag));
-
- -- The pragma has an optional Boolean expression, the related
- -- property is enabled only when the expression evaluates to
- -- True.
-
- if Present (Arg1) then
- return Is_True (Expr_Value (Get_Pragma_Arg (Arg1)));
-
- -- Otherwise the lack of expression enables the property by
- -- default.
-
- else
- return True;
- end if;
-
- -- The property was never set in the first place
-
- else
- return False;
- end if;
- end Is_Enabled;
-
- -- Local variables
-
AR : constant Node_Id :=
Get_Pragma (Item_Id, Pragma_Async_Readers);
AW : constant Node_Id :=
@@ -12683,8 +12645,6 @@ package body Sem_Util is
Is_Derived_Type (Item_Id)
and then Is_Effectively_Volatile (Etype (Base_Type (Item_Id)));
- -- Start of processing for Type_Or_Variable_Has_Enabled_Property
-
begin
-- A non-effectively volatile object can never possess external
-- properties.
@@ -12699,16 +12659,16 @@ package body Sem_Util is
-- missing altogether.
elsif Property = Name_Async_Readers and then Present (AR) then
- return Is_Enabled (AR);
+ return Is_Enabled_Pragma (AR);
elsif Property = Name_Async_Writers and then Present (AW) then
- return Is_Enabled (AW);
+ return Is_Enabled_Pragma (AW);
elsif Property = Name_Effective_Reads and then Present (ER) then
- return Is_Enabled (ER);
+ return Is_Enabled_Pragma (ER);
elsif Property = Name_Effective_Writes and then Present (EW) then
- return Is_Enabled (EW);
+ return Is_Enabled_Pragma (EW);
-- If other properties are set explicitly, then this one is set
-- implicitly to False, except in the case of a derived type