From 351e4c1ca1c13672cebed4b38df20c1f00969259 Mon Sep 17 00:00:00 2001 From: sam Date: Fri, 7 Dec 2007 18:03:20 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130692 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 3 +++ gcc/ada/a-direct.adb | 6 ++++-- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gnat.dg/compose.adb | 11 +++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/compose.adb diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 0b1afbc..49f226f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -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 PR ada/34173 diff --git a/gcc/ada/a-direct.adb b/gcc/ada/a-direct.adb index 1d7ea55..52ad1b3 100644 --- a/gcc/ada/a-direct.adb +++ b/gcc/ada/a-direct.adb @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1b0fbbd..62a7a15 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 PR ada/34173 diff --git a/gcc/testsuite/gnat.dg/compose.adb b/gcc/testsuite/gnat.dg/compose.adb new file mode 100644 index 0000000..4ee3c57 --- /dev/null +++ b/gcc/testsuite/gnat.dg/compose.adb @@ -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; -- 2.7.4