gcc/ada/
authorsam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Dec 2007 18:03:20 +0000 (18:03 +0000)
committersam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 7 Dec 2007 18:03:20 +0000 (18:03 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130692 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/a-direct.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/compose.adb [new file with mode: 0644]

index 0b1afbc..49f226f 100644 (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
index 1d7ea55..52ad1b3 100644 (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;
index 1b0fbbd..62a7a15 100644 (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
diff --git a/gcc/testsuite/gnat.dg/compose.adb b/gcc/testsuite/gnat.dg/compose.adb
new file mode 100644 (file)
index 0000000..4ee3c57
--- /dev/null
@@ -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;