summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2023-02-21 13:12:38 +0100
committerMark Wielaard <[email protected]>2023-02-21 13:12:38 +0100
commitc9c055a6949702af57e46f4eac3355d4a4f94c5d (patch)
treec3abb1ef850c9515c1f7749528e70adfc3644a44 /configure.ac
parenteb79a7bd87adc51dae77eb8d5ec37ad58ec71feb (diff)
configure: Check for and -Wuse-after-free=3 when available
gcc already includes -Wuse-after-free=2 in -Wall. -Wuse-after-free=3 also warns for indeterminate pointers in equality expressions. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac11
1 files changed, 10 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 4c8a4c31..142a89f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
dnl Configure input file for elfutils. -*-autoconf-*-
dnl
dnl Copyright (C) 1996-2019 Red Hat, Inc.
-dnl Copyright (C) 2022 Mark J. Wielaard <[email protected]>
+dnl Copyright (C) 2022, 2023 Mark J. Wielaard <[email protected]>
dnl
dnl This file is part of elfutils.
dnl
@@ -618,6 +618,15 @@ CFLAGS="$old_CFLAGS"])
AM_CONDITIONAL(HAVE_NO_PACKED_NOT_ALIGNED_WARNING,
[test "x$ac_cv_no_packed_not_aligned" != "xno"])
+AC_CACHE_CHECK([whether the compiler accepts -Wuse-after-free=3], ac_cv_use_after_free3, [dnl
+old_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wuse-after-free=3 -Werror"
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
+ ac_cv_use_after_free3=yes, ac_cv_use_after_free3=no)
+CFLAGS="$old_CFLAGS"])
+AM_CONDITIONAL(HAVE_USE_AFTER_FREE3_WARNING,
+ [test "x$ac_cv_use_after_free3" != "xno"])
+
AC_CACHE_CHECK([whether the compiler accepts -fno-addrsig], ac_cv_fno_addrsig, [dnl
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-addrsig -Werror"