diff options
author | Steffan Karger | 2018-02-01 16:45:21 +0100 |
---|---|---|
committer | Gert Doering | 2018-02-20 10:22:41 +0100 |
commit | adbf68c00bf40089489c5e039138f855fc5e2392 (patch) | |
tree | c92c765502a8dd39d375dd715777bea134353a8f /configure.ac | |
parent | c215c58f2393e881e16f9805549316a1e257a682 (diff) | |
download | openvpn-adbf68c00bf40089489c5e039138f855fc5e2392.zip openvpn-adbf68c00bf40089489c5e039138f855fc5e2392.tar.gz |
Enable stricter compiler warnings by default
This by default enables the compiler warnings one could previously
enable using the --enable-strict configure option. I think it is
okay to do so now, because we've taken care of many warnings in the
more standard builds. (Most of those were totally harmless, but they
prevented us from spotting new more serious mistakes.)
The --enable-strict flag now enables two extra warning flags that I
think can be useful:
-Wsign-compare warns when the compiler promotes a signed type to
unsigned before comparing, which can lead to unexpected behaviour.
-Wuninitialized adds extra warnings about usage of uninitialized variables
or struct elements.
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20180201154521.7642-1-steffan@karger.me>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16426.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 2cbf335..1496fd5 100644 --- a/configure.ac +++ b/configure.ac @@ -1292,13 +1292,23 @@ if test "${enable_pkcs11}" = "yes"; then ) fi +AX_CHECK_COMPILE_FLAG( + [-Wno-unused-function], + [CFLAGS="-Wno-unused-function ${CFLAGS}"] +) +AX_CHECK_COMPILE_FLAG( + [-Wno-unused-parameter], + [CFLAGS="-Wno-unused-parameter ${CFLAGS}"] +) +AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="-Wall ${CFLAGS}"]) + if test "${enable_pedantic}" = "yes"; then enable_strict="yes" CFLAGS="${CFLAGS} -pedantic" AC_DEFINE([PEDANTIC], [1], [Enable pedantic mode]) fi if test "${enable_strict}" = "yes"; then - CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" + CFLAGS="${CFLAGS} -Wsign-compare -Wuninitialized" fi if test "${enable_werror}" = "yes"; then CFLAGS="${CFLAGS} -Werror" |