]> git.meshlink.io Git - meshlink/commitdiff
Only set -fno-strict-overflow if -fwrapv is not available.
authorGuus Sliepen <guus@meshlink.io>
Mon, 30 Apr 2018 19:06:51 +0000 (21:06 +0200)
committerGuus Sliepen <guus@meshlink.io>
Mon, 30 Apr 2018 19:06:51 +0000 (21:06 +0200)
When -fwrapv is set, -fno-strict-overflow has no effect. Clang then
decides to give an obnoxious warning.

configure.ac

index cbfb9e5e88721ba35c8d267abd222568eb30db5b..b4672e0c91895ba85e7c1c645f8906f3560103b3 100644 (file)
@@ -59,8 +59,9 @@ dnl No -fstack-protector-all because it doesn't work on all platforms or archite
 AC_ARG_ENABLE([hardening], AS_HELP_STRING([--disable-hardening], [disable compiler and linker hardening flags]))
 AS_IF([test "x$enable_hardening" != "xno"],
   [AX_CHECK_COMPILE_FLAG([-DFORTIFY_SOURCE=2], [CPPFLAGS="$CPPFLAGS -DFORITFY_SOURCE=2"])
-   AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CPPFLAGS="$CPPFLAGS -fno-strict-overflow"])
-   AX_CHECK_COMPILE_FLAG([-fwrapv], [CPPFLAGS="$CPPFLAGS -fwrapv"])
+   AX_CHECK_COMPILE_FLAG([-fwrapv], [CPPFLAGS="$CPPFLAGS -fwrapv"],
+     [AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CPPFLAGS="$CPPFLAGS -fno-strict-overflow"])]
+   )
    case $host_os in
      *mingw*)
        AX_CHECK_LINK_FLAG([-Wl,--dynamicbase], [LDFLAGS="$LDFLAGS -Wl,--dynamicbase"])