From: Timm Bäder Date: Wed, 17 Feb 2021 09:27:07 +0000 (+0100) Subject: build: Check for -Wtrampolines support X-Git-Tag: elfutils-0.184~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=00d92d0b6a495a81e4c585be7a41f10ef4b6d47c;p=thirdparty%2Felfutils.git build: Check for -Wtrampolines support Clang does not support -Wtrampolines, so check if the compiler supports it before using it. Signed-off-by: Timm Bäder --- diff --git a/ChangeLog b/ChangeLog index d379e7137..fdcc082bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2021-02-17 Timm Bäder + + * configure.ac: Add -Wtrampolines check. + 2021-02-05 Mark Wielaard * configure.ac (AC_INIT): Set version to 0.183. diff --git a/config/ChangeLog b/config/ChangeLog index e877bddac..cd8ff74ca 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,9 @@ +2021-02-17 Timm Bäder + + * eu.am (TRAMPOLINES_WARNING): New variable. + (AM_CFLAGS): Use TRAMPOLINES_WARNING. + (AM_CXXFLAGS): Likewise. + 2021-02-12 Mark Wielaard * elfutils.spec.in: Escape %%check in comment. diff --git a/config/eu.am b/config/eu.am index e109ffd3b..025125703 100644 --- a/config/eu.am +++ b/config/eu.am @@ -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) \ diff --git a/configure.ac b/configure.ac index e56aeb6a7..5f3321aa8 100644 --- a/configure.ac +++ b/configure.ac @@ -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"