Patchwork use stdarg_p more

login
register
mail settings
Submitter Nathan Froyd
Date Aug. 9, 2010, 12:59 p.m.
Message ID <20100809125950.GK4130@codesourcery.com>
Download mbox | patch
Permalink /patch/61269/
State New
Headers show

Comments

Nathan Froyd - Aug. 9, 2010, 12:59 p.m.
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.
Mark Mitchell - Aug. 9, 2010, 1:35 p.m.
Nathan Froyd wrote:

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

OK.

Patch

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.  */