diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-02 17:35:25 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-08-02 17:35:25 +0200 |
commit | 316a0661918aacd3cc0acca417b5390ad1e3d535 (patch) | |
tree | 48433199b635c0174dbcc09d37dc391d03fde3a5 /gcc/ada/a-direct.adb | |
parent | 1e88210d7fff339ded2a3562b49498d835c8ecf8 (diff) | |
download | gcc-316a0661918aacd3cc0acca417b5390ad1e3d535.zip gcc-316a0661918aacd3cc0acca417b5390ad1e3d535.tar.gz gcc-316a0661918aacd3cc0acca417b5390ad1e3d535.tar.bz2 |
[multiple changes]
2011-08-02 Yannick Moy <moy@adacore.com>
* sem_ch3.adb, sem_ch5.adb, sem_ch9.adb, sem_prag.adb, sem.ads,
sem_util.adb, sem_util.ads, sem_res.adb, sem_ch2.adb, sem_ch4.adb,
sem_ch6.adb, sem_ch11.adb: Add semantic flag In_Pre_Post_Expression to
indicate that we are in a precondition or postcondition. This is used in
Mark_Non_ALFA_Subprogram (renaming of Mark_Non_ALFA_Subprogram_Body) to
decide whether to flag the spec or body of the current subprogram as
not in ALFA.
2011-08-02 Fabien Chouteau <chouteau@adacore.com>
* impunit.adb: Add Ada.Execution_Time.Interrupts in the Ada2012 package
list.
* a-extiin.ads: New file.
2011-08-02 Bob Duff <duff@adacore.com>
* a-direct.adb (Rename): Implement AI05-0231-1. In particular, Rename
now raises Name_Error instead of Use_Error in certain cases. The other
parts of this AI were already implemented properly.
From-SVN: r177187
Diffstat (limited to 'gcc/ada/a-direct.adb')
-rw-r--r-- | gcc/ada/a-direct.adb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/ada/a-direct.adb b/gcc/ada/a-direct.adb index e4a2697..81b8dd5 100644 --- a/gcc/ada/a-direct.adb +++ b/gcc/ada/a-direct.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2004-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 2004-2011, 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- -- @@ -40,6 +40,7 @@ with Ada.Unchecked_Deallocation; with Ada.Characters.Handling; use Ada.Characters.Handling; with System.CRTL; use System.CRTL; +with System.OS_Constants; with System.OS_Lib; use System.OS_Lib; with System.Regexp; use System.Regexp; with System.File_IO; use System.File_IO; @@ -1060,8 +1061,20 @@ package body Ada.Directories is Rename_File (Old_Name, New_Name, Success); if not Success then - raise Use_Error with - "file """ & Old_Name & """ could not be renamed"; + -- AI05-0231-1: Name_Error should be raised in case a directory + -- component of New_Name does not exist (as in New_Name => + -- "/no-such-dir/new-filename"). ENOENT indicates that. ENOENT + -- also indicate that the Old_Name does not exist, but we already + -- checked for that above. All other errors are Use_Error. + + if Errno = System.OS_Constants.ENOENT then + raise Name_Error with + "file """ & Containing_Directory (New_Name) & """ not found"; + + else + raise Use_Error with + "file """ & Old_Name & """ could not be renamed"; + end if; end if; end if; end Rename; |