===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 2001-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- --
@@ -24,6 +24,7 @@
------------------------------------------------------------------------------
with Csets;
+with Hostparm;
with Opt;
with Output;
with Osint; use Osint;
@@ -1047,6 +1048,39 @@
Project_File_Extension;
Output_Name_Last := Output_Name_Last + Project_File_Extension'Length;
+ -- Back up project file if it already exists
+
+ if not Hostparm.OpenVMS
+ and then not Opt.No_Backup
+ and then
+ Is_Regular_File (Path_Name (1 .. Path_Last))
+ then
+ declare
+ Discard : Boolean;
+ Saved_Path : constant String :=
+ Path_Name (1 .. Path_Last) & ".saved_";
+ Nmb : Natural := 0;
+ begin
+ loop
+ declare
+ Img : constant String := Nmb'Img;
+ begin
+ if not Is_Regular_File
+ (Saved_Path & Img (2 .. Img'Last))
+ then
+ Copy_File
+ (Name => Path_Name (1 .. Path_Last),
+ Pathname => Saved_Path & Img (2 .. Img'Last),
+ Mode => Overwrite,
+ Success => Discard);
+ exit;
+ end if;
+
+ Nmb := Nmb + 1;
+ end;
+ end loop;
+ end;
+ end if;
end if;
-- Change the current directory to the directory of the project file,
===================================================================
@@ -119,14 +119,11 @@
-- Think twice before using "="; Ada_Version >= Ada_2012 is more likely
-- what you want, because it will apply to future versions of the language.
- Ada_Version_Default : constant Ada_Version_Type := Ada_2005;
+ Ada_Version_Default : constant Ada_Version_Type := Ada_2012;
pragma Warnings (Off, Ada_Version_Default);
-- GNAT
-- Default Ada version if no switch given. The Warnings off is to kill
-- constant condition warnings.
- --
- -- WARNING: some scripts rely on the format of this line of code. Any
- -- change must be coordinated with the scripts requirements.
Ada_Version : Ada_Version_Type := Ada_Version_Default;
-- GNAT
@@ -986,6 +983,11 @@
-- in this variable (e.g. 2 = select second unit in file). A value of
-- zero indicates that we are in normal (one unit per file) mode.
+ No_Backup : Boolean := False;
+ -- GNATNAME
+ -- Set by switch --no-backup.
+ -- Do not create backup copies of project files.
+
No_Deletion : Boolean := False;
-- GNATPREP
-- Set by preprocessor switch -a. Do not eliminate any source text. Implies
===================================================================
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
+-- Copyright (C) 2001-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- --
@@ -346,6 +346,11 @@
Subdirs :=
new String'(Arg (Subdirs_Switch'Length + 1 .. Arg'Last));
+ -- --no-backup
+
+ elsif Arg = "--no-backup" then
+ Opt.No_Backup := True;
+
-- -c
elsif Arg'Length >= 2 and then Arg (1 .. 2) = "-c" then
@@ -515,6 +520,7 @@
Display_Usage_Version_And_Help;
Write_Line (" --subdirs=dir real obj/lib/exec dirs are subdirs");
+ Write_Line (" --no-backup do not create backup of project file");
Write_Eol;
Write_Line (" --and use different patterns");