dnl AC_PANDORA_WARNINGS([less-warnings|warnings-always-on])
dnl less-warnings turn on a limited set of warnings
dnl warnings-always-on always set warnings=error regardless of tarball/vc
+
+dnl @TODO: remove less-warnings option as soon as Drizzle is clean enough to
+dnl allow it
AC_DEFUN([PANDORA_WARNINGS],[
m4_define([PW_LESS_WARNINGS],[no])
m4_define([PW_WARN_ALWAYS_ON],[no])
- m4_foreach_w([pw_arg],$@,[
+ ifdef([m4_define],,[define([m4_define], defn([define]))])
+ ifdef([m4_undefine],,[define([m4_undefine], defn([undefine]))])
+ m4_foreach([pw_arg],[$*],[
m4_case(pw_arg,
[less-warnings],[
m4_undefine([PW_LESS_WARNINGS])
AC_CACHE_CHECK([whether it is safe to use -fdiagnostics-show-option],
[ac_cv_safe_to_use_fdiagnostics_show_option_],
[save_CFLAGS="$CFLAGS"
- CFLAGS="-fdiagnostics-show-option ${AM_CFLAGS}"
+ CFLAGS="-fdiagnostics-show-option ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],[])],
[ac_cv_safe_to_use_fdiagnostics_show_option_=yes],
AC_CACHE_CHECK([whether it is safe to use -Wconversion],
[ac_cv_safe_to_use_wconversion_],
[save_CFLAGS="$CFLAGS"
- CFLAGS="-Wconversion ${W_FAIL} -pedantic ${AM_CFLAGS}"
+ dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
+ dnl conversion warnings to all the tarball folks
+ CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdbool.h>
AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons],
[ac_cv_safe_to_use_Wconversion_],
[save_CFLAGS="$CFLAGS"
- CFLAGS="-Wconversion ${W_FAIL} -pedantic ${AM_CFLAGS}"
+ dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
+ dnl conversion warnings to all the tarball folks
+ CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
m4_if(PW_LESS_WARNINGS,[no],[
BASE_WARNINGS_FULL="-Wformat=2 ${W_CONVERSION} -Wstrict-aliasing"
- CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum"
+ CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings"
CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast"
],[
BASE_WARNINGS_FULL="-Wformat ${NO_STRICT_ALIASING}"
])
- BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wextra -Wundef -Wshadow -Wstrict-aliasing ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}"
+ AS_IF([test "${ac_cv_assert}" = "no"],
+ [NO_UNUSED="-Wno-unused-variable -Wno-unused-parameter"])
+
+ BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wextra -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}"
CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL}"
CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long ${CXX_WARNINGS_FULL}"
AC_CACHE_CHECK([whether it is safe to use -Wlogical-op],
[ac_cv_safe_to_use_Wlogical_op_],
[save_CFLAGS="$CFLAGS"
- CFLAGS="${W_FAIL} -pedantic -Wlogical-op ${AM_CFLAGS}"
+ CFLAGS="${W_FAIL} -pedantic -Wlogical-op ${AM_CFLAGS} ${CFLAGS}"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
[[