configure: simplify warning flags detection
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 18 Feb 2020 18:14:22 +0000 (13:14 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 17 Mar 2020 21:22:54 +0000 (17:22 -0400)
commit28ba44ad9ca14153e96c94a9100423ea224c1af3
tree54378457686c12edfc4f54231ee82caeda6ee838
parent28c8edae95b13ad909094fdc6ebc44ab4e10018a
configure: simplify warning flags detection

We currently use the AX_COMPILER_FLAGS macro to detect the warning flags
that the current compiler supports.  It works, but is quite invasive.
It unconditionally enables a bunch of warnings we don't want, which
forces us to disable them with many -Wno-foo switches.

Instead of using AX_COMPILER_FLAGS, we can use the slightly lower lever
macro AX_APPEND_COMPILE_FLAGS to achieve our goal of detecting which
warning flags are supported.  This is what we ended up using in
lttng-tools (a completely unrelated project, but that has a suspiciously
high ratio of contributors in common with Babeltrace).

I looked in our git history to see which warning flags were mentioned in
commit messages.  I have added the flags that did find actual problems
and are not enabled by default to the AX_APPEND_COMPILE_FLAGS invocation.
I have also added the flags that AX_COMPILER_FLAGS did provide, which we
didn't need to disable.

The --{enable,disable}-Werror flag is added using an explicit
AC_ARG_ENABLE.  In lttng-tools, it was decided to _not_ have -Werror by
default, so I suggest we do the same in Babeltrace, for consistency
(although it saddens me very much).  Developers who want to build with
-Werror will need to pass --enable-Werror.

Note that with this patch, we lose the following configure switch, that
is provided by AX_COMPILER_FLAGS:

  --enable-compile-warnings=[no/yes/error]

Change-Id: If968f7385a7f5c48d27f402c76bc26241a8f505a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3209
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Michael Jeanson <mjeanson@efficios.com>
configure.ac
m4/ax_compiler_flags.m4 [deleted file]
m4/ax_compiler_flags_cflags.m4 [deleted file]
m4/ax_compiler_flags_gir.m4 [deleted file]
m4/ax_compiler_flags_ldflags.m4 [deleted file]
This page took 0.024118 seconds and 4 git commands to generate.