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-2144] [Ada] Make runtime code compatible with No_Dynamic_Accessibility_Checks
Date: Thu,  8 Jul 2021 13:36:13 +0000 (GMT)	[thread overview]
Message-ID: <20210708133613.BAA3C398B879@sourceware.org> (raw)

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

commit r12-2144-gc5b1e8e9a5808d612ad20fdf2f77c52cfa5907d3
Author: Arnaud Charlet <charlet@adacore.com>
Date:   Tue May 25 04:18:21 2021 -0400

    [Ada] Make runtime code compatible with No_Dynamic_Accessibility_Checks
    
    gcc/ada/
    
            * libgnat/a-cbdlli.adb, libgnat/a-cbhama.adb,
            libgnat/a-cbhase.adb, libgnat/a-cbmutr.adb,
            libgnat/a-cborma.adb, libgnat/a-cborse.adb,
            libgnat/a-cobove.adb, libgnat/a-textio.adb,
            libgnat/a-witeio.adb, libgnat/a-ztexio.adb: Make code compatible
            with No_Dynamic_Accessibility_Checks restriction.

Diff:
---
 gcc/ada/libgnat/a-cbdlli.adb |  4 ++--
 gcc/ada/libgnat/a-cbhama.adb |  8 ++++----
 gcc/ada/libgnat/a-cbhase.adb |  4 ++--
 gcc/ada/libgnat/a-cbmutr.adb |  4 ++--
 gcc/ada/libgnat/a-cborma.adb |  8 ++++----
 gcc/ada/libgnat/a-cborse.adb |  8 ++++----
 gcc/ada/libgnat/a-cobove.adb |  8 ++++----
 gcc/ada/libgnat/a-textio.adb | 13 ++++++-------
 gcc/ada/libgnat/a-witeio.adb | 13 ++++++-------
 gcc/ada/libgnat/a-ztexio.adb | 13 ++++++-------
 10 files changed, 40 insertions(+), 43 deletions(-)

diff --git a/gcc/ada/libgnat/a-cbdlli.adb b/gcc/ada/libgnat/a-cbdlli.adb
index bb92bda9ebb..143805ef2b6 100644
--- a/gcc/ada/libgnat/a-cbdlli.adb
+++ b/gcc/ada/libgnat/a-cbdlli.adb
@@ -312,7 +312,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Constant_Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -1608,7 +1608,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
diff --git a/gcc/ada/libgnat/a-cbhama.adb b/gcc/ada/libgnat/a-cbhama.adb
index 78a590f7586..26c01f57e65 100644
--- a/gcc/ada/libgnat/a-cbhama.adb
+++ b/gcc/ada/libgnat/a-cbhama.adb
@@ -213,7 +213,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Constant_Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -239,7 +239,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Constant_Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -1028,7 +1028,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -1053,7 +1053,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
diff --git a/gcc/ada/libgnat/a-cbhase.adb b/gcc/ada/libgnat/a-cbhase.adb
index f8ca4d2720b..d6ab353b15d 100644
--- a/gcc/ada/libgnat/a-cbhase.adb
+++ b/gcc/ada/libgnat/a-cbhase.adb
@@ -232,7 +232,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Constant_Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -1643,7 +1643,7 @@ is
               Container.TC'Unrestricted_Access;
          begin
             return R : constant Constant_Reference_Type :=
-              (Element => N.Element'Access,
+              (Element => N.Element'Unchecked_Access,
                Control => (Controlled with TC))
             do
                Busy (TC.all);
diff --git a/gcc/ada/libgnat/a-cbmutr.adb b/gcc/ada/libgnat/a-cbmutr.adb
index 714dea1a3ee..e80eb5cdc0f 100644
--- a/gcc/ada/libgnat/a-cbmutr.adb
+++ b/gcc/ada/libgnat/a-cbmutr.adb
@@ -600,7 +600,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Constant_Reference_Type :=
-           (Element => Container.Elements (Position.Node)'Access,
+           (Element => Container.Elements (Position.Node)'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -2533,7 +2533,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Reference_Type :=
-           (Element => Container.Elements (Position.Node)'Access,
+           (Element => Container.Elements (Position.Node)'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
diff --git a/gcc/ada/libgnat/a-cborma.adb b/gcc/ada/libgnat/a-cborma.adb
index 67e610847b2..f26a1e38f6e 100644
--- a/gcc/ada/libgnat/a-cborma.adb
+++ b/gcc/ada/libgnat/a-cborma.adb
@@ -420,7 +420,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Constant_Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -445,7 +445,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Constant_Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -1417,7 +1417,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -1442,7 +1442,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
diff --git a/gcc/ada/libgnat/a-cborse.adb b/gcc/ada/libgnat/a-cborse.adb
index 0b9e0cc6b9a..5c9a86e2e72 100644
--- a/gcc/ada/libgnat/a-cborse.adb
+++ b/gcc/ada/libgnat/a-cborse.adb
@@ -420,7 +420,7 @@ is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Constant_Reference_Type :=
-           (Element => N.Element'Access,
+           (Element => N.Element'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -752,7 +752,7 @@ is
               Container.TC'Unrestricted_Access;
          begin
             return R : constant Constant_Reference_Type :=
-              (Element => N.Element'Access,
+              (Element => N.Element'Unchecked_Access,
                Control => (Controlled with TC))
             do
                Busy (TC.all);
@@ -943,7 +943,7 @@ is
             N : Node_Type renames Container.Nodes (Position.Node);
          begin
             return R : constant Reference_Type :=
-                         (Element => N.Element'Access,
+                         (Element => N.Element'Unchecked_Access,
                           Control =>
                             (Controlled with
                               Container.TC'Unrestricted_Access,
@@ -971,7 +971,7 @@ is
             N : Node_Type renames Container.Nodes (Node);
          begin
             return R : constant Reference_Type :=
-                         (Element => N.Element'Access,
+                         (Element => N.Element'Unchecked_Access,
                           Control =>
                             (Controlled with
                               Container.TC'Unrestricted_Access,
diff --git a/gcc/ada/libgnat/a-cobove.adb b/gcc/ada/libgnat/a-cobove.adb
index f32afa1a54b..e56cb94610e 100644
--- a/gcc/ada/libgnat/a-cobove.adb
+++ b/gcc/ada/libgnat/a-cobove.adb
@@ -415,7 +415,7 @@ package body Ada.Containers.Bounded_Vectors is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Constant_Reference_Type :=
-           (Element => A (J)'Access,
+           (Element => A (J)'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -439,7 +439,7 @@ package body Ada.Containers.Bounded_Vectors is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Constant_Reference_Type :=
-           (Element => A (J)'Access,
+           (Element => A (J)'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -2238,7 +2238,7 @@ package body Ada.Containers.Bounded_Vectors is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Reference_Type :=
-           (Element => A (J)'Access,
+           (Element => A (J)'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
@@ -2262,7 +2262,7 @@ package body Ada.Containers.Bounded_Vectors is
            Container.TC'Unrestricted_Access;
       begin
          return R : constant Reference_Type :=
-           (Element => A (J)'Access,
+           (Element => A (J)'Unchecked_Access,
             Control => (Controlled with TC))
          do
             Busy (TC.all);
diff --git a/gcc/ada/libgnat/a-textio.adb b/gcc/ada/libgnat/a-textio.adb
index dc670919710..717f529a7bb 100644
--- a/gcc/ada/libgnat/a-textio.adb
+++ b/gcc/ada/libgnat/a-textio.adb
@@ -171,15 +171,15 @@ is
       --  is required (RM A.10.3(23)) but it seems reasonable, and besides
       --  ACVC test CE3208A expects this behavior.
 
-      if File_Type (File) = Current_In then
+      if File = Current_In then
          Current_In := null;
-      elsif File_Type (File) = Current_Out then
+      elsif File = Current_Out then
          Current_Out := null;
-      elsif File_Type (File) = Current_Err then
+      elsif File = Current_Err then
          Current_Err := null;
       end if;
 
-      Terminate_Line (File_Type (File));
+      Terminate_Line (File.all'Access);
    end AFCB_Close;
 
    ---------------
@@ -187,10 +187,9 @@ is
    ---------------
 
    procedure AFCB_Free (File : not null access Text_AFCB) is
-      type FCB_Ptr is access all Text_AFCB;
-      FT : FCB_Ptr := FCB_Ptr (File);
+      FT : File_Type := File.all'Access;
 
-      procedure Free is new Ada.Unchecked_Deallocation (Text_AFCB, FCB_Ptr);
+      procedure Free is new Ada.Unchecked_Deallocation (Text_AFCB, File_Type);
 
    begin
       Free (FT);
diff --git a/gcc/ada/libgnat/a-witeio.adb b/gcc/ada/libgnat/a-witeio.adb
index dbd3fc8ed19..7dbd3b3ebc5 100644
--- a/gcc/ada/libgnat/a-witeio.adb
+++ b/gcc/ada/libgnat/a-witeio.adb
@@ -136,15 +136,15 @@ package body Ada.Wide_Text_IO is
       --  is required (RM A.10.3(23)) but it seems reasonable, and besides
       --  ACVC test CE3208A expects this behavior.
 
-      if File_Type (File) = Current_In then
+      if File = Current_In then
          Current_In := null;
-      elsif File_Type (File) = Current_Out then
+      elsif File = Current_Out then
          Current_Out := null;
-      elsif File_Type (File) = Current_Err then
+      elsif File = Current_Err then
          Current_Err := null;
       end if;
 
-      Terminate_Line (File_Type (File));
+      Terminate_Line (File.all'Access);
    end AFCB_Close;
 
    ---------------
@@ -152,11 +152,10 @@ package body Ada.Wide_Text_IO is
    ---------------
 
    procedure AFCB_Free (File : not null access Wide_Text_AFCB) is
-      type FCB_Ptr is access all Wide_Text_AFCB;
-      FT : FCB_Ptr := FCB_Ptr (File);
+      FT : File_Type := File.all'Access;
 
       procedure Free is
-        new Ada.Unchecked_Deallocation (Wide_Text_AFCB, FCB_Ptr);
+        new Ada.Unchecked_Deallocation (Wide_Text_AFCB, File_Type);
 
    begin
       Free (FT);
diff --git a/gcc/ada/libgnat/a-ztexio.adb b/gcc/ada/libgnat/a-ztexio.adb
index 0dfabd59c73..71d733ed538 100644
--- a/gcc/ada/libgnat/a-ztexio.adb
+++ b/gcc/ada/libgnat/a-ztexio.adb
@@ -136,15 +136,15 @@ package body Ada.Wide_Wide_Text_IO is
       --  is required (RM A.10.3(23)) but it seems reasonable, and besides
       --  ACVC test CE3208A expects this behavior.
 
-      if File_Type (File) = Current_In then
+      if File = Current_In then
          Current_In := null;
-      elsif File_Type (File) = Current_Out then
+      elsif File = Current_Out then
          Current_Out := null;
-      elsif File_Type (File) = Current_Err then
+      elsif File = Current_Err then
          Current_Err := null;
       end if;
 
-      Terminate_Line (File_Type (File));
+      Terminate_Line (File.all'Access);
    end AFCB_Close;
 
    ---------------
@@ -152,11 +152,10 @@ package body Ada.Wide_Wide_Text_IO is
    ---------------
 
    procedure AFCB_Free (File : not null access Wide_Wide_Text_AFCB) is
-      type FCB_Ptr is access all Wide_Wide_Text_AFCB;
-      FT : FCB_Ptr := FCB_Ptr (File);
+      FT : File_Type := File.all'Access;
 
       procedure Free is new
-        Ada.Unchecked_Deallocation (Wide_Wide_Text_AFCB, FCB_Ptr);
+        Ada.Unchecked_Deallocation (Wide_Wide_Text_AFCB, File_Type);
 
    begin
       Free (FT);


                 reply	other threads:[~2021-07-08 13:36 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=20210708133613.BAA3C398B879@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).