[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 17 Sep 2009 10:50:49 +0000 (12:50 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 17 Sep 2009 10:50:49 +0000 (12:50 +0200)
2009-09-17  Emmanuel Briot  <briot@adacore.com>

* prj-conf.adb, prj-env.adb, prj-env.ads (Create_Temp_File): Moved to
spec.
(Do_Autoconf): If the object directory does not exists, create auto.cgpr
in a temporary directory instead

2009-09-17  Bob Duff  <duff@adacore.com>

* a-dynpri.adb (Set_Priority): Don't do anything if the task is already
terminated.
(Get_Priority): Correct message for "terminated" case -- it said "null".

2009-09-17  Robert Dewar  <dewar@adacore.com>

* exp_ch6.adb: Minor reformatting

From-SVN: r151795

gcc/ada/ChangeLog
gcc/ada/a-dynpri.adb
gcc/ada/exp_ch6.adb
gcc/ada/prj-conf.adb
gcc/ada/prj-env.adb
gcc/ada/prj-env.ads

index 92352f5..d058d97 100644 (file)
@@ -1,5 +1,22 @@
 2009-09-17  Emmanuel Briot  <briot@adacore.com>
 
+       * prj-conf.adb, prj-env.adb, prj-env.ads (Create_Temp_File): Moved to
+       spec.
+       (Do_Autoconf): If the object directory does not exists, create auto.cgpr
+       in a temporary directory instead
+
+2009-09-17  Bob Duff  <duff@adacore.com>
+
+       * a-dynpri.adb (Set_Priority): Don't do anything if the task is already
+       terminated.
+       (Get_Priority): Correct message for "terminated" case -- it said "null".
+
+2009-09-17  Robert Dewar  <dewar@adacore.com>
+
+       * exp_ch6.adb: Minor reformatting
+
+2009-09-17  Emmanuel Briot  <briot@adacore.com>
+
        * gnatcmd.adb, make.adb, prj-part.adb, prj-ext.adb, prj-ext.ads,
        switch-m.adb, switch-m.ads, clean.adb, prj-tree.ads
        (Project_Node_Tree_Data.Project_Path): New field.
index 3312217..9116a57 100644 (file)
@@ -67,7 +67,7 @@ package body Ada.Dynamic_Priorities is
       end if;
 
       if Task_Identification.Is_Terminated (T) then
-         raise Tasking_Error with Error_Message & "null task";
+         raise Tasking_Error with Error_Message & "terminated task";
       end if;
 
       return Target.Common.Base_Priority;
@@ -93,8 +93,12 @@ package body Ada.Dynamic_Priorities is
          raise Program_Error with Error_Message & "null task";
       end if;
 
+      --  Setting the priority of an already-terminated task doesn't do
+      --  anything (see RM-D.5.1(7)). Note that Get_Priority is different in
+      --  this regard.
+
       if Task_Identification.Is_Terminated (T) then
-         raise Tasking_Error with Error_Message & "terminated task";
+         return;
       end if;
 
       SSL.Abort_Defer.all;
index 238aad6..4a31187 100644 (file)
@@ -171,9 +171,9 @@ package body Exp_Ch6 is
    --
    --    A := TypeA (Temp);
    --
-   --  after the call. Here TypeA is the actual type of variable A.
-   --  For out parameters, the initial declaration has no expression.
-   --  If A is not an entity name, we generate instead:
+   --  after the call. Here TypeA is the actual type of variable A. For out
+   --  parameters, the initial declaration has no expression. If A is not an
+   --  entity name, we generate instead:
    --
    --    Var  : TypeA renames A;
    --    Temp : T := Var;       --  omitting expression for out parameter.
@@ -183,8 +183,8 @@ package body Exp_Ch6 is
    --  For other in-out parameters, we emit the required constraint checks
    --  before and/or after the call.
    --
-   --  For all parameter modes, actuals that denote components and slices
-   --  of packed arrays are expanded into suitable temporaries.
+   --  For all parameter modes, actuals that denote components and slices of
+   --  packed arrays are expanded into suitable temporaries.
    --
    --  For non-scalar objects that are possibly unaligned, add call by copy
    --  code (copy in for IN and IN OUT, copy out for OUT and IN OUT).
@@ -419,8 +419,8 @@ package body Exp_Ch6 is
 
       --  Create the actual which is a pointer to the appropriate finalization
       --  list. Acc_Type is present if and only if this call is the
-      --  initialization of an allocator. Use the Current_Scope or the Acc_Type
-      --  as appropriate.
+      --  initialization of an allocator. Use the Current_Scope or the
+      --  Acc_Type as appropriate.
 
       if Present (Acc_Type)
         and then (Ekind (Acc_Type) = E_Anonymous_Access_Type
index bb70e35..e1b365e 100644 (file)
@@ -29,6 +29,7 @@ with Makeutl;          use Makeutl;
 with MLib.Tgt;
 with Opt;              use Opt;
 with Output;           use Output;
+with Prj.Env;
 with Prj.Err;
 with Prj.Part;
 with Prj.PP;
@@ -696,6 +697,7 @@ package body Prj.Conf is
             Switches : Argument_List_Access := Get_Config_Switches;
             Args     : Argument_List (1 .. 5);
             Arg_Last : Positive;
+            Obj_Dir_Exists : Boolean := True;
 
          begin
             --  Check if the object directory exists. If Setup_Projects is True
@@ -731,6 +733,7 @@ package body Prj.Conf is
                      Prj.Err.Error_Msg
                        (Flags,
                         "?object directory " & Obj_Dir & " does not exist");
+                     Obj_Dir_Exists := False;
                   when Silent =>
                      null;
                end case;
@@ -744,8 +747,30 @@ package body Prj.Conf is
             --  If no config file was specified, set the auto.cgpr one
 
             if Config_File_Name = "" then
-               Args (3) := new String'
-                 (Obj_Dir & Directory_Separator & Auto_Cgpr);
+               if Obj_Dir_Exists then
+                  Args (3) := new String'
+                    (Obj_Dir & Directory_Separator & Auto_Cgpr);
+               else
+                  declare
+                     Path_FD : File_Descriptor;
+                     Path_Name : Path_Name_Type;
+                  begin
+                     Prj.Env.Create_Temp_File
+                       (In_Tree   => Project_Tree,
+                        Path_FD   => Path_FD,
+                        Path_Name => Path_Name,
+                        File_Use  => "configuration file");
+
+                     if Path_FD /= Invalid_FD then
+                        Args (3) := new String'(Get_Name_String (Path_Name));
+                        GNAT.OS_Lib.Close (Path_FD);
+                     else
+                        --  We'll have an error message later on
+                        Args (3) := new String'
+                          (Obj_Dir & Directory_Separator & Auto_Cgpr);
+                     end if;
+                  end;
+               end if;
             else
                Args (3) := new String'(Config_File_Name);
             end if;
index 0ffacdb..c5182ab 100644 (file)
@@ -97,14 +97,6 @@ package body Prj.Env is
    --  Return a project that is either Project or an extended ancestor of
    --  Project that itself is not extended.
 
-   procedure Create_Temp_File
-     (In_Tree   : Project_Tree_Ref;
-      Path_FD   : out File_Descriptor;
-      Path_Name : out Path_Name_Type;
-      File_Use  : String);
-   --  Create a temporary file, and fail with an error if it could not be
-   --  created.
-
    ----------------------
    -- Ada_Include_Path --
    ----------------------
index ffcea07..8cebad5 100644 (file)
@@ -39,6 +39,14 @@ package Prj.Env is
    --  of package Fmap), so that Osint.Find_File will find the correct path
    --  corresponding to a source.
 
+   procedure Create_Temp_File
+     (In_Tree   : Project_Tree_Ref;
+      Path_FD   : out File_Descriptor;
+      Path_Name : out Path_Name_Type;
+      File_Use  : String);
+   --  Create a temporary file, and fail with an error if it could not be
+   --  created.
+
    procedure Create_Mapping_File
      (Project  : Project_Id;
       Language : Name_Id;