This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: fix PR preprocessor/37549
- From: Tom Tromey <tromey at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 31 Mar 2009 19:18:18 -0600
- Subject: Patch: fix PR preprocessor/37549
- Reply-to: Tom Tromey <tromey at redhat dot com>
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++;