public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pph] Front-end builtin macros (issue4575055)
@ 2011-06-08 22:22 Lawrence Crowl
  2011-06-08 23:04 ` Diego Novillo
  0 siblings, 1 reply; 2+ messages in thread
From: Lawrence Crowl @ 2011-06-08 22:22 UTC (permalink / raw)
  To: reply, dnovillo, gcc-patches

Some builtin macros are more builtin than others.  In particular, front-end
builtin macros are weaker than libcpp builtin macros, and should not be
processed with the libcpp builtin tools.


Index: gcc/testsuite/ChangeLog.pph

2011-06-08  Lawrence Crowl <crowl@google.com>

	* g++.dg/pph/c120060625-1.h: Make expected pass.
	* g++.dg/pph/c120060625-1.cc: Make expected pass.

Index: libcpp/ChangeLog.pph

2011-06-08  Lawrence Crowl  <crowl@google.com>

	* symtab.c (lt_query_macro): Querying "user builtin" macros should not
	call _cpp_builtin_macro_text.  Instead, call regular query, but first
	let the front end define the value.


Index: gcc/testsuite/g++.dg/pph/c120060625-1.cc
===================================================================
--- gcc/testsuite/g++.dg/pph/c120060625-1.cc	(revision 174789)
+++ gcc/testsuite/g++.dg/pph/c120060625-1.cc	(working copy)
@@ -1,5 +1 @@
-// { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "c120060625-1.h:14:22: internal compiler error: invalid built-in macro .__FLT_MAX__." "" { xfail *-*-* } 0 }
-// { dg-prune-output "In file included from " }
-
 #include "c120060625-1.h"
Index: gcc/testsuite/g++.dg/pph/c120060625-1.h
===================================================================
--- gcc/testsuite/g++.dg/pph/c120060625-1.h	(revision 174789)
+++ gcc/testsuite/g++.dg/pph/c120060625-1.h	(working copy)
@@ -1,6 +1,3 @@
-// { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "c120060625-1.h:14:22: internal compiler error: invalid built-in macro .__FLT_MAX__." "" { xfail *-*-* } 0 }
-
 #ifndef __PPH_GUARD_H
 #define __PPH_GUARD_H
 
Index: libcpp/symtab.c
===================================================================
--- libcpp/symtab.c	(revision 174789)
+++ libcpp/symtab.c	(working copy)
@@ -494,7 +494,8 @@ static const char *
 lt_query_macro (cpp_reader *reader, cpp_hashnode *cpp_node)
 {
   const char *definition = NULL;
-  if (cpp_node->flags & NODE_BUILTIN)
+  if ((cpp_node->flags & NODE_BUILTIN)
+      && cpp_node->value.builtin < BT_FIRST_USER)
     {
       const char *str = (const char *)cpp_node->ident.str;
       if (   strcmp(str, "__DATE__") == 0
@@ -527,6 +528,8 @@ lt_query_macro (cpp_reader *reader, cpp_
   else
     {
       char c;
+      if ((cpp_node->flags & NODE_BUILTIN) && reader->cb.user_builtin_macro)
+        reader->cb.user_builtin_macro (reader, cpp_node);
       definition = (const char *) cpp_macro_definition (reader, cpp_node);
       /* Skip over the macro name within the definition.  */
       c = *definition;

--
This patch is available for review at http://codereview.appspot.com/4575055

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pph] Front-end builtin macros (issue4575055)
  2011-06-08 22:22 [pph] Front-end builtin macros (issue4575055) Lawrence Crowl
@ 2011-06-08 23:04 ` Diego Novillo
  0 siblings, 0 replies; 2+ messages in thread
From: Diego Novillo @ 2011-06-08 23:04 UTC (permalink / raw)
  To: Lawrence Crowl; +Cc: reply, gcc-patches

On Wed, Jun 8, 2011 at 15:09, Lawrence Crowl <crowl@google.com> wrote:
> Some builtin macros are more builtin than others.  In particular, front-end
> builtin macros are weaker than libcpp builtin macros, and should not be
> processed with the libcpp builtin tools.

Nice!  This fixes a whole chunk of C test cases.


Diego.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-08 22:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-08 22:22 [pph] Front-end builtin macros (issue4575055) Lawrence Crowl
2011-06-08 23:04 ` Diego Novillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).