aboutsummaryrefslogtreecommitdiff
path: root/libcpp/directives.c
diff options
context:
space:
mode:
authorNathanael Nerode <neroden@gcc.gnu.org>2004-11-28 22:28:13 +0000
committerNathanael Nerode <neroden@gcc.gnu.org>2004-11-28 22:28:13 +0000
commit283038288ea4603511b9cc7088f2f1c38c9f3d54 (patch)
tree3a3b8763ec8b9788a57d6ba82b14ac6cdaf9d403 /libcpp/directives.c
parentb20e82291eef31ef415bb218c172519d59da16ac (diff)
downloadgcc-283038288ea4603511b9cc7088f2f1c38c9f3d54.zip
gcc-283038288ea4603511b9cc7088f2f1c38c9f3d54.tar.gz
gcc-283038288ea4603511b9cc7088f2f1c38c9f3d54.tar.bz2
re PR preprocessor/17610 (Empty #include statement halts gcc)
(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. From-SVN: r91428
Diffstat (limited to 'libcpp/directives.c')
-rw-r--r--libcpp/directives.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libcpp/directives.c b/libcpp/directives.c
index a835b68..fe1867d 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");