public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-473] [Ada] Remove duplicated code for detecting enabled pragmas Date: Mon, 16 May 2022 08:42:45 +0000 (GMT) [thread overview] Message-ID: <20220516084245.E73CB3857815@sourceware.org> (raw) 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
reply other threads:[~2022-05-16 8:42 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220516084245.E73CB3857815@sourceware.org \ --to=pmderodat@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).