summaryrefslogtreecommitdiff
path: root/gcc/ada/prj-makr.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-11 09:41:26 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-11 09:41:26 +0000
commit70c11f434b7c68fc3f66e8e96b86ec5f687089d9 (patch)
tree9371da8d3e853d2c17232aaf57915baeadc4368e /gcc/ada/prj-makr.adb
parentc0d1b9fdc38958b49f3a065e75d89130ba248666 (diff)
downloadgcc-70c11f434b7c68fc3f66e8e96b86ec5f687089d9.tar.gz
2013-04-11 Tristan Gingold <gingold@adacore.com>
* gnat_rm.texi: Add Detect_BLocking in the ravenscar profile pragma list. 2013-04-11 Vincent Celier <celier@adacore.com> * gnatname.adb (Scan_Args): Recognize new switch --no-backup (Usage): Add line for --no-backup. * opt.ads (No_Nackup): New Boolean variable, initialized to False. * prj-makr.adb (Initialize): Create a backup for an existing project file if gnatname is not invoked with --no-backup. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197750 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/prj-makr.adb')
-rw-r--r--gcc/ada/prj-makr.adb36
1 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ada/prj-makr.adb b/gcc/ada/prj-makr.adb
index e2b1ad1d9fd..56ca6a69c0a 100644
--- a/gcc/ada/prj-makr.adb
+++ b/gcc/ada/prj-makr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2012, Free Software Foundation, Inc. --
+-- 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 @@ package body Prj.Makr is
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,