X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=configure.ac;fp=configure.ac;h=89b34ae7313ef0b183a625cc2692bd22902ec423;hp=dc0dc0231d4d54078881be01b6f5775d1cb0dd55;hb=ee334e481cf5b4216bc61a8b291c9b944c3b4f86;hpb=70469b43316ecc8d6053550504858ad8a8ef9b16 diff --git a/configure.ac b/configure.ac index dc0dc02..89b34ae 100644 --- a/configure.ac +++ b/configure.ac @@ -96,6 +96,39 @@ AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_UINT8_T +# Detect warning flags supported by the C compiler and append them to +# WARN_CFLAGS. +m4_define([WARN_FLAGS_LIST], [ dnl + -Wall dnl + -Wextra dnl + -Wmissing-prototypes dnl + -Wmissing-declarations dnl + -Wnull-dereference dnl + -Wundef dnl + -Wshadow dnl + -Wjump-misses-init dnl + -Wsuggest-attribute=format dnl + -Wtautological-constant-out-of-range-compare dnl + -Wnested-externs dnl + -Wwrite-strings dnl + -Wformat=2 dnl + -Wstrict-aliasing dnl + -Wmissing-noreturn dnl + -Winit-self dnl + -Wduplicated-cond dnl + -Wduplicated-branches dnl + -Wlogical-op dnl + dnl + dnl-Wredundant-decls dnl + -Wno-null-dereference dnl +]) + +# Pass -Werror as an extra flag during the test: this is needed to make the +# -Wunknown-warning-option diagnostic fatal with clang. +AC_LANG_PUSH([C]) +AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CFLAGS], [-Werror]) +AC_LANG_POP([C]) + ## ## ## Header checks ## @@ -244,7 +277,7 @@ AC_SUBST(LT_NO_UNDEFINED) AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h" AC_SUBST(AM_CPPFLAGS) -AM_CFLAGS="-Wall -Wextra -Wno-unused-parameter $PTHREAD_CFLAGS" +AM_CFLAGS="$WARN_CFLAGS $PTHREAD_CFLAGS" AC_SUBST(AM_CFLAGS)