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-475] [Ada] Pick volatile refinement property of a subtype from its base type
Date: Mon, 16 May 2022 08:42:56 +0000 (GMT)	[thread overview]
Message-ID: <20220516084256.2B10C3857827@sourceware.org> (raw)

https://gcc.gnu.org/g:4e8b88f36ce705d20dddc86f999539cc854ef401

commit r13-475-g4e8b88f36ce705d20dddc86f999539cc854ef401
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Mon Mar 7 15:27:06 2022 +0100

    [Ada] Pick volatile refinement property of a subtype from its base type
    
    Volatile refinement properties (e.g. Async_Writers), which refine the
    Volatile aspect in SPARK, are inherited by subtypes from their base
    types. In particular, this patch fixes handling of those properties for
    subtypes of private types.
    
    gcc/ada/
    
            * sem_util.adb (Type_Or_Variable_Has_Enabled_Property): Given a
            subtype recurse into its base type.

Diff:
---
 gcc/ada/sem_util.adb | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 6cf3c70c8d9..b0cca0896e3 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -12683,7 +12683,8 @@ package body Sem_Util is
          then
             return False;
 
-         --  For a private type, may need to look at the full view
+         --  For a private type (including subtype of a private types), look at
+         --  the full view.
 
          elsif Is_Private_Type (Item_Id) and then Present (Full_View (Item_Id))
          then
@@ -12696,6 +12697,13 @@ package body Sem_Util is
             return Type_Or_Variable_Has_Enabled_Property
               (First_Subtype (Etype (Base_Type (Item_Id))));
 
+         --  For a subtype, the property will be inherited from its base type.
+
+         elsif Is_Type (Item_Id)
+           and then not Is_Base_Type (Item_Id)
+         then
+            return Type_Or_Variable_Has_Enabled_Property (Etype (Item_Id));
+
          --  If not specified explicitly for an object and its type
          --  is effectively volatile, then take result from the 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=20220516084256.2B10C3857827@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: link
Be 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).