]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR preprocessor/17651 (Erroneous preprocessor output with -g when generating depen...
authorNathanael Nerode <neroden@gcc.gnu.org>
Thu, 2 Dec 2004 02:32:21 +0000 (02:32 +0000)
committerNathanael Nerode <neroden@gcc.gnu.org>
Thu, 2 Dec 2004 02:32:21 +0000 (02:32 +0000)
2004-12-01  Nathanael Nerode  <neroden@gcc.gnu.org>

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

gcc/ChangeLog
gcc/c-opts.c
gcc/c-ppoutput.c
gcc/cpplib.c

index a00324723f7483e91c8173ed095bcebbfb5d2c94..706c50228741154a9e6824df0dd39f885d426b20 100644 (file)
@@ -1,3 +1,17 @@
+2004-12-01  Nathanael Nerode  <neroden@gcc.gnu.org>
+
+       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  <amodra@bigpond.net.au>
 
        PR target/16952
index 5a351d9e7087cd6690e215d4d958ea1f06f39be4..b7da95f6290fa1f37397eead5681ef7bd55fe13d 100644 (file)
@@ -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;
index 5588da3d863dbaab37b929722c48a99a25030e1a..8162ccba26b38b538800dfcfaf37e52f9bb0f1e7 100644 (file)
@@ -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)
index 60a86e3e398837ba40b4b2161f7c15b7b37f73ff..298f5e6618b5c6c094c4d88428a5369e7c6f9f86 100644 (file)
@@ -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");