From: Nathanael Nerode Date: Thu, 2 Dec 2004 02:32:21 +0000 (+0000) Subject: re PR preprocessor/17651 (Erroneous preprocessor output with -g when generating depen... X-Git-Tag: releases/gcc-3.4.4~465 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03498da4cab1c517ca10d118cde7547ba8ed4312;p=thirdparty%2Fgcc.git re PR preprocessor/17651 (Erroneous preprocessor output with -g when generating dependencies) 2004-12-01 Nathanael Nerode PR preprocessor/17651 * c-opts.c (sanitize_cpp_opts): Make flag_no_output imply flag_no_line_commands. * c-ppoutput.c (pp_file_change): Remove now-redundant check of flag_no_output. PR preprocessor/17610 * directives.c (do_include_common): Error out if an empty filename is given for #include (or #include_next or #import). PR preprocessor/17610 * testsuite/gcc.dg/cpp/empty-include.c: New testcase. From-SVN: r91607 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a00324723f74..706c50228741 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2004-12-01 Nathanael Nerode + + PR preprocessor/17651 + * c-opts.c (sanitize_cpp_opts): Make flag_no_output imply + flag_no_line_commands. + * c-ppoutput.c (pp_file_change): Remove now-redundant check of + flag_no_output. + + PR preprocessor/17610 + * directives.c (do_include_common): Error out if an empty filename + is given for #include (or #include_next or #import). + PR preprocessor/17610 + * testsuite/gcc.dg/cpp/empty-include.c: New testcase. + 2004-12-02 Alan Modra PR target/16952 diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 5a351d9e7087..b7da95f6290f 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -1358,11 +1358,13 @@ sanitize_cpp_opts (void) /* Disable -dD, -dN and -dI if normal output is suppressed. Allow -dM since at least glibc relies on -M -dM to work. */ + /* Also, flag_no_output implies flag_no_line_commands, always. */ if (flag_no_output) { if (flag_dump_macros != 'M') flag_dump_macros = 0; flag_dump_includes = 0; + flag_no_line_commands = 1; } cpp_opts->unsigned_char = !flag_signed_char; diff --git a/gcc/c-ppoutput.c b/gcc/c-ppoutput.c index 5588da3d863d..8162ccba26b3 100644 --- a/gcc/c-ppoutput.c +++ b/gcc/c-ppoutput.c @@ -359,7 +359,7 @@ pp_file_change (const struct line_map *map) { const char *flags = ""; - if (flag_no_line_commands || flag_no_output) + if (flag_no_line_commands) return; if (map != NULL) diff --git a/gcc/cpplib.c b/gcc/cpplib.c index 60a86e3e3988..298f5e6618b5 100644 --- a/gcc/cpplib.c +++ b/gcc/cpplib.c @@ -680,6 +680,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_maps.depth >= CPP_STACK_MAX) cpp_error (pfile, CPP_DL_ERROR, "#include nested too deeply");