From 70c11f434b7c68fc3f66e8e96b86ec5f687089d9 Mon Sep 17 00:00:00 2001 From: charlet Date: Thu, 11 Apr 2013 09:41:26 +0000 Subject: 2013-04-11 Tristan Gingold * gnat_rm.texi: Add Detect_BLocking in the ravenscar profile pragma list. 2013-04-11 Vincent Celier * 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 --- gcc/ada/ChangeLog | 13 +++++++++++++ gcc/ada/gnat_rm.texi | 8 ++++---- gcc/ada/gnatname.adb | 8 +++++++- gcc/ada/opt.ads | 10 ++++++---- gcc/ada/prj-makr.adb | 36 +++++++++++++++++++++++++++++++++++- 5 files changed, 65 insertions(+), 10 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7eb5af25690..386ce233483 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2013-04-11 Tristan Gingold + + * gnat_rm.texi: Add Detect_BLocking in the ravenscar profile + pragma list. + +2013-04-11 Vincent Celier + + * 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. + 2013-04-11 Thomas Quinot * exp_ch4.adb: Minor code improvement: replace various calls to diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index 3ef8a524544..75d83de69d3 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -4857,10 +4857,10 @@ priority-ordered scheduling policy. @item Locking_Policy (Ceiling_Locking) [RM D.3] While tasks and interrupts execute a protected action, they inherit the ceiling priority of the corresponding protected object. -@c -@c @item Detect_Blocking -@c This pragma forces the detection of potentially blocking operations within a -@c protected operation, and to raise Program_Error if that happens. + +@item Detect_Blocking +This pragma forces the detection of potentially blocking operations within a +protected operation, and to raise Program_Error if that happens. @end table @noindent diff --git a/gcc/ada/gnatname.adb b/gcc/ada/gnatname.adb index 68375ef21db..3c687315e53 100644 --- a/gcc/ada/gnatname.adb +++ b/gcc/ada/gnatname.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- -- @@ -346,6 +346,11 @@ procedure Gnatname is 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 @@ procedure Gnatname is 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"); diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index 9beeb583523..8f60b71f895 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -119,14 +119,11 @@ package Opt is -- 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 @@ package Opt is -- 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 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, -- cgit v1.2.1