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.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_util.adb (Is_Enabled): Remove; use Is_Enabled_Pragma
instead.
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
--- 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