[PATCH] recog: Use parameter packs for operator()

Richard Sandiford richard.sandiford@arm.com
Mon Jun 22 19:18:26 GMT 2020


Gerald Pfeifer <gerald@pfeifer.com> writes:
> On Thu, 18 Jun 2020, Sebastian Huber wrote:
>> b952c2cfcd74c284970e1b9bf1fca58f5f69ab23 on 10th of June. I build GCC 
>> roughly once per week.
>
> I have daily builds running on i386-unknown-freebsd11.3 (since this is
> the flavor most likely to trigger issues) and the failure started in the 
> 24 hours leading up to 2020-06-18-16:40UTC.
>
> clang 8.0.1 is the system compiler on FreeBSD 11, so we need a way for
> that to work I'm afraid.

OK, I've applied the below as (hopefully) obvious after testing
on aarch64-linux-gnu.

> I filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95805 and included
> the relevant part of the build log.

But I forgot about the PR, sorry, so didn't add it to the commit message.

Richard

-------------- next part --------------
>From c7a2a7d71ccc8a8c10867ef7027be5b617576c1d Mon Sep 17 00:00:00 2001
From: Richard Sandiford <richard.sandiford@arm.com>
Date: Mon, 22 Jun 2020 14:06:00 +0100
Subject: [PATCH] recog: Restore builds with Clang

Using parameter packs with function typedefs tripped a Clang bug
in which the packs were not being expanded correctly:

  https://bugs.llvm.org/show_bug.cgi?id=46377

Work around that by going back to the decltype approach, but adding
a cast to void to suppress a warning about unused values.

2020-06-22  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* coretypes.h (first_type): Delete.
	* recog.h (insn_gen_fn::operator()): Go back to using a decltype.
---
 gcc/coretypes.h | 4 ----
 gcc/recog.h     | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 720f9f9c63f..6b6cfcdf210 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -359,10 +359,6 @@ 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;
-
 /* Iterator pair used for a collection iteration with range-based loops.  */
 
 template<typename T>
diff --git a/gcc/recog.h b/gcc/recog.h
index d674d384723..3e4b55bdf3f 100644
--- a/gcc/recog.h
+++ b/gcc/recog.h
@@ -297,7 +297,7 @@ struct insn_gen_fn
   template<typename ...Ts>
   rtx_insn *operator() (Ts... args) const
   {
-    typedef rtx_insn *(*funcptr) (first_type<rtx, Ts>...);
+    typedef rtx_insn *(*funcptr) (decltype ((void) args, NULL_RTX)...);
     return ((funcptr) func) (args...);
   }
 
-- 
2.17.1



More information about the Gcc-patches mailing list