[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 29 Jan 2013 14:37:47 +0000 (15:37 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 29 Jan 2013 14:37:47 +0000 (15:37 +0100)
2013-01-29  Ben Brosgol  <brosgol@adacore.com>

* gnat_rm.texi: Fixed typos. Minor edits.

2013-01-29  Bob Duff  <duff@adacore.com>

* a-convec.adb: Minor reformatting.

2013-01-29  Pascal Obry  <obry@adacore.com>

* tempdir.adb, tempdir.ads (Use_Temp_Dir): Set wether to use the temp
directory.

From-SVN: r195548

gcc/ada/ChangeLog
gcc/ada/a-convec.adb
gcc/ada/gnat_rm.texi
gcc/ada/tempdir.adb
gcc/ada/tempdir.ads

index 73ddbfb..ec58e95 100644 (file)
@@ -1,3 +1,16 @@
+2013-01-29  Ben Brosgol  <brosgol@adacore.com>
+
+       * gnat_rm.texi: Fixed typos. Minor edits.
+
+2013-01-29  Bob Duff  <duff@adacore.com>
+
+       * a-convec.adb: Minor reformatting.
+
+2013-01-29  Pascal Obry  <obry@adacore.com>
+
+       * tempdir.adb, tempdir.ads (Use_Temp_Dir): Set wether to use the temp
+       directory.
+
 2013-01-29  Ed Schonberg  <schonberg@adacore.com>
 
        * exp_ch5.adb (Expand_Iterator_Loop_Over_Array): Preserve loop
index 6282301..a67c156 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2004-2012, Free Software Foundation, Inc.         --
+--          Copyright (C) 2004-2013, 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- --
@@ -582,8 +582,8 @@ package body Ada.Containers.Vectors is
          C := Capacity;
 
       else
-         raise Capacity_Error
-           with "Requested capacity is less than Source length";
+         raise Capacity_Error with
+           "Requested capacity is less than Source length";
       end if;
 
       return Target : Vector do
index 15d1901..bdad3f6 100644 (file)
@@ -2893,7 +2893,7 @@ implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any
 This is an Ada 2012 representation pragma which applies to protected, task
 and synchronized interface primitives. The use of pragma Implemented provides
 a way to impose a static requirement on the overriding operation by adhering
-to one of the three implementation kids: entry, protected procedure or any of
+to one of the three implementation kinds: entry, protected procedure or any of
 the above. This pragma is available in all earlier versions of Ada as an
 implementation-defined pragma.
 
@@ -3237,7 +3237,7 @@ of the same name). It is also available as an implementation-defined
 pragma in all earlier versions. It specifies that the
 designated object or all objects of the designated type must be
 independently addressable. This means that separate tasks can safely
-manipulate such objects. For example, if two comonents of a record are
+manipulate such objects. For example, if two components of a record are
 independent, then two separate tasks may access these two components.
 This may place
 constraints on the representation of the object (for instance prohibiting
@@ -3257,9 +3257,10 @@ pragma Independent_Components (Local_NAME);
 This pragma is standard in Ada 2012 mode (which also provides an aspect
 of the same name). It is also available as an implementation-defined
 pragma in all earlier versions. It specifies that the components of the
-designated object or all objects of the designated type must be
+designated object, or the components of each object of the designated
+type, must be
 independently addressable. This means that separate tasks can safely
-manipulate separate components in the composite object. this may place
+manipulate separate components in the composite object. This may place
 constraints on the representation of the object (for instance prohibiting
 tight packing).
 
index b443307..7da1ef2 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2003-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-2013, 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- --
@@ -35,8 +35,7 @@ package body Tempdir is
 
    Tmpdir    : constant String := "TMPDIR";
    Gnutmpdir : constant String := "GNUTMPDIR";
-   No_Dir    : aliased String  := "";
-   Temp_Dir  : String_Access   := No_Dir'Access;
+   Temp_Dir  : String_Access   := new String'("");
 
    ----------------------
    -- Create_Temp_File --
@@ -46,7 +45,7 @@ package body Tempdir is
      (FD   : out File_Descriptor;
       Name : out Path_Name_Type)
    is
-      File_Name : String_Access;
+      File_Name   : String_Access;
       Current_Dir : constant String := Get_Current_Dir;
 
       function Directory return String;
@@ -60,7 +59,6 @@ package body Tempdir is
       begin
          if Temp_Dir'Length /= 0 then
             return Temp_Dir.all;
-
          else
             return Current_Dir;
          end if;
@@ -102,7 +100,6 @@ package body Tempdir is
             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;
@@ -112,35 +109,49 @@ package body Tempdir is
       end if;
    end Create_Temp_File;
 
---  Start of elaboration for package Tempdir
+   ------------------
+   -- Use_Temp_Dir --
+   ------------------
 
-begin
-   declare
+   procedure Use_Temp_Dir (Status : Boolean) is
       Dir : String_Access;
 
    begin
-      --  On VMS, if GNUTMPDIR is defined, use it
+      if Status then
 
-      if OpenVMS then
-         Dir := Getenv (Gnutmpdir);
+         --  On VMS, if GNUTMPDIR is defined, use it
 
-         --  Otherwise, if GNUTMPDIR is not defined, try TMPDIR
+         if OpenVMS then
+            Dir := Getenv (Gnutmpdir);
 
-         if Dir'Length = 0 then
+            --  Otherwise, if GNUTMPDIR is not defined, try TMPDIR
+
+            if Dir'Length = 0 then
+               Dir := Getenv (Tmpdir);
+            end if;
+
+         else
             Dir := Getenv (Tmpdir);
          end if;
-
-      else
-         Dir := Getenv (Tmpdir);
       end if;
 
-      if Dir'Length > 0 and then
-        Is_Absolute_Path (Dir.all) and then
-        Is_Directory (Dir.all)
+      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;
+   end Use_Temp_Dir;
+
+--  Start of elaboration for package Tempdir
+
+begin
+   Use_Temp_Dir (Status => True);
 end Tempdir;
index 7ab1b5a..bf8ab26 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2003-2010, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-2013, 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- --
@@ -44,4 +44,10 @@ package Tempdir is
    --  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;