]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
build: Check for -Wtrampolines support
authorTimm Bäder <tbaeder@redhat.com>
Wed, 17 Feb 2021 09:27:07 +0000 (10:27 +0100)
committerMark Wielaard <mark@klomp.org>
Sat, 6 Mar 2021 02:05:51 +0000 (03:05 +0100)
Clang does not support -Wtrampolines, so check if the compiler supports
it before using it.

Signed-off-by: Timm Bäder <tbaeder@redhat.com>
ChangeLog
config/ChangeLog
config/eu.am
configure.ac

index d379e7137124621249d4e33530cea40c8e6f8e5f..fdcc082bc3c315573f5475d5500cc215ee412857 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2021-02-17  Timm Bäder  <tbaeder@redhat.com>
+
+       * configure.ac: Add -Wtrampolines check.
+
 2021-02-05  Mark Wielaard  <mark@klomp.org>
 
        * configure.ac (AC_INIT): Set version to 0.183.
index e877bddac708f74fb85fb8c3aa5661864d4bf1e3..cd8ff74ca4b09c968f1ffeaad635fce92b241ae5 100644 (file)
@@ -1,3 +1,9 @@
+2021-02-17  Timm Bäder  <tbaeder@redhat.com>
+
+       * eu.am (TRAMPOLINES_WARNING): New variable.
+       (AM_CFLAGS): Use TRAMPOLINES_WARNING.
+       (AM_CXXFLAGS): Likewise.
+
 2021-02-12  Mark Wielaard  <mark@klomp.org>
 
        * elfutils.spec.in: Escape %%check in comment.
index e109ffd3b4554147d651b57583084332c1837db8..025125703ebe35219141237032a557d358ea5252 100644 (file)
@@ -73,8 +73,14 @@ else
 IMPLICIT_FALLTHROUGH_WARNING=
 endif
 
+if HAVE_TRAMPOLINES_WARNING
+TRAMPOLINES_WARNING=-Wtrampolines
+else
+TRAMPOLINES_WARNING=
+endif
+
 AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
-           -Wold-style-definition -Wstrict-prototypes -Wtrampolines \
+           -Wold-style-definition -Wstrict-prototypes $(TRAMPOLINES_WARNING) \
            $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
            $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
            $(if $($(*F)_no_Werror),,-Werror) \
@@ -84,7 +90,7 @@ AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
            $($(*F)_CFLAGS)
 
 AM_CXXFLAGS = -std=c++11 -Wall -Wshadow \
-          -Wtrampolines \
+          $(TRAMPOLINES_WARNING) \
           $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
           $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
           $(if $($(*F)_no_Werror),,-Werror) \
index e56aeb6a7d34585e9ba550aa4c2d8c0ef62b04b2..5f3321aa8fbfc07af548213faa1d0300d4727b58 100644 (file)
@@ -537,6 +537,15 @@ if test "$ac_cv_implicit_fallthrough" = "yes"; then
                  [Defined if __attribute__((fallthrough)) is supported])
 fi
 
+AC_CACHE_CHECK([whether the compiler accepts -Wtrampolines], ac_cv_trampolines, [dnl
+old_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wtrampolines -Werror"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
+                 ac_cv_trampolines=yes, ac_cv_trampolines=no)
+CFLAGS="$old_CFLAGS"])
+AM_CONDITIONAL(HAVE_TRAMPOLINES_WARNING,
+              [test "x$ac_cv_trampolines" != "xno"])
+
 saved_LIBS="$LIBS"
 AC_SEARCH_LIBS([argp_parse], [argp])
 LIBS="$saved_LIBS"