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 r12-1523] [Ada] Fix Is_Volatile_Function for functions declared in protected bodies
Date: Wed, 16 Jun 2021 08:46:20 +0000 (GMT)	[thread overview]
Message-ID: <20210616084620.22B65398A85A@sourceware.org> (raw)

https://gcc.gnu.org/g:ccf0dee109ba0c71ca2b6e093a874daf1671ecf0

commit r12-1523-gccf0dee109ba0c71ca2b6e093a874daf1671ecf0
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Wed Mar 3 21:19:39 2021 +0100

    [Ada] Fix Is_Volatile_Function for functions declared in protected bodies
    
    gcc/ada/
    
            * sem_util.adb (Is_Volatile_Function): Follow the exact wording
            of SPARK (regarding volatile functions) and Ada (regarding
            protected functions).

Diff:
---
 gcc/ada/sem_util.adb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 6376b4e6b62..6481d86a835 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -21105,9 +21105,11 @@ package body Sem_Util is
    begin
       pragma Assert (Ekind (Func_Id) in E_Function | E_Generic_Function);
 
-      --  A function declared within a protected type is volatile
+      --  A protected function is volatile
 
-      if Is_Protected_Type (Scope (Func_Id)) then
+      if Nkind (Parent (Unit_Declaration_Node (Func_Id))) =
+           N_Protected_Definition
+      then
          return True;
 
       --  An instance of Ada.Unchecked_Conversion is a volatile function if


                 reply	other threads:[~2021-06-16  8:46 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=20210616084620.22B65398A85A@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).