[ovs-dev] [PATCH] configure: Make --enable-Werror turn sparse warnings into errors.
Stokes, Ian
ian.stokes at intel.com
Thu Jan 11 22:15:12 UTC 2018
> Until now, when "sparse" reported a warning, it didn't fail the build for
> that file, even when the project was configured with --enable-Werror,
> which made it easy to miss warnings. This commit fixes the problem.
>
> Reported-by: "Stokes, Ian" <ian.stokes at intel.com>
> Signed-off-by: Ben Pfaff <blp at ovn.org>
Thanks for the patch Ben, works as expected now.
Acked-by: Ian Stokes <ian.stokes at intel.com>
Tested-by: Ian Stokes <ian.stokes at intel.com>
> ---
> acinclude.m4 | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/acinclude.m4 b/acinclude.m4 index 1179a40774f3..0eeb1bf89815
> 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -32,7 +32,15 @@ AC_DEFUN([OVS_ENABLE_WERROR],
> else
> FLAKE8_WERROR=-
> fi
> - AC_SUBST([FLAKE8_WERROR])])
> + AC_SUBST([FLAKE8_WERROR])
> +
> + # If --enable-Werror is specified, fail the build on sparse warnings.
> + if test "X$enable_Werror" = Xyes; then
> + SPARSE_WERROR=-Wsparse-error
> + else
> + SPARSE_WERROR=
> + fi
> + AC_SUBST([SPARSE_WERROR])])
>
> dnl OVS_CHECK_LINUX
> dnl
> @@ -997,7 +1005,7 @@ AC_DEFUN([OVS_ENABLE_SPARSE],
> : ${SPARSE=sparse}
> AC_SUBST([SPARSE])
> AC_CONFIG_COMMANDS_PRE(
> - [CC='$(if $(C),env REAL_CC="'"$CC"'" CHECK="$(SPARSE) -I
> $(top_srcdir)/include/sparse $(SPARSEFLAGS) $(SPARSE_EXTRA_INCLUDES) "
> cgcc $(CGCCFLAGS),'"$CC"')'])])
> + [CC='$(if $(C),env REAL_CC="'"$CC"'" CHECK="$(SPARSE)
> + $(SPARSE_WERROR) -I $(top_srcdir)/include/sparse $(SPARSEFLAGS)
> + $(SPARSE_EXTRA_INCLUDES) " cgcc $(CGCCFLAGS),'"$CC"')'])])
>
> dnl OVS_CTAGS_IDENTIFIERS
> dnl
> --
> 2.10.2
More information about the dev
mailing list