m4: bump autocruft for compiler updates

This commit is contained in:
Danny Robson 2016-05-18 10:20:17 +10:00
parent 7a971470e8
commit c08698c283
5 changed files with 71 additions and 58 deletions

View File

@ -2,7 +2,7 @@ AC_DEFUN([NC_CXX],[
AX_CHECK_COMPILE_FLAG( AX_CHECK_COMPILE_FLAG(
[-std=c++1z], [-std=c++1z],
[AX_APPEND_FLAG([-std=c++1z], [CXXFLAGS])], [AX_APPEND_FLAG([-std=c++1z], [CXXFLAGS])],
[AC_ERROR([Unable to enable c++1z])] [AC_MSG_ERROR([Unable to enable c++1z])]
) )
AX_APPEND_COMPILE_FLAGS([-pipe], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-pipe], [], [-Werror])
@ -14,14 +14,11 @@ AC_DEFUN([NC_CXX],[
AC_C_RESTRICT AC_C_RESTRICT
AC_C_INLINE AC_C_INLINE
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([struct A { virtual void C (void) = 0; }; AC_ARG_ENABLE([libcxx], [AS_HELP_STRING([--enable-libcxx], [use clang's cxx library])])
struct B : A { void C (void) override; }; ],
[])],
[], [AC_DEFINE([override], [], [Pretend about override keyword support])])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([struct A final { }; ], AS_IF([test "x${enable_libcxx}" == "xyes"], [
[])], AX_APPEND_COMPILE_FLAGS([-stdlib=libc++])
[], [AC_DEFINE([final], [], [Pretend about final keyword support])]) ])
AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden], [], [-Werror])
]) ])

View File

@ -3,50 +3,18 @@ AC_DEFUN([NC_DEBUGGING],[
AX_REQUIRE_DEFINED([AS_HELP_STRING]) AX_REQUIRE_DEFINED([AS_HELP_STRING])
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS]) AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS]) AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS])
AX_REQUIRE_DEFINED([NC_APPEND_ONE_COMPILE_FLAG])
##------------------------------------------------------------------------- ##-------------------------------------------------------------------------
AC_ARG_ENABLE([sanitizer], [AS_HELP_STRING([--enable-sanitizer], [enable memory sanitizer])]) AC_ARG_ENABLE([sanitizer], [AS_HELP_STRING([--enable-sanitizer], [enable memory sanitizer])])
AS_IF([test "x$enable_sanitizer" = "xyes"], [ AS_IF([test "x$enable_sanitizer" = "xyes"], [
m4_foreach([NAME], [ AX_APPEND_COMPILE_FLAGS([-fsanitize=address])
dnl common top-level names. deliberately does not include AX_APPEND_COMPILE_FLAGS([-fsanitize=undefined])
dnl 'undefined' due to false positives in some core libraries
dnl (eg, boost::format). AX_APPEND_COMPILE_FLAGS([-ftrapv])
[address],
dnl gcc currently causes segfaults at configure time with [thread],
dnl
dnl gcc specific names. do not use vptr or boost::format will die
[alignment],
[bounds],
[enum],
[float-cast-overflow],
[float-divide-by-zero],
[integer-divide-by-zero],
[leak],
[nonnull-attribute],
[object-size],
[return],
[returns-nonnull-attribute],
[shift],
[signed-integer-overflow],
[unreachable],
[vla-bound],
dnl clang specific names
[integer],
[undefined-trap],
[cfi]dnl
], [
AX_APPEND_COMPILE_FLAGS([-fsanitize=[]NAME], [], [-Werror])
AX_APPEND_LINK_FLAGS([-fsanitize=[]NAME], [], [-Werror])
]) ])
## We, and the std library, tend to use unsigned overflow legitimately AM_CONDITIONAL([WITH_SANITIZER], [test "x${enable_sanitizer}" == "xyes"])
AX_APPEND_COMPILE_FLAGS([-fno-sanitize=unsigned-integer-overflow], [], [-Werror])
AX_APPEND_LINK_FLAGS([-fno-sanitize=unsigned-integer-overflow], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftrapv], [], [-Werror])
])
##------------------------------------------------------------------------- ##-------------------------------------------------------------------------
AC_ARG_ENABLE([debugging], [AS_HELP_STRING([--enable-debugging], [enables developer debugging support])]) AC_ARG_ENABLE([debugging], [AS_HELP_STRING([--enable-debugging], [enables developer debugging support])])
@ -55,7 +23,9 @@ AC_DEFUN([NC_DEBUGGING],[
AC_DEFINE([ENABLE_DEBUGGING], [], [Debugging support enabled]) AC_DEFINE([ENABLE_DEBUGGING], [], [Debugging support enabled])
AC_DEFINE([_GLIBCXX_DEBUG], [], [Use glibcxx debugging mode]) AC_DEFINE([_GLIBCXX_DEBUG], [], [Use glibcxx debugging mode])
NC_APPEND_ONE_COMPILE_FLAG([-O0]) AX_APPEND_COMPILE_FLAGS([-O0])
AX_APPEND_COMPILE_FLAGS([-fstack-protector])
], [ ], [
AX_APPEND_COMPILE_FLAGS([-O2]) AX_APPEND_COMPILE_FLAGS([-O2])
AX_APPEND_COMPILE_FLAGS([-fno-rtti]) AX_APPEND_COMPILE_FLAGS([-fno-rtti])
@ -63,6 +33,11 @@ AC_DEFUN([NC_DEBUGGING],[
]) ])
##------------------------------------------------------------------------- ##-------------------------------------------------------------------------
AX_APPEND_COMPILE_FLAGS([-g], [], [-Werror]) AS_CASE([${host_os}],
AX_APPEND_COMPILE_FLAGS([-ggdb], [], [-Werror]) [mingw*], [AX_APPEND_COMPILE_FLAGS([-gstabs])],
[
AX_APPEND_COMPILE_FLAGS([-g])
AX_APPEND_COMPILE_FLAGS([-ggdb])
]
)
]) ])

View File

@ -75,15 +75,25 @@ AC_DEFUN([NC_OPTIMISATION],[
AX_APPEND_COMPILE_FLAGS([-fslp-vectorize-aggressive], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-fslp-vectorize-aggressive], [], [-Werror])
# loop hosting/distribution # loop hosting/distribution
AX_APPEND_COMPILE_FLAGS([-ftree-loop-distribute-patterns], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-floop-nest-optimize], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-distribution], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-ftree-loop-distribution], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-distribute-patterns], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-im], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-if-convert-stores], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-ftree-loop-if-convert-stores], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-linear], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-fivopts], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-funsafe-loop-optimizations], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-funsafe-loop-optimizations], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-floop-interchange], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-floop-interchange], [], [-Werror])
# safety removal for performance AX_APPEND_COMPILE_FLAGS([-fpredictive-commoning], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-funswitch-loops], [], [-Werror])
# options that require substantial time/memory
AX_APPEND_COMPILE_FLAGS([-fipa-pta])
dnl # safety removal for performance
AX_APPEND_COMPILE_FLAGS([-fno-stack-protector], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-fno-stack-protector], [], [-Werror])
]) ])

View File

@ -1,8 +1,16 @@
AC_DEFUN([NC_PLATFORM],[ AC_DEFUN([NC_PLATFORM],[
AC_CANONICAL_HOST AC_CANONICAL_HOST
AM_CONDITIONAL([PLATFORM_WIN32], [test "x$host_os" = "xmingw32"]) AS_CASE([x${host_os}],
AM_CONDITIONAL([PLATFORM_LINUX], [test "x$host_os" = "xlinux-gnu"]) [xmingw*], [nc_cv_platform_win32=yes],
[xlinux*], [nc_cv_platform_linux=yes],
[xfreebsd*], [nc_cv_platform_freebsd=yes],
[AC_MSG_ERROR([unhandled platform ${host_os}])]
)
AM_CONDITIONAL([PLATFORM_WIN32], [test "x$nc_cv_platform_win32" = "xyes"])
AM_CONDITIONAL([PLATFORM_LINUX], [test "x$nc_cv_platform_linux" = "xyes"])
AM_CONDITIONAL([PLATFORM_FREEBSD], [test "x$nc_cv_platform_freebsd" = "xyes"])
AS_CASE([$host_os], AS_CASE([$host_os],
[mingw32], [ [mingw32], [
@ -20,7 +28,12 @@ AC_DEFUN([NC_PLATFORM],[
AX_APPEND_LINK_FLAGS([-static-libgcc], [], [-Werror]) AX_APPEND_LINK_FLAGS([-static-libgcc], [], [-Werror])
], ],
[linux-gnu], [ ], [freebsd*], [
AX_APPEND_COMPILE_FLAGS([-I/usr/local/include])
AX_APPEND_LINK_FLAGS([-L/usr/local/lib])
],
[linux*], [:],
[AC_MSG_ERROR([Unknown platform])] [AC_MSG_ERROR([Unknown platform])]
) )

View File

@ -1,6 +1,6 @@
AC_DEFUN([NC_WARNINGS],[ AC_DEFUN([NC_WARNINGS],[
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS]) AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
AX_REQUIRE_DEFINED([AX_COMPILER_VENDOR]) AC_REQUIRE([AX_COMPILER_VENDOR])
AX_COMPILER_VENDOR AX_COMPILER_VENDOR
@ -32,8 +32,22 @@ AC_DEFUN([NC_WARNINGS],[
AX_APPEND_COMPILE_FLAGS([-Wunsafe-loop-optimizations], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wunsafe-loop-optimizations], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wunused-but-set-variable], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wunused-but-set-variable], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wunused-parameter], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wunused-parameter], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wuseless-cast], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wpessimizing-move], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wpessimizing-move], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wswitch-enum], [], [-Werror])
dnl gcc-6.1.0 warnings
AX_APPEND_COMPILE_FLAGS([-Wshift-negative-value], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wnull-dereference], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wduplicated-cond], [], [-Werror])
dnl useless-cast isn't usable on gcc-6.1 due to spurious warnings
dnl see gcc#70844
AX_APPEND_COMPILE_FLAGS([-Wuseless-cast], [], [-Werror])
dnl clang 3.7.1 warnings
AX_APPEND_COMPILE_FLAGS([-Wshorten-64-to-32], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wdeprecated], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wcovered-switch-default], [], [-Werror])
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Required extensions # Required extensions
@ -42,9 +56,12 @@ AC_DEFUN([NC_WARNINGS],[
#AX_APPEND_COMPILE_FLAGS([-Wno-vla-extension], [], [-Werror]) #AX_APPEND_COMPILE_FLAGS([-Wno-vla-extension], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-vla], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wno-vla], [], [-Werror])
dnl GCC will happily compile with any "-Wno" argument, so enable GCC-isms
dnl only if we aren't GCC
AS_IF([test "x$ax_cv_cxx_compiler_vendor" != "xgnu"], [ AS_IF([test "x$ax_cv_cxx_compiler_vendor" != "xgnu"], [
AX_APPEND_COMPILE_FLAGS([-Wno-c99-extensions], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wno-c99-extensions], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-flexible-array-extensions], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wno-flexible-array-extensions], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-anonymous-struct])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-conditional-omitted-operand], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wno-gnu-conditional-omitted-operand], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-empty-struct], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wno-gnu-empty-struct], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-flexible-array-union-member], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wno-gnu-flexible-array-union-member], [], [-Werror])
@ -64,7 +81,6 @@ AC_DEFUN([NC_WARNINGS],[
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Strict warnings # Strict warnings
AX_APPEND_COMPILE_FLAGS([-pedantic], [], [-Werror])
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Advisory warnings # Advisory warnings
@ -77,5 +93,7 @@ AC_DEFUN([NC_WARNINGS],[
AX_APPEND_COMPILE_FLAGS([-Wsuggest-final-types], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wsuggest-final-types], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wsuggest-final-methods], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wsuggest-final-methods], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wsuggest-override], [], [-Werror]) AX_APPEND_COMPILE_FLAGS([-Wsuggest-override], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wweak-vtables], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wpadded], [], [-Werror])
], []) ], [])
]) ])