From: Richard Sandiford Date: Wed, 17 Jun 2020 16:45:29 +0000 (+0100) Subject: recog: Tweak insn_gen_fn::operator() definition X-Git-Tag: upstream/12.2.0~15502 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4e49b994de060d4a6c9318d0ed52ef038153426e;p=platform%2Fupstream%2Fgcc.git recog: Tweak insn_gen_fn::operator() definition Fixes a “left operand of comma has no effect” warning that some were seeing. Also fixes a spurious ellipsis that Jonathan Wakely pointed out. 2020-06-17 Richard Sandiford gcc/ * coretypes.h (first_type): New alias template. * recog.h (insn_gen_fn::operator()): Use it instead of a decltype. Remove spurious “...” and split the function type out into a typedef. --- diff --git a/gcc/coretypes.h b/gcc/coretypes.h index cda2269..01ec2e2 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -359,6 +359,10 @@ struct kv_pair const ValueType value; /* the value of the name */ }; +/* Alias of the first type, ignoring the second. */ +template +using first_type = T1; + #else struct _dont_use_rtx_here_; diff --git a/gcc/recog.h b/gcc/recog.h index 0a71a02..d674d38 100644 --- a/gcc/recog.h +++ b/gcc/recog.h @@ -295,9 +295,10 @@ struct insn_gen_fn typedef void (*stored_funcptr) (void); template - rtx_insn *operator() (Ts... args...) const + rtx_insn *operator() (Ts... args) const { - return ((rtx_insn *(*) (decltype(args, NULL_RTX)...)) func) (args...); + typedef rtx_insn *(*funcptr) (first_type...); + return ((funcptr) func) (args...); } // This is for compatibility of code that invokes functions like