This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] use stdarg_p more


On Sun, Aug 08, 2010 at 09:00:04PM -0700, Nathan Froyd wrote:
> The patch below converts several places that poke directly at the
> internal representation of TYPE_ARG_TYPES to determine varargs-ness to
> use stdarg_p instead.  The old LTO branch did this, but it didn't touch
> all the backends.  I identified relevant backends by grep'ing for '[=!]=
> void_type_node' and starting at the matches found.  I did the same thing
> for *.[ch] in gcc/, but there weren't any other likely candidates other
> than the places already identified.  It's possible that I missed some.
> 
> Tested on x86_64-unknown-linux-gnu and cross to
> arm-eabi/powerpc-eabispe.  OK to commit?

Apparently I missed a hunk in generating my diff.  Mark, does this look
OK for the C++ frontend?

-Nathan

gcc/cp/
	* tree.c (varargs_function_p): Use stdarg_p.

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 5441448..af5a82f 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2284,11 +2284,7 @@ error_type (tree arg)
 int
 varargs_function_p (const_tree function)
 {
-  const_tree parm = TYPE_ARG_TYPES (TREE_TYPE (function));
-  for (; parm; parm = TREE_CHAIN (parm))
-    if (TREE_VALUE (parm) == void_type_node)
-      return 0;
-  return 1;
+  return stdarg_p (TREE_TYPE (function));
 }
 
 /* Returns 1 if decl is a member of a class.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]