Patchwork Avoid regressing with the PR48248 change

login
register
mail settings
Submitter Richard Guenther
Date April 18, 2011, 1:22 p.m.
Message ID <alpine.LNX.2.00.1104181517520.810@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/91738/
State New
Headers show

Comments

Richard Guenther - April 18, 2011, 1:22 p.m.
This avoids changing -P output with the PR48248 fix which appearantly
breaks Chrome (with has bogus assumptions on gcc -E -P output).

For 4.7 I think we should instead go with the 2nd patch and make -P
output smaller (which is the whole reason for this code path).

Thus, first patch is for the 4.6 and 4.5 branches and the second for
the trunk.

Sofar I bootstrapped and tested the first on the 4.6 branch.

Ok for both variants after testing completed?

Thanks,
Richard.

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

	PR preprocessor/48248
	* c-ppoutput.c (maybe_print_line): Avoid changing -P behavior.
Joseph S. Myers - April 21, 2011, 7:28 p.m.
On Mon, 18 Apr 2011, Richard Guenther wrote:

> This avoids changing -P output with the PR48248 fix which appearantly
> breaks Chrome (with has bogus assumptions on gcc -E -P output).
> 
> For 4.7 I think we should instead go with the 2nd patch and make -P
> output smaller (which is the whole reason for this code path).
> 
> Thus, first patch is for the 4.6 and 4.5 branches and the second for
> the trunk.
> 
> Sofar I bootstrapped and tested the first on the 4.6 branch.
> 
> Ok for both variants after testing completed?

OK.

Patch

Index: gcc/c-family/c-ppoutput.c
===================================================================
--- gcc/c-family/c-ppoutput.c	(revision 172641)
+++ gcc/c-family/c-ppoutput.c	(working copy)
@@ -316,7 +316,7 @@  maybe_print_line (source_location src_lo
 
   if (src_line >= print.src_line
       && src_line < print.src_line + 8
-      && strcmp (map->to_file, print.src_file) == 0)
+      && (flag_no_line_commands || strcmp (map->to_file, print.src_file) == 0))
     {
       while (src_line > print.src_line)
 	{


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

	* c-ppoutput.c (maybe_print_line): Do not preserve up to 7
	empty lines with -P.

Index: c-family/c-ppoutput.c
===================================================================
--- c-family/c-ppoutput.c	(revision 172644)
+++ c-family/c-ppoutput.c	(working copy)
@@ -314,7 +314,8 @@  maybe_print_line (source_location src_lo
       print.printed = 0;
     }
 
-  if (src_line >= print.src_line
+  if (!flag_no_line_commands
+      && src_line >= print.src_line
       && src_line < print.src_line + 8
       && strcmp (map->to_file, print.src_file) == 0)
     {