summaryrefslogtreecommitdiff
path: root/gcc/ada/prj-conf.adb
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-18 13:02:54 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-18 13:02:54 +0000
commit244ef3a1eb438c2237d2c1c9f5c466ca06c39373 (patch)
tree981274e8fb747b0a0ce16fc6d5a7e302d64334dd /gcc/ada/prj-conf.adb
parent408a35ff7b0bb8f5e100ebd4b9564517aeb0c465 (diff)
downloadgcc-244ef3a1eb438c2237d2c1c9f5c466ca06c39373.tar.gz
2009-09-18 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 151837 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@151840 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/prj-conf.adb')
-rw-r--r--gcc/ada/prj-conf.adb49
1 files changed, 43 insertions, 6 deletions
diff --git a/gcc/ada/prj-conf.adb b/gcc/ada/prj-conf.adb
index 879178de122..bcf434b15e1 100644
--- a/gcc/ada/prj-conf.adb
+++ b/gcc/ada/prj-conf.adb
@@ -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;
@@ -697,6 +698,8 @@ package body Prj.Conf is
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
-- (-p) and directory does not exist, attempt to create it.
@@ -731,6 +734,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 +748,35 @@ 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;
@@ -783,9 +814,16 @@ package body Prj.Conf is
Write_Eol;
elsif not Quiet_Output then
- Write_Str ("creating ");
- Write_Str (Simple_Name (Args (3).all));
- Write_Eol;
+ -- Display no message if we are creating auto.cgpr, unless in
+ -- verbose mode
+
+ if Config_File_Name /= ""
+ or else Verbose_Mode
+ then
+ Write_Str ("creating ");
+ Write_Str (Simple_Name (Args (3).all));
+ Write_Eol;
+ end if;
end if;
Spawn (Gprconfig_Path.all, Args (1 .. Arg_Last) & Switches.all,
@@ -1000,7 +1038,6 @@ package body Prj.Conf is
begin
-- Parse the user project tree
- Prj.Tree.Initialize (Project_Node_Tree);
Prj.Initialize (Project_Tree);
Main_Project := No_Project;