https://gcc.gnu.org/g:1190b1df3c15877c698bad12d5c3ad965250df90

commit r17-790-g1190b1df3c15877c698bad12d5c3ad965250df90
Author: Piotr Trojanek <[email protected]>
Date:   Sat Jan 31 12:22:34 2026 +0100

    ada: Remove Tempdir package
    
    Package Tempdir is no longer needed; its uses have been replaced by an
    equivalent routine in System.OS_Lib that does not rely on Name_Id, which is 
an
    internal compiler data type.
    The Tempdir package is no longer used by gnatmake.
    
    gcc/ada/ChangeLog:
    
            * tempdir.ads, tempdir.adb: Remove.
            * gcc-interface/Makefile.in (GNATMAKE_OBJS): Remove dependency on 
Tempdir.

Diff:
---
 gcc/ada/gcc-interface/Makefile.in |   2 +-
 gcc/ada/tempdir.adb               | 141 --------------------------------------
 gcc/ada/tempdir.ads               |  53 --------------
 3 files changed, 1 insertion(+), 195 deletions(-)

diff --git a/gcc/ada/gcc-interface/Makefile.in 
b/gcc/ada/gcc-interface/Makefile.in
index acd34e0de8f2..e0614f77e52d 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -332,7 +332,7 @@ GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o 
s-casuti.o alloc.o \
  s-secsta.o s-stalib.o s-stoele.o scans.o scng.o sdefault.o sfn_scan.o \
  s-purexc.o s-htable.o scil_ll.o sem_aux.o sinfo.o sinput.o sinput-c.o \
  snames.o stand.o stringt.o styleg.o stylesw.o system.o validsw.o \
- switch.o switch-m.o table.o targparm.o tempdir.o types.o uintp.o \
+ switch.o switch-m.o table.o targparm.o types.o uintp.o \
  uname.o urealp.o usage.o widechar.o warnsw.o \
  seinfo.o einfo-entities.o einfo-utils.o sinfo-nodes.o sinfo-utils.o \
  errid.o \
diff --git a/gcc/ada/tempdir.adb b/gcc/ada/tempdir.adb
deleted file mode 100644
index 7d5be30b7758..000000000000
--- a/gcc/ada/tempdir.adb
+++ /dev/null
@@ -1,141 +0,0 @@
-------------------------------------------------------------------------------
---                                                                          --
---                         GNAT COMPILER COMPONENTS                         --
---                                                                          --
---                              T E M P D I R                               --
---                                                                          --
---                                 B o d y                                  --
---                                                                          --
---          Copyright (C) 2003-2026, Free Software Foundation, Inc.         --
---                                                                          --
--- GNAT is free software;  you can  redistribute it  and/or modify it under --
--- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 3,  or (at your option) any later ver- --
--- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
--- http://www.gnu.org/licenses for a complete copy of the license.          --
---                                                                          --
--- GNAT was originally developed  by the GNAT team at  New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc.      --
---                                                                          --
-------------------------------------------------------------------------------
-
-with GNAT.Directory_Operations; use GNAT.Directory_Operations;
-
-with Opt;      use Opt;
-with Output;   use Output;
-
-package body Tempdir is
-
-   Tmpdir_Needs_To_Be_Displayed : Boolean := True;
-
-   Tmpdir   : constant String := "TMPDIR";
-   Temp_Dir : String_Access   := new String'("");
-
-   ----------------------
-   -- Create_Temp_File --
-   ----------------------
-
-   procedure Create_Temp_File
-     (FD   : out File_Descriptor;
-      Name : out Path_Name_Type)
-   is
-      File_Name   : String_Access;
-      Current_Dir : constant String := Get_Current_Dir;
-
-      function Directory return String;
-      --  Returns Temp_Dir.all if not empty, else return current directory
-
-      ---------------
-      -- Directory --
-      ---------------
-
-      function Directory return String is
-      begin
-         if Temp_Dir'Length /= 0 then
-            return Temp_Dir.all;
-         else
-            return Current_Dir;
-         end if;
-      end Directory;
-
-   --  Start of processing for Create_Temp_File
-
-   begin
-      if Temp_Dir'Length /= 0 then
-
-         --  In verbose mode, display once the value of TMPDIR, so that
-         --  if temp files cannot be created, it is easier to understand
-         --  where temp files are supposed to be created.
-
-         if Verbose_Mode and then Tmpdir_Needs_To_Be_Displayed then
-            Write_Str ("TMPDIR = """);
-            Write_Str (Temp_Dir.all);
-            Write_Line ("""");
-            Tmpdir_Needs_To_Be_Displayed := False;
-         end if;
-
-         --  Change directory to TMPDIR before creating the temp file,
-         --  then change back immediately to the previous directory.
-
-         Change_Dir (Temp_Dir.all);
-         Create_Temp_File (FD, File_Name);
-         Change_Dir (Current_Dir);
-
-      else
-         Create_Temp_File (FD, File_Name);
-      end if;
-
-      if FD = Invalid_FD then
-         Write_Line ("could not create temporary file in " & Directory);
-         Name := No_Path;
-
-      else
-         declare
-            Path_Name : constant String :=
-                          Normalize_Pathname
-                            (Directory & Directory_Separator & File_Name.all);
-         begin
-            Name_Len := Path_Name'Length;
-            Name_Buffer (1 .. Name_Len) := Path_Name;
-            Name := Name_Find;
-            Free (File_Name);
-         end;
-      end if;
-   end Create_Temp_File;
-
-   ------------------
-   -- Use_Temp_Dir --
-   ------------------
-
-   procedure Use_Temp_Dir (Status : Boolean) is
-      Dir : String_Access;
-
-   begin
-      if Status then
-         Dir := Getenv (Tmpdir);
-      end if;
-
-      Free (Temp_Dir);
-
-      if Dir /= null
-        and then Dir'Length > 0
-        and then Is_Absolute_Path (Dir.all)
-        and then Is_Directory (Dir.all)
-      then
-         Temp_Dir := new String'(Normalize_Pathname (Dir.all));
-      else
-         Temp_Dir := new String'("");
-      end if;
-
-      Free (Dir);
-   end Use_Temp_Dir;
-
---  Start of elaboration for package Tempdir
-
-begin
-   Use_Temp_Dir (Status => True);
-end Tempdir;
diff --git a/gcc/ada/tempdir.ads b/gcc/ada/tempdir.ads
deleted file mode 100644
index daca75d5978f..000000000000
--- a/gcc/ada/tempdir.ads
+++ /dev/null
@@ -1,53 +0,0 @@
-------------------------------------------------------------------------------
---                                                                          --
---                         GNAT COMPILER COMPONENTS                         --
---                                                                          --
---                              T E M P D I R                               --
---                                                                          --
---                                 S p e c                                  --
---                                                                          --
---          Copyright (C) 2003-2026, Free Software Foundation, Inc.         --
---                                                                          --
--- GNAT is free software;  you can  redistribute it  and/or modify it under --
--- terms of the  GNU General Public License as published  by the Free Soft- --
--- ware  Foundation;  either version 3,  or (at your option) any later ver- --
--- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
--- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
--- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
--- for  more details.  You should have  received  a copy of the GNU General --
--- Public License  distributed with GNAT; see file COPYING3.  If not, go to --
--- http://www.gnu.org/licenses for a complete copy of the license.          --
---                                                                          --
--- GNAT was originally developed  by the GNAT team at  New York University. --
--- Extensive contributions were provided by Ada Core Technologies Inc.      --
---                                                                          --
-------------------------------------------------------------------------------
-
---  This package is used by gnatmake and by the Project Manager to create
---  temporary files.  If environment variable TMPDIR is defined and
---  designates an absolute path, temporary files are create in this directory.
---  Otherwise, temporary files are created in the current working directory.
-
-with Namet; use Namet;
-
-with GNAT.OS_Lib; use GNAT.OS_Lib;
-
-package Tempdir is
-
-   procedure Create_Temp_File
-     (FD   : out File_Descriptor;
-      Name : out Path_Name_Type);
-   --  Create a temporary text file and return its file descriptor and
-   --  its path name as a Name_Id. If environment variable TMPDIR is defined
-   --  and its value is an absolute path, the temp file is created in the
-   --  directory designated by TMPDIR, otherwise, it is created in the current
-   --  directory. If temporary file cannot be created, FD gets the value
-   --  Invalid_FD and Name gets the value No_Name.
-
-   procedure Use_Temp_Dir (Status : Boolean);
-   --  Specify if the temp file should be created in the system temporary
-   --  directory as specified by the corresponding environment variables. If
-   --  Status is False, the temp files will be created into the current working
-   --  directory.
-
-end Tempdir;

Reply via email to