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-1456] [Ada] Replace repeated calls by references to a local object
Date: Tue, 15 Jun 2021 10:21:11 +0000 (GMT)	[thread overview]
Message-ID: <20210615102111.90DFE398B840@sourceware.org> (raw)

https://gcc.gnu.org/g:69558e562c0605e1e13d069c3bdbadedf7d72016

commit r12-1456-g69558e562c0605e1e13d069c3bdbadedf7d72016
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Wed Feb 3 09:19:20 2021 +0100

    [Ada] Replace repeated calls by references to a local object
    
    gcc/ada/
    
            * sem_res.adb (Resolve_Actual): Replace repeated calls to
            "Etype (F)" with references to "F_Typ", which keeps the results
            of exactly that call.

Diff:
---
 gcc/ada/sem_res.adb | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 25badeead45..a57038528ad 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -4798,11 +4798,11 @@ package body Sem_Res is
 
             --  Check illegal cases of atomic/volatile/VFA actual (RM C.6(12))
 
-            if (Is_By_Reference_Type (Etype (F)) or else Is_Aliased (F))
+            if (Is_By_Reference_Type (F_Typ) or else Is_Aliased (F))
               and then Comes_From_Source (N)
             then
                if Is_Atomic_Object (A)
-                 and then not Is_Atomic (Etype (F))
+                 and then not Is_Atomic (F_Typ)
                then
                   Error_Msg_NE
                     ("cannot pass atomic object to nonatomic formal&",
@@ -4811,7 +4811,7 @@ package body Sem_Res is
                     ("\which is passed by reference (RM C.6(12))", A);
 
                elsif Is_Volatile_Object_Ref (A)
-                 and then not Is_Volatile (Etype (F))
+                 and then not Is_Volatile (F_Typ)
                then
                   Error_Msg_NE
                     ("cannot pass volatile object to nonvolatile formal&",
@@ -4820,7 +4820,7 @@ package body Sem_Res is
                     ("\which is passed by reference (RM C.6(12))", A);
 
                elsif Is_Volatile_Full_Access_Object_Ref (A)
-                 and then not Is_Volatile_Full_Access (Etype (F))
+                 and then not Is_Volatile_Full_Access (F_Typ)
                then
                   Error_Msg_NE
                     ("cannot pass full access object to nonfull access "
@@ -4855,9 +4855,9 @@ package body Sem_Res is
             if Is_Controlling_Formal (F) then
                Set_Is_Controlling_Actual (A);
 
-               if Ekind (Etype (F)) = E_Anonymous_Access_Type then
+               if Ekind (F_Typ) = E_Anonymous_Access_Type then
                   declare
-                     Desig : constant Entity_Id := Designated_Type (Etype (F));
+                     Desig : constant Entity_Id := Designated_Type (F_Typ);
                   begin
                      if Ekind (Desig) = E_Incomplete_Type
                        and then No (Full_View (Desig))
@@ -4966,8 +4966,8 @@ package body Sem_Res is
                --  actual when the corresponding formal is of a non-scalar
                --  effectively volatile type for reading (SPARK RM 7.1.3(10)).
 
-               if not Is_Scalar_Type (Etype (F))
-                 and then Is_Effectively_Volatile_For_Reading (Etype (F))
+               if not Is_Scalar_Type (F_Typ)
+                 and then Is_Effectively_Volatile_For_Reading (F_Typ)
                then
                   null;
 
@@ -5088,7 +5088,7 @@ package body Sem_Res is
               and then Comes_From_Source (Nam)
 
               and then not Is_Primitive (Nam)
-              and then not Is_Class_Wide_Type (Etype (F))
+              and then not Is_Class_Wide_Type (F_Typ)
             then
                Error_Msg_NE
                  ("call to nonprimitive & with current instance not allowed " &


                 reply	other threads:[~2021-06-15 10:21 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=20210615102111.90DFE398B840@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).