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" <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
---
 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

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to