Hi,
maybe you like this...
"Add m4/wget_manywarnings
This enables (if switched on) basically all warnings for gcc and clang.
Exceptions are explicitly controlled in configure.ac.
To enable by default: create a file '.manywarnings'
Enable explicitly : ./configure --enable-manywarnings
Disable explicitly: ./configure --disable-manywarnings
New warnings of new compiler versions are automatically added.
This module works much faster than the 'manywarnings' module from gnulib.
Created for developers and Continuous Integration."
I just added the WARN_FLAGS to src/microhttpd/Makefile.am, but if you like it
add it also to the other Makefile.am.
It might need some further tuning in configure.ac to enable/disable warnings (I
just copied the code from Wget2 were we ignore certain warning).
Regards, Tim
From 71a8648145861cebde04cebf4de8ce10e21b7904 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim Rühsen?=
Date: Sun, 18 Jun 2017 12:33:08 +0200
Subject: [PATCH] Add m4/wget_manywarnings
This enables (if switched on) basically all warnings for gcc and clang.
Exceptions are explicitly controlled in configure.ac.
To enable by default: create a file '.manywarnings'
Enable explicitly : ./configure --enable-manywarnings
Disable explicitly: ./configure --disable-manywarnings
New warnings of new compiler versions are automatically added.
This module works much faster than the 'manywarnings' module from gnulib.
Created for developers and Continuous Integration.
---
configure.ac | 53
m4/wget_manywarnings.m4| 88 ++
src/microhttpd/Makefile.am | 2 +-
3 files changed, 142 insertions(+), 1 deletion(-)
create mode 100644 m4/wget_manywarnings.m4
diff --git a/configure.ac b/configure.ac
index 443dcf24..b4b28748 100644
--- a/configure.ac
+++ b/configure.ac
@@ -338,6 +338,59 @@ netbsd*)
;;
esac
+
+# enable all possible compiler warnings in WARN_FLAGS
+#
+# to enable by default: create a file '.manywarnings'
+# enable explicitly : ./configure --enable-manywarnings
+# disable explicitly: ./configure --disable-manywarnings
+wget_MANYWARNINGS(WARN_CFLAGS, C)
+
+if test -n "$WARN_CFLAGS"; then
+ if test "$CCNAME" = "gcc"; then
+# Set up list of unwanted warnings
+nw+nw="$nw -Wsystem-headers" # System headers may trigger lot's of useless warnings
+nw="$nw -Wvla" # This project is C99
+nw="$nw -Wstack-protector"
+nw="$nw -Wmissing-field-initializer"
+nw="$nw -Wtraditional"
+nw="$nw -Wtraditional-conversion"
+nw="$nw -Wc++-compat"
+nw="$nw -Wcast-qual"
+nw="$nw -Wconversion"
+nw="$nw -Wsign-conversion"
+nw="$nw -Wunsuffixed-float-constants"
+nw="$nw -Wdeclaration-after-statement" # C89 only, messing up gcc < 5
+if test "$cross_compiling" = yes; then
+ nw="$nw -Wformat"
+fi
+
+# remove unwanted warn flags
+wget_WORD_REMOVE([WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
+
+# add more flags as you like
+WARN_CFLAGS="$WARN_CFLAGS -fdiagnostics-color=always"
+if test "$cross_compiling" = yes; then
+ WARN_CFLAGS="$WARN_CFLAGS -Wno-format"
+fi
+# WARN_CFLAGS="$WARN_CFLAGS -Werror"
+
+ elif test "$CCNAME" = "clang"; then
+# setup flags for this project
+WARN_CFLAGS="$WARN_CFLAGS -Wno-system-headers -Wno-vla -Wno-cast-qual -Wno-padded"
+WARN_CFLAGS="$WARN_CFLAGS -Wno-reserved-id-macro -Wno-sign-conversion -Wno-disabled-macro-expansion"
+WARN_CFLAGS="$WARN_CFLAGS -Wno-documentation -Wno-documentation-unknown-command"
+WARN_CFLAGS="$WARN_CFLAGS -Wno-covered-switch-default"
+
+# remove all flags from WARN_FLAGS that are already in CFLAGS
+# wget_WORD_REMOVE([WARN_CFLAGS], [$WARN_CFLAGS], [$CFLAGS])
+ fi
+
+ AC_SUBST([WARN_CFLAGS])
+fi
+
+
AC_ARG_WITH([threads],
[AS_HELP_STRING([--with-threads=LIB],[choose threading library (posix, w32, auto) [auto]])],
[], [with_threads='auto'])
diff --git a/m4/wget_manywarnings.m4 b/m4/wget_manywarnings.m4
new file mode 100644
index ..61033282
--- /dev/null
+++ b/m4/wget_manywarnings.m4
@@ -0,0 +1,88 @@
+# wget_manywarnings.m4 serial 1
+dnl Copyright (C) 2016 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Tim Ruehsen
+
+# wget_WORD_SET(RESULT, SET, WORDS)
+# --
+# Add each word in WORDS to SET if not already there and store in RESULT.
+# Words separated by whitespace.
+AC_DEFUN([wget_WORD_SET], [
+ ret=$2
+ words=" $2 "
+ for word in $3; do
+if test "${words#*" $word "}" = "$words"; then ret="$ret $word"; fi
+ done
+ $1=$ret
+])
+
+# wget_WORD_REMOVE(RESULT, SET, WORDS)
+# --
+# Remove each word in WORDS from SET and store in R