summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <tbaeder@redhat.com>2021-02-17 10:27:07 +0100
committerMark Wielaard <mark@klomp.org>2021-03-06 03:05:51 +0100
commit00d92d0b6a495a81e4c585be7a41f10ef4b6d47c (patch)
tree872892409bfc43c24a4c8f8792affbe67599d4b0
parentf82f46fc6880509a539ed8194e9616d818eae88d (diff)
downloadelfutils-00d92d0b6a495a81e4c585be7a41f10ef4b6d47c.tar.gz
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 <tbaeder@redhat.com>
-rw-r--r--ChangeLog4
-rw-r--r--config/ChangeLog6
-rw-r--r--config/eu.am10
-rw-r--r--configure.ac9
4 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d379e713..fdcc082b 100644
--- 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.
diff --git a/config/ChangeLog b/config/ChangeLog
index e877bdda..cd8ff74c 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -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.
diff --git a/config/eu.am b/config/eu.am
index e109ffd3..02512570 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 e56aeb6a..5f3321aa 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"