public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-473] [Ada] Remove duplicated code for detecting enabled pragmas
@ 2022-05-16 8:42 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-16 8:42 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:07ee67a44d90380c3ab13587dd7d3f4714379d1f
commit r13-473-g07ee67a44d90380c3ab13587dd7d3f4714379d1f
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Fri Mar 4 17:46:30 2022 +0100
[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.
Diff:
---
gcc/ada/sem_util.adb | 48 ++++--------------------------------------------
1 file changed, 4 insertions(+), 44 deletions(-)
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index b7ebd4abbaa..d53c4356976 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-16 8:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16 8:42 [gcc r13-473] [Ada] Remove duplicated code for detecting enabled pragmas Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).