Patch: fix PR preprocessor/37549

Tom Tromey tromey@redhat.com
Wed Apr 1 01:18:00 GMT 2009


This patch fixes PR preprocessor/37549.

The bug is that -dD prints all macro definitions, even though it is
documented as skipping built-in macros.

This patch fixes the problem by checking the defining line, and
skipping the printing if it is a built-in.

Bootstrapped and regtested on x86-64 (compile farm).
Ok?

Tom

2009-03-31  Tom Tromey  <tromey@redhat.com>

	PR preprocessor/37549:
	* c-ppoutput.c (cb_define): Skip built-in defines.
	(cb_undef): Likewise.

Index: c-ppoutput.c
===================================================================
--- c-ppoutput.c	(revision 145295)
+++ c-ppoutput.c	(working copy)
@@ -377,6 +377,8 @@
 static void
 cb_define (cpp_reader *pfile, source_location line, cpp_hashnode *node)
 {
+  if (line <= BUILTINS_LOCATION)
+    return;
   maybe_print_line (line);
   fputs ("#define ", print.outf);
 
@@ -396,6 +398,8 @@
 cb_undef (cpp_reader *pfile ATTRIBUTE_UNUSED, source_location line,
 	  cpp_hashnode *node)
 {
+  if (line <= BUILTINS_LOCATION)
+    return;
   maybe_print_line (line);
   fprintf (print.outf, "#undef %s\n", NODE_NAME (node));
   print.src_line++;



More information about the Gcc-patches mailing list