From bc437a56994d4f8d75fd03f5035ec6d211b69ce2 Mon Sep 17 00:00:00 2001
From: Martin Sebor <msebor@redhat.com>
Date: Mon, 2 Oct 2017 23:57:19 +0000
Subject: [PATCH] Clean up more fallout from r252976.

libatomic/ChangeLog:
2017-10-02  Martin Sebor  <msebor@redhat.com>

	PR c/81854
	* acinclude.m4 (LIBAT_CHECK_IFUNC): Have ifunc resolver return
	a function pointer rather than void* to avoid GCC 8 warnings.
	* configure: Regenerate.
	* libatomic_i.h: Declare ifunc resolvers to return function
	pointers rather than void*.

From-SVN: r253372
---
 libatomic/ChangeLog     | 9 +++++++++
 libatomic/acinclude.m4  | 3 ++-
 libatomic/configure     | 8 +++++++-
 libatomic/libatomic_i.h | 6 +++---
 4 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index 9e11b230dcd..835ea6c5093 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,12 @@
+2017-10-02  Martin Sebor  <msebor@redhat.com>
+
+	PR c/81854
+	* acinclude.m4 (LIBAT_CHECK_IFUNC): Have ifunc resolver return
+	a function pointer rather than void* to avoid GCC 8 warnings.
+	* configure: Regenerate.
+	* libatomic_i.h: Declare ifunc resolvers to return function
+	pointers rather than void*.
+
 2017-05-12  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	* testsuite/lib/libatomic.exp: Load scanlang.exp.
diff --git a/libatomic/acinclude.m4 b/libatomic/acinclude.m4
index 485d731df55..383218f933f 100644
--- a/libatomic/acinclude.m4
+++ b/libatomic/acinclude.m4
@@ -195,7 +195,8 @@ AC_DEFUN([LIBAT_CHECK_IFUNC], [
   CFLAGS="$CFLAGS -Werror"
   AC_TRY_LINK([
     int foo_alt(void) { return 0; }
-    void *foo_sel(void) { return foo_alt; }
+    typedef int F (void);
+    F *foo_sel(void) { return foo_alt; }
     int foo(void) __attribute__((ifunc("foo_sel")));],
     [return foo();], libat_cv_have_ifunc=yes, libat_cv_have_ifunc=no)])
   LIBAT_DEFINE_YESNO([HAVE_IFUNC], [$libat_cv_have_ifunc],
diff --git a/libatomic/configure b/libatomic/configure
index c05fc9d1141..e88a7b8c553 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -12333,6 +12333,7 @@ _ACEOF
 
 
 
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 2" >&5
 $as_echo_n "checking for __atomic_load/store for size 2... " >&6; }
 if test "${libat_cv_have_at_ldst_2+set}" = set; then :
@@ -12400,6 +12401,7 @@ _ACEOF
 
 
 
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 4" >&5
 $as_echo_n "checking for __atomic_load/store for size 4... " >&6; }
 if test "${libat_cv_have_at_ldst_4+set}" = set; then :
@@ -12467,6 +12469,7 @@ _ACEOF
 
 
 
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 8" >&5
 $as_echo_n "checking for __atomic_load/store for size 8... " >&6; }
 if test "${libat_cv_have_at_ldst_8+set}" = set; then :
@@ -12534,6 +12537,7 @@ _ACEOF
 
 
 
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_load/store for size 16" >&5
 $as_echo_n "checking for __atomic_load/store for size 16... " >&6; }
 if test "${libat_cv_have_at_ldst_16+set}" = set; then :
@@ -12602,6 +12606,7 @@ _ACEOF
 
 
 
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __atomic_test_and_set for size 1" >&5
 $as_echo_n "checking for __atomic_test_and_set for size 1... " >&6; }
 if test "${libat_cv_have_at_tas_1+set}" = set; then :
@@ -14693,7 +14698,8 @@ else
 /* end confdefs.h.  */
 
     int foo_alt(void) { return 0; }
-    void *foo_sel(void) { return foo_alt; }
+    typedef int F (void);
+    F *foo_sel(void) { return foo_alt; }
     int foo(void) __attribute__((ifunc("foo_sel")));
 int
 main ()
diff --git a/libatomic/libatomic_i.h b/libatomic/libatomic_i.h
index 4eb372af280..2dad4a84d7a 100644
--- a/libatomic/libatomic_i.h
+++ b/libatomic/libatomic_i.h
@@ -240,7 +240,7 @@ bool libat_is_lock_free (size_t, void *) MAN(is_lock_free);
 # if IFUNC_NCOND(N) == 1
 #  define GEN_SELECTOR(X)					\
 	extern typeof(C2(libat_,X)) C3(libat_,X,_i1) HIDDEN;	\
-	static void * C2(select_,X) (void)			\
+	static typeof(C2(libat_,X)) * C2(select_,X) (void)	\
 	{							\
 	  if (IFUNC_COND_1)					\
 	    return C3(libat_,X,_i1);				\
@@ -250,7 +250,7 @@ bool libat_is_lock_free (size_t, void *) MAN(is_lock_free);
 #  define GEN_SELECTOR(X)					\
 	extern typeof(C2(libat_,X)) C3(libat_,X,_i1) HIDDEN;	\
 	extern typeof(C2(libat_,X)) C3(libat_,X,_i2) HIDDEN;	\
-	static void * C2(select_,X) (void)			\
+	static typeof(C2(libat_,X)) * C2(select_,X) (void)	\
 	{							\
 	  if (IFUNC_COND_1)					\
 	    return C3(libat_,X,_i1);				\
@@ -263,7 +263,7 @@ bool libat_is_lock_free (size_t, void *) MAN(is_lock_free);
 	extern typeof(C2(libat_,X)) C3(libat_,X,_i1) HIDDEN;	\
 	extern typeof(C2(libat_,X)) C3(libat_,X,_i2) HIDDEN;	\
 	extern typeof(C2(libat_,X)) C3(libat_,X,_i3) HIDDEN;	\
-	static void * C2(select_,X) (void)			\
+	static typeof(C2(libat_,X)) * C2(select_,X) (void)	\
 	{							\
 	  if (IFUNC_COND_1)					\
 	    return C3(libat_,X,_i1);				\