summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorneroden <neroden@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-28 22:28:13 +0000
committerneroden <neroden@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-28 22:28:13 +0000
commitbd9e37a64ba5d9cd9da75ae78410cd02ad30cea5 (patch)
tree3a3b8763ec8b9788a57d6ba82b14ac6cdaf9d403 /libcpp
parent9b30659771564be3d875f4b17e115939d29ad349 (diff)
downloadgcc-bd9e37a64ba5d9cd9da75ae78410cd02ad30cea5.tar.gz
(libcpp)
PR preprocessor/17610 * directives.c (do_include_common): Error out if an empty filename is given for #include (or #include_next or #import). (gcc) PR preprocessor/17610 * testsuite/gcc.dg/cpp/empty-include.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91428 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog6
-rw-r--r--libcpp/directives.c8
2 files changed, 14 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 2b709b418a2..3b01f82668f 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,9 @@
+2004-11-28 Nathanael Nerode <neroden@gcc.gnu.org>
+
+ PR preprocessor/17610
+ * directives.c (do_include_common): Error out if an empty filename
+ is given for #include (or #include_next or #import).
+
2004-11-27 Roger Sayle <roger@eyesopen.com>
Zack Weinberg <zack@codesourcery.com>
diff --git a/libcpp/directives.c b/libcpp/directives.c
index a835b6812a5..fe1867d569a 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -668,6 +668,14 @@ do_include_common (cpp_reader *pfile, enum include_type type)
if (!fname)
return;
+ if (!*fname)
+ {
+ cpp_error (pfile, CPP_DL_ERROR, "empty filename in #%s",
+ pfile->directive->name);
+ free ((void *) fname);
+ return;
+ }
+
/* Prevent #include recursion. */
if (pfile->line_table->depth >= CPP_STACK_MAX)
cpp_error (pfile, CPP_DL_ERROR, "#include nested too deeply");