re PR ada/21346 (Ada.Directories.Compose raises exception if Containing_Directory is empty string)

gcc/ada/
	PR ada/21346
	* a-direct.adb (Compose): Containing_Directory can be an empty string.

    gcc/testsuite/
	PR ada/21346
	* gnat.dg/compose.adb: New test.

From-SVN: r130692
This commit is contained in:
Samuel Tardieu 2007-12-07 18:03:20 +00:00 committed by Samuel Tardieu
parent 63396805ab
commit 72f69ddf21
4 changed files with 21 additions and 2 deletions

View File

@ -14,6 +14,9 @@
when an access to constant is used to initialize an access
value.
PR ada/21346
* a-direct.adb (Compose): Containing_Directory can be an empty string.
2007-12-07 Olivier Hainque <hainque@adacore.com>
PR ada/34173

View File

@ -155,7 +155,9 @@ package body Ada.Directories is
begin
-- First, deal with the invalid cases
if not Is_Valid_Path_Name (Containing_Directory) then
if Containing_Directory /= ""
and then not Is_Valid_Path_Name (Containing_Directory)
then
raise Name_Error;
elsif
@ -176,7 +178,7 @@ package body Ada.Directories is
-- Add a directory separator if needed
if Result (Last) /= Dir_Separator then
if Last /= 0 and then Result (Last) /= Dir_Separator then
Last := Last + 1;
Result (Last) := Dir_Separator;
end if;

View File

@ -15,6 +15,9 @@
* gnat.dg/specs/access_constant_decl.ads: New test.
PR ada/21346
* gnat.dg/compose.adb: New test.
2007-12-07 Olivier Hainque <hainque@adacore.com>
PR ada/34173

View File

@ -0,0 +1,11 @@
-- { dg-do run }
with Ada.Directories;
with Ada.Text_IO;
procedure Compose is
Result : constant String := Ada.Directories.Compose (Name => "foo",
Extension => "txt");
pragma Unreferenced (Result);
begin
null;
end Compose;