2015-01-30 16:49:14 +11:00
|
|
|
AC_DEFUN([NC_WARNINGS],[
|
|
|
|
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
|
|
|
|
AX_REQUIRE_DEFINED([AX_COMPILER_VENDOR])
|
|
|
|
|
|
|
|
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])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wuseless-cast], [], [-Werror])
|
2015-10-12 19:20:29 +11:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wpessimizing-move], [], [-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])
|
|
|
|
|
|
|
|
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
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-pedantic], [], [-Werror])
|
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])
|
|
|
|
], [])
|
2015-01-30 16:49:14 +11:00
|
|
|
])
|