summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-04 15:10:46 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-03-04 15:10:46 +0000
commit4c6a645c993fd052b6ae0591b054fbe66016bf34 (patch)
treef4993d16ae6e55eb95f7863e140de35acfa9f472
parent4b0c16ee1c6fd58b8c303521b7b867ca61961ad1 (diff)
downloadgcc-4c6a645c993fd052b6ae0591b054fbe66016bf34.tar.gz
* cppfiles.c (search_from): Special case the empty string.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40236 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/cppfiles.c6
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7a1772bb87e..029af4bc803 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2001-03-04 Neil Booth <neil@daikokuya.demon.co.uk>
+ * cppfiles.c (search_from): Special case the empty string.
+
+2001-03-04 Neil Booth <neil@daikokuya.demon.co.uk>
+
* cppfiles.c (_cpp_execute_include): Don't make a null-terminated
copy of the filename. Don't use CPP_PREV_BUFFER. Don't call
strlen or strcpy; we already know the length.
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index 0dfd9d0db66..7f15a8d24ca 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -804,7 +804,11 @@ search_from (pfile, inc)
if (CPP_OPTION (pfile, ignore_srcdir))
return CPP_OPTION (pfile, quote_include);
- dlen = basename (inc->name) - inc->name;
+ /* basename () on Solaris returns "." for an empty string. */
+ dlen = 0;
+ if (inc->name[0] != '\0')
+ dlen = basename (inc->name) - inc->name;
+
if (dlen)
{
/* We don't guarantee NAME is null-terminated. This saves