[lto] cp/call.c: Turn a redundant check into a gcc_assert.
Kazu Hirata
kazu@codesourcery.com
Wed Jun 28 03:38:00 GMT 2006
Hi,
Attached is a patch to turn a redundant check into a gcc_assert.
While modifying add_function_candidate to use num_parm_types and
nth_parm_type, I've noticed that the "if" statement shown in the patch
is redundant. Note that we take two steps to check whether a function
is viable a given function call.
The first step is that a parameter list of a candidate function is
long enough for a given function call. Once this check is done, we
know that we won't encounter void_type_node while walking the
parameter list of a candidate function and arguments in tandem.
Tested on x86_64-pc-linux-gnu. OK to apply to the LTO branch and (4.3
once in Stage 1)?
p.s.
I realize that this isn't 100% LTO-specific, but I didn't want to
leave the "if" statement as is because "break;" isn't supposed to
happen.
Kazu Hirata
2006-06-28 Kazu Hirata <kazu@codesourcery.com>
* call.c (add_function_candidate): Turn a redundant check into
a gcc_assert.
Index: cp/call.c
===================================================================
--- cp/call.c (revision 115039)
+++ cp/call.c (working copy)
@@ -1381,8 +1381,7 @@ add_function_candidate (struct z_candida
conversion *t;
int is_this;
- if (parmnode == void_list_node)
- break;
+ gcc_assert (parmnode != void_list_node);
is_this = (i == 0 && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
&& ! DECL_CONSTRUCTOR_P (fn));
More information about the Gcc-patches
mailing list