mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-19 17:04:42 +08:00
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
This commit is contained in:
parent
b20e82291e
commit
283038288e
@ -1,3 +1,8 @@
|
||||
2004-11-28 Nathanael Nerode <neroden@gcc.gnu.org>
|
||||
|
||||
PR preprocessor/17610
|
||||
* testsuite/gcc.dg/cpp/empty-include.c: New testcase.
|
||||
|
||||
2004-11-28 Jeff Law <law@redhat.com>
|
||||
|
||||
* tree-ssa-alias.c (count_calls_and_maybe_create_global_var): New.
|
||||
|
13
gcc/testsuite/gcc.dg/cpp/empty-include.c
Normal file
13
gcc/testsuite/gcc.dg/cpp/empty-include.c
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2004 Free Software Foundation, Inc.
|
||||
* Contributed and written by Nathanael Nerode.
|
||||
*
|
||||
* GCC 3.4 would attempt to open stdin as the included file
|
||||
* (PR 17610), causing a sort of hang.
|
||||
*
|
||||
* We should get an error.
|
||||
*/
|
||||
|
||||
/* {dg-do preprocess} */
|
||||
#include "" /* { dg-error "empty" "error on empty filename in include" } */
|
||||
int x; /* Otherwise we have an empty file and get more errors. */
|
@ -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>
|
||||
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user