This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] c-common.c: Clean up handle_sentinel_attribute.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 9 Jun 2006 11:06:03 -0700
- Subject: [patch] c-common.c: Clean up handle_sentinel_attribute.
Hi,
Attached is a patch to simplify handle_sentinel_attribute.
One of the things we would like to do on the LTO branch is to stop
using TREE_LIST in TYPE_ARG_TYPES. While working on a patch to
achieve that, I've noticed a clean-up opportunity shown below in the
form of a patch, which will also make the aforementioned patch smaller
and easier to review.
Tested on x86_64-pc-linux-gnu. Committed to the LTO branch as
obvious.
Kazu Hirata
2006-06-09 Kazu Hirata <kazu@codesourcery.com>
* c-common.c (handle_sentinel_attribute): Use tree_last
instead of rolling one on our own.
Index: c-common.c
===================================================================
--- c-common.c (revision 114406)
+++ c-common.c (working copy)
@@ -5627,10 +5627,7 @@ handle_sentinel_attribute (tree *node, t
}
else
{
- while (TREE_CHAIN (params))
- params = TREE_CHAIN (params);
-
- if (VOID_TYPE_P (TREE_VALUE (params)))
+ if (VOID_TYPE_P (TREE_VALUE (tree_last (params))))
{
warning (OPT_Wattributes,
"%qE attribute only applies to variadic functions", name);