]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
New configure option: --enable-ubsan.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 15 Jul 2017 12:34:29 +0000 (14:34 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 23 Sep 2021 16:26:36 +0000 (18:26 +0200)
If the new option is given, -fsanitize=undefined is passed to the
compiler to enable the undefined behavior detector.

We don't check whether this option is supported because the configure
option is off by default.

Makefile.in
Makefile.real
configure.ac

index d4a83a776eec0dfd602aa4329a72718cc15ea7f4..11fa2001d1e6678cdc8968d58d6729d7ce0955b4 100644 (file)
@@ -67,4 +67,6 @@ curses_ldflags := @curses_ldflags@
 crypto_ldflags := @crypto_ldflags@
 iconv_ldflags := @iconv_ldflags@
 
+ENABLE_UBSAN := @ENABLE_UBSAN@
+
 include Makefile.real
index b88de22533048979bcfef8f3396b7608297afb3b..e0296b1fe2f1909b785b6a329238e334d456168b 100644 (file)
@@ -129,6 +129,11 @@ STRICT_CFLAGS += -Wno-sign-compare -Wno-unknown-pragmas
 STRICT_CFLAGS += -Wdeclaration-after-statement
 STRICT_CFLAGS += -Wformat -Wformat-security -Wmissing-format-attribute
 
+ifeq ($(ENABLE_UBSAN), yes)
+       STRICT_CFLAGS += -fsanitize=undefined
+       LDFLAGS += -lubsan
+endif
+
 ifeq ($(uname_s),Linux)
        # these cause warnings on *BSD
        CPPFLAGS += -Wunused-macros
index f518f89af154933ffaa64401ba1086b7e3f369c9..850e814f21cbe3601441f3f625a712290b7d3015 100644 (file)
@@ -373,6 +373,11 @@ AC_CHECK_HEADER(samplerate.h, [], HAVE_SAMPLERATE=no)
 AC_CHECK_LIB([samplerate], [src_process], [], HAVE_SAMPLERATE=no)
 LIB_SUBST_FLAGS(samplerate)
 UNSTASH_FLAGS
+######################################################################### ubsan
+AC_ARG_ENABLE([ubsan], [AS_HELP_STRING(--enable-ubsan,
+       [Detect and report undefined behaviour.])],
+       [ENABLE_UBSAN=yes], [ENABLE_UBSAN=no])
+AC_SUBST(ENABLE_UBSAN)
 ######################################################################### server
 if test -n "$CRYPTOLIB" && test $HAVE_OSL = yes && test -n "$BISON" && \
                test -n "$FLEX"; then