aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-02-09 13:01:11 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-13 08:04:29 +0000
commitcb50998584eda9bbd3377d3dca6a8d264d6c4891 (patch)
treee871f1069b53f814929873605f0f52d0ae3055b6
parent84f20139792e97f9fb6e10918e271c3277d0f178 (diff)
downloadgcc-cb50998584eda9bbd3377d3dca6a8d264d6c4891.zip
gcc-cb50998584eda9bbd3377d3dca6a8d264d6c4891.tar.gz
gcc-cb50998584eda9bbd3377d3dca6a8d264d6c4891.tar.bz2
[Ada] Remove obsolete uses of Unchecked_Deallocation from Ada 83
In Ada 83 the Unchecked_Deallocation was a top-level unit; since Ada 95 it is an obsolete renaming of Ada.Unchecked_Deallocation. GNAT doesn't yet warn about uses of these obsolete renamings, but it still seems better to avoid them. Cleanup before adding a new instance of Unchecked_Deallocation. Offending occurrences found with grep. gcc/ada/ * butil.adb, sem.adb, sinput.adb, types.ads, xref_lib.adb: Replace uses of Unchecked_Deallocation with Ada.Unchecked_Deallocation. * doc/gnat_ugn/gnat_and_program_execution.rst: Likewise for the documentation; fix casing of GNAT.IO. * gnat_ugn.texi: Regenerate.
-rw-r--r--gcc/ada/butil.adb4
-rw-r--r--gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst14
-rw-r--r--gcc/ada/gnat_ugn.texi12
-rw-r--r--gcc/ada/sem.adb4
-rw-r--r--gcc/ada/sinput.adb10
-rw-r--r--gcc/ada/types.ads7
-rw-r--r--gcc/ada/xref_lib.adb5
7 files changed, 28 insertions, 28 deletions
diff --git a/gcc/ada/butil.adb b/gcc/ada/butil.adb
index d6e21df..9536c10 100644
--- a/gcc/ada/butil.adb
+++ b/gcc/ada/butil.adb
@@ -23,9 +23,9 @@
-- --
------------------------------------------------------------------------------
+with Ada.Unchecked_Deallocation;
with Opt; use Opt;
with Output; use Output;
-with Unchecked_Deallocation;
with GNAT; use GNAT;
@@ -540,7 +540,7 @@ package body Butil is
---------------------------------
function Read_Forced_Elab_Order_File return String_Ptr is
- procedure Free is new Unchecked_Deallocation (String, String_Ptr);
+ procedure Free is new Ada.Unchecked_Deallocation (String, String_Ptr);
Descr : File_Descriptor;
Len : Natural;
diff --git a/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst b/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst
index 6104152..bf0fec9 100644
--- a/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst
+++ b/gcc/ada/doc/gnat_ugn/gnat_and_program_execution.rst
@@ -3590,9 +3590,9 @@ properly allocated memory location. Here is a complete example of use of
.. code-block:: ada
- with Gnat.Io; use Gnat.Io;
- with Unchecked_Deallocation;
- with Unchecked_Conversion;
+ with GNAT.IO; use GNAT.IO;
+ with Ada.Unchecked_Deallocation;
+ with Ada.Unchecked_Conversion;
with GNAT.Debug_Pools;
with System.Storage_Elements;
with Ada.Exceptions; use Ada.Exceptions;
@@ -3604,8 +3604,8 @@ properly allocated memory location. Here is a complete example of use of
P : GNAT.Debug_Pools.Debug_Pool;
for T'Storage_Pool use P;
- procedure Free is new Unchecked_Deallocation (Integer, T);
- function UC is new Unchecked_Conversion (U, T);
+ procedure Free is new Ada.Unchecked_Deallocation (Integer, T);
+ function UC is new Ada.Unchecked_Conversion (U, T);
A, B : aliased T;
procedure Info is new GNAT.Debug_Pools.Print_Info(Put_Line);
@@ -3864,12 +3864,12 @@ execution of this erroneous program:
.. code-block:: ada
- with Unchecked_Deallocation;
+ with Ada.Unchecked_Deallocation;
procedure Test_Gm is
type T is array (1..1000) of Integer;
type Ptr is access T;
- procedure Free is new Unchecked_Deallocation (T, Ptr);
+ procedure Free is new Ada.Unchecked_Deallocation (T, Ptr);
A : Ptr;
procedure My_Alloc is
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 4c7dc95..879f5fc 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -22221,9 +22221,9 @@ properly allocated memory location. Here is a complete example of use of
@quotation
@example
-with Gnat.Io; use Gnat.Io;
-with Unchecked_Deallocation;
-with Unchecked_Conversion;
+with GNAT.IO; use GNAT.IO;
+with Ada.Unchecked_Deallocation;
+with Ada.Unchecked_Conversion;
with GNAT.Debug_Pools;
with System.Storage_Elements;
with Ada.Exceptions; use Ada.Exceptions;
@@ -22235,8 +22235,8 @@ procedure Debug_Pool_Test is
P : GNAT.Debug_Pools.Debug_Pool;
for T'Storage_Pool use P;
- procedure Free is new Unchecked_Deallocation (Integer, T);
- function UC is new Unchecked_Conversion (U, T);
+ procedure Free is new Ada.Unchecked_Deallocation (Integer, T);
+ function UC is new Ada.Unchecked_Conversion (U, T);
A, B : aliased T;
procedure Info is new GNAT.Debug_Pools.Print_Info(Put_Line);
@@ -29248,8 +29248,8 @@ to permit their use in free software.
@printindex ge
-@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ }
@anchor{cf}@w{ }
+@anchor{gnat_ugn/gnat_utility_programs switches-related-to-project-files}@w{ }
@c %**end of body
@bye
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index ea64690..796fffb 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -61,7 +61,7 @@ with Stylesw; use Stylesw;
with Uintp; use Uintp;
with Uname; use Uname;
-with Unchecked_Deallocation;
+with Ada.Unchecked_Deallocation;
pragma Warnings (Off, Sem_Util);
-- Suppress warnings of unused with for Sem_Util (used only in asserts)
@@ -1062,7 +1062,7 @@ package body Sem is
procedure Initialize is
Next : Suppress_Stack_Entry_Ptr;
- procedure Free is new Unchecked_Deallocation
+ procedure Free is new Ada.Unchecked_Deallocation
(Suppress_Stack_Entry, Suppress_Stack_Entry_Ptr);
begin
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb
index ccc4a7a..fccbacf 100644
--- a/gcc/ada/sinput.adb
+++ b/gcc/ada/sinput.adb
@@ -41,8 +41,8 @@ with System.Storage_Elements;
with System.Memory;
with System.WCh_Con; use System.WCh_Con;
+with Ada.Unchecked_Deallocation;
with Unchecked_Conversion;
-with Unchecked_Deallocation;
package body Sinput is
@@ -319,10 +319,10 @@ package body Sinput is
-- Clear_Source_File_Table --
-----------------------------
- procedure Free is new Unchecked_Deallocation
+ procedure Free is new Ada.Unchecked_Deallocation
(Lines_Table_Type, Lines_Table_Ptr);
- procedure Free is new Unchecked_Deallocation
+ procedure Free is new Ada.Unchecked_Deallocation
(Logical_Lines_Table_Type, Logical_Lines_Table_Ptr);
procedure Clear_Source_File_Table is
@@ -383,7 +383,7 @@ package body Sinput is
Temp : Source_Buffer_Ptr_Var := To_Source_Buffer_Ptr_Var (Src);
procedure Free_Ptr is new
- Unchecked_Deallocation (Source_Buffer, Source_Buffer_Ptr_Var);
+ Ada.Unchecked_Deallocation (Source_Buffer, Source_Buffer_Ptr_Var);
begin
Free_Ptr (Temp);
Src := null;
@@ -922,7 +922,7 @@ package body Sinput is
pragma Import (Ada, Dope);
use System.Storage_Elements;
for Dope'Address use Src + System.Address'Size / 8;
- procedure Free is new Unchecked_Deallocation (Dope_Rec, Dope_Ptr);
+ procedure Free is new Ada.Unchecked_Deallocation (Dope_Rec, Dope_Ptr);
begin
Free (Dope);
end Free_Dope;
diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads
index a44aa13..de14bf7 100644
--- a/gcc/ada/types.ads
+++ b/gcc/ada/types.ads
@@ -39,9 +39,9 @@
-- 2s-complement. If there are any machines for which this is not a correct
-- assumption, a significant number of changes will be required.
+with Ada.Unchecked_Deallocation;
with System;
with Unchecked_Conversion;
-with Unchecked_Deallocation;
package Types is
pragma Preelaborate;
@@ -117,7 +117,7 @@ package Types is
type String_Ptr_Const is access constant String;
-- Standard character and string pointers
- procedure Free is new Unchecked_Deallocation (String, String_Ptr);
+ procedure Free is new Ada.Unchecked_Deallocation (String, String_Ptr);
-- Procedure for freeing dynamically allocated String values
subtype Big_String is String (Positive);
@@ -155,7 +155,8 @@ package Types is
-- Text buffers for input files are allocated dynamically and this type
-- is used to reference these text buffers.
- procedure Free is new Unchecked_Deallocation (Text_Buffer, Text_Buffer_Ptr);
+ procedure Free is
+ new Ada.Unchecked_Deallocation (Text_Buffer, Text_Buffer_Ptr);
-- Procedure for freeing dynamically allocated text buffers
------------------------------------------
diff --git a/gcc/ada/xref_lib.adb b/gcc/ada/xref_lib.adb
index a215467..3cb7bcb 100644
--- a/gcc/ada/xref_lib.adb
+++ b/gcc/ada/xref_lib.adb
@@ -29,10 +29,9 @@ with Osint;
with Output; use Output;
with Types; use Types;
-with Unchecked_Deallocation;
-
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Text_IO;
+with Ada.Unchecked_Deallocation;
with GNAT.Command_Line; use GNAT.Command_Line;
with GNAT.IO_Aux; use GNAT.IO_Aux;
@@ -1718,7 +1717,7 @@ package body Xref_Lib is
Type_Tree : Boolean)
is
type String_Access is access String;
- procedure Free is new Unchecked_Deallocation (String, String_Access);
+ procedure Free is new Ada.Unchecked_Deallocation (String, String_Access);
ALIfile : ALI_File;
File_Ref : File_Reference;