diff mbox series

[Ada] Make runtime code compatible with No_Dynamic_Accessibility_Checks

Message ID 20210708134958.GA2465542@adacore.com
State New
Headers show
Series [Ada] Make runtime code compatible with No_Dynamic_Accessibility_Checks | expand

Commit Message

Pierre-Marie de Rodat July 8, 2021, 1:49 p.m. UTC
To help experiment with this new model.

Tested on x86_64-pc-linux-gnu, committed on trunk

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 mbox series

Patch

diff --git a/gcc/ada/libgnat/a-cbdlli.adb b/gcc/ada/libgnat/a-cbdlli.adb
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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);