From f4ce27f29012cbaa3eafb8586fb27a6098acd873 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 01 Nov 2017 16:21:02 -0400 Subject: configure.ac: Enable many more warnings --- (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index b15f168..6a65990 100644 --- a/configure.ac +++ b/configure.ac @@ -37,19 +37,31 @@ AX_CHECK_COMPILE_FLAG([-std=c11], [CFLAGS="${CFLAGS} -std=c11"], [ AX_CHECK_COMPILE_FLAG([-std=c1x], [CFLAGS="${CFLAGS} -std=c1x"], [], []) ], []) -# Consider also: -# * -Wchkp -# * -Wformat=2 -# * -Wnull-dereference -# * -Winit-self -# * -Wmissing-include-dirs -# * etc. -# Cf. and -# AX_CFLAGS_WARN_ALL() dnl Adds -Wall or equivalent AX_CHECK_COMPILE_FLAG([-Wpedantic], [AX_APPEND_FLAG([-Wpedantic])]) AX_CHECK_COMPILE_FLAG([-Wextra], [AX_APPEND_FLAG([-Wextra])]) +AC_ARG_ENABLE([gcc-warnings], + [AS_HELP_STRING([--enable-gcc-warnings], [turn on many GCC warnings])], + [case "${enableval}" in yes|no);; *) AC_MSG_ERROR( + [bad value ${enableval} for gcc-warnings option]);; esac], + [ + gcc_warnings=no + gl_GCC_VERSION_IFELSE([4], [6], + [test -d "${srcdir}/.git" && gcc_warnings=yes]) + ] +) +if test "x${gcc_warnings}" = 'xyes'; then + nowarns='' + nowarns="${nowarns} -Wsystem-headers" + gl_MANYWARN_ALL_GCC([warns]) + gl_MANYWARN_COMPLEMENT([warns], [${warns}], [${nowarns}]) + for warn in ${warns}; do + gl_WARN_ADD([${warn}]) + done + AC_SUBST([WARN_CFLAGS]) +fi + AX_CHECK_COMPILE_FLAG([-fdiagnostics-color=auto], [AX_APPEND_FLAG([-fdiagnostics-color=auto])]) -- cgit v0.9.1