]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: [multiple changes]
authorRichard Guenther <rguenther@suse.de>
Tue, 19 Apr 2011 09:19:33 +0000 (09:19 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 19 Apr 2011 09:19:33 +0000 (09:19 +0000)
2011-04-19  Richard Guenther  <rguenther@suse.de>

Backported from 4.6 branch
2011-03-29  Jakub Jelinek  <jakub@redhat.com>

PR preprocessor/48248
* c-ppoutput.c (print): Add src_file field.
(init_pp_output): Initialize it.
(maybe_print_line): Don't optimize by adding up to 8 newlines
if map->to_file and print.src_file are different file.
(print_line): Update print.src_file.

2011-04-18  Richard Guenther  <rguenther@suse.de>

PR preprocessor/48248
* c-ppoutput.c (maybe_print_line): Avoid changing -P behavior.

From-SVN: r172703

gcc/ChangeLog
gcc/c-ppoutput.c

index 9bcbfcb8bc03f1b3b636e0af9ac835fe0bd07d35..5732e342ba59d892acfa923e335a7602b85d1531 100644 (file)
@@ -1,3 +1,20 @@
+2011-04-19  Richard Guenther  <rguenther@suse.de>
+
+       Backported from 4.6 branch
+       2011-03-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR preprocessor/48248
+       * c-ppoutput.c (print): Add src_file field.
+       (init_pp_output): Initialize it.
+       (maybe_print_line): Don't optimize by adding up to 8 newlines
+       if map->to_file and print.src_file are different file.
+       (print_line): Update print.src_file.
+
+       2011-04-18  Richard Guenther  <rguenther@suse.de>
+
+       PR preprocessor/48248
+       * c-ppoutput.c (maybe_print_line): Avoid changing -P behavior.
+
 2011-04-19  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/46188
index bd9af2aa0f6c9a1bd557863007b312806f8d098c..c72362cda658bb1ed4124065250e860ddcbbab5c 100644 (file)
@@ -37,6 +37,7 @@ static struct
   int src_line;                        /* Line number currently being written.  */
   unsigned char printed;       /* Nonzero if something output at line.  */
   bool first_time;             /* pp_file_change hasn't been called yet.  */
+  const char *src_file;                /* Current source file.  */
 } print;
 
 /* Defined and undefined macros being queued for output with -dU at
@@ -154,6 +155,7 @@ init_pp_output (FILE *out_stream)
   print.prev = 0;
   print.outf = out_stream;
   print.first_time = 1;
+  print.src_file = "";
 }
 
 /* Writes out the preprocessed file, handling spacing and paste
@@ -313,7 +315,9 @@ maybe_print_line (source_location src_loc)
       print.printed = 0;
     }
 
-  if (src_line >= print.src_line && src_line < print.src_line + 8)
+  if (src_line >= print.src_line
+      && src_line < print.src_line + 8
+      && (flag_no_line_commands || strcmp (map->to_file, print.src_file) == 0))
     {
       while (src_line > print.src_line)
        {
@@ -345,6 +349,7 @@ print_line (source_location src_loc, const char *special_flags)
       unsigned char *p;
 
       print.src_line = SOURCE_LINE (map, src_loc);
+      print.src_file = map->to_file;
 
       /* cpp_quote_string does not nul-terminate, so we have to do it
         ourselves.  */