2015-01-30 16:49:14 +11:00
|
|
|
AC_DEFUN([NC_WARNINGS],[
|
2016-05-12 17:27:45 +10:00
|
|
|
AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
|
|
|
|
AC_REQUIRE([AX_COMPILER_VENDOR])
|
2015-01-30 16:49:14 +11:00
|
|
|
|
|
|
|
AX_COMPILER_VENDOR
|
|
|
|
|
2015-06-30 22:01:32 +10:00
|
|
|
# -------------------------------------------------------------------------
|
2015-01-30 16:49:14 +11:00
|
|
|
# Compound warnings
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wall], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wextra], [], [-Werror])
|
|
|
|
|
2015-06-30 22:01:32 +10:00
|
|
|
# -------------------------------------------------------------------------
|
2015-01-30 16:49:14 +11:00
|
|
|
# General warnings
|
2015-06-30 22:01:32 +10:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wbool-compare], [], [-Werror])
|
2015-01-30 16:49:14 +11:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wcast-align], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wcast-qual], [], [-Werror])
|
2015-06-30 22:01:32 +10:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wdisabled-optimization], [], [-Werror])
|
2015-01-30 16:49:14 +11:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wfloat-conversion], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-aggressive-loop-optimizations], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wnoexcept], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wnon-virtual-dtor], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-parentheses], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wshadow], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wsign-compare], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wsign-promo], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wstrict-aliasing], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wtype-limits], [], [-Werror])
|
2015-06-30 22:01:32 +10:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wunsafe-loop-optimizations], [], [-Werror])
|
2015-01-30 16:49:14 +11:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wunused-but-set-variable], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wunused-parameter], [], [-Werror])
|
2015-10-12 19:20:29 +11:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wpessimizing-move], [], [-Werror])
|
2016-05-12 17:27:45 +10:00
|
|
|
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])
|
2015-01-30 16:49:14 +11:00
|
|
|
|
2015-06-30 22:01:32 +10:00
|
|
|
# -------------------------------------------------------------------------
|
2015-01-30 16:49:14 +11:00
|
|
|
# Required extensions
|
|
|
|
#AX_APPEND_COMPILE_FLAGS([-Wgnu-flexible-array-union-member], [], [-Werror])
|
|
|
|
#AX_APPEND_COMPILE_FLAGS([-Wno-c99-extensions], [], [-Werror])
|
|
|
|
#AX_APPEND_COMPILE_FLAGS([-Wno-vla-extension], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-vla], [], [-Werror])
|
2016-05-12 18:06:12 +10:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-anonymous-struct])
|
2015-01-30 16:49:14 +11:00
|
|
|
|
|
|
|
AS_IF([test "x$ax_cv_cxx_compiler_vendor" != "xgnu"], [
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-c99-extensions], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-flexible-array-extensions], [], [-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-flexible-array-union-member], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-zero-variadic-macro-arguments], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-vla-extension], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-zero-length-array], [], [-Werror])
|
|
|
|
])
|
|
|
|
|
2015-06-30 22:01:32 +10:00
|
|
|
# -------------------------------------------------------------------------
|
2015-01-30 16:49:14 +11:00
|
|
|
# Excessive warnings
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-missing-braces], [], [-Werror])
|
|
|
|
|
|
|
|
AS_IF([test "x$ax_cv_cxx_compiler_vendor" != "xgnu"], [
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-nested-anon-types], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-unused-const-variable], [], [-Werror])
|
|
|
|
])
|
|
|
|
|
2015-06-30 22:01:32 +10:00
|
|
|
# -------------------------------------------------------------------------
|
2015-01-30 16:49:14 +11:00
|
|
|
# Strict warnings
|
2015-06-30 22:01:32 +10:00
|
|
|
|
|
|
|
# -------------------------------------------------------------------------
|
|
|
|
# Advisory warnings
|
|
|
|
AC_ARG_ENABLE([advisory], [
|
|
|
|
AS_HELP_STRING([--enable-advisory], [enable advisory warnings])
|
|
|
|
])
|
|
|
|
|
|
|
|
AS_IF([test "x$enable_advisory" = "xyes"], [
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Winline], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wsuggest-final-types], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wsuggest-final-methods], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wsuggest-override], [], [-Werror])
|
2016-05-12 17:27:45 +10:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wweak-vtables], [], [-Werror])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wpadded], [], [-Werror])
|
2015-06-30 22:01:32 +10:00
|
|
|
], [])
|
2015-01-30 16:49:14 +11:00
|
|
|
])
|