recog: Tweak insn_gen_fn::operator() definition
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 17 Jun 2020 16:45:29 +0000 (17:45 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 17 Jun 2020 16:45:29 +0000 (17:45 +0100)
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  <richard.sandiford@arm.com>

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.

gcc/coretypes.h
gcc/recog.h

index cda2269..01ec2e2 100644 (file)
@@ -359,6 +359,10 @@ struct kv_pair
   const ValueType value;       /* the value of the name */
 };
 
+/* Alias of the first type, ignoring the second.  */
+template<typename T1, typename T2>
+using first_type = T1;
+
 #else
 
 struct _dont_use_rtx_here_;
index 0a71a02..d674d38 100644 (file)
@@ -295,9 +295,10 @@ struct insn_gen_fn
   typedef void (*stored_funcptr) (void);
 
   template<typename ...Ts>
-  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<rtx, Ts>...);
+    return ((funcptr) func) (args...);
   }
 
   // This is for compatibility of code that invokes functions like