[ovs-dev] [PATCH] configure: New --enable-sparse option to enable sparse checking by default.
Ben Pfaff
blp at ovn.org
Thu Jan 11 23:49:24 UTC 2018
Until now, "make" called sparse to do checking only if C=1 was passed on
the command line. It was easy for developers to forget to specify that.
This commit adds another option: specifying --enable-sparse on the
configure command line enables sparse checking by default. (It can still
be disabled with C=0.)
Requested-by: Justin Pettit <jpettit at ovn.org>
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
Documentation/intro/install/general.rst | 10 +++++++---
Makefile.am | 4 ++++
NEWS | 1 +
acinclude.m4 | 8 +++++++-
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/Documentation/intro/install/general.rst b/Documentation/intro/install/general.rst
index 1485bdc19980..f17dc8d4bdbe 100644
--- a/Documentation/intro/install/general.rst
+++ b/Documentation/intro/install/general.rst
@@ -306,6 +306,13 @@ generated by the build. For example::
$ ./configure --enable-Werror
+If you're building with GCC, then, for improved warnings, install ``sparse``
+(see "Prerequisites") and enable it for the build by adding
+``--enable-sparse``. Use this with ``--enable-Werror`` to avoid missing both
+compiler and ``sparse`` warnings, e.g.::
+
+ $ ./configure --enable-Werror --enable-sparse
+
To build with gcov code coverage support, add ``--enable-coverage``::
$ ./configure --enable-coverage
@@ -349,9 +356,6 @@ Building
$ make -C _gcc
$ make -C _clang
- For improved warnings if you installed ``sparse`` (see "Prerequisites"), add
- ``C=1`` to the command line.
-
.. note::
Some versions of Clang and ccache are not completely compatible. If you
see unusual warnings when you use both together, consider disabling
diff --git a/Makefile.am b/Makefile.am
index d7cfdcd52a98..fca338bd7bda 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -129,6 +129,10 @@ check_SCRIPTS =
pkgconfig_DATA =
FLAKE8_PYFILES =
+if ENABLE_SPARSE_BY_DEFAULT
+C ?= 1
+endif
+
scriptsdir = $(pkgdatadir)/scripts
completiondir = $(sysconfdir)/bash_completion.d
pkgconfigdir = $(libdir)/pkgconfig
diff --git a/NEWS b/NEWS
index fd1a17942fbf..2b940bd4904a 100644
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,7 @@ Post-v2.8.0
* Datapath IDs may now be specified as 0x1 (etc.) instead of 16 digits.
* Configuring a controller, or unconfiguring all controllers, now deletes
all groups and meters (as well as all flows).
+ - New --enable-sparse configure option enables "sparse" checking by default.
v2.8.0 - 31 Aug 2017
--------------------
diff --git a/acinclude.m4 b/acinclude.m4
index 0eeb1bf89815..16a57a341b7d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1005,7 +1005,13 @@ AC_DEFUN([OVS_ENABLE_SPARSE],
: ${SPARSE=sparse}
AC_SUBST([SPARSE])
AC_CONFIG_COMMANDS_PRE(
- [CC='$(if $(C),env REAL_CC="'"$CC"'" CHECK="$(SPARSE) $(SPARSE_WERROR) -I $(top_srcdir)/include/sparse $(SPARSEFLAGS) $(SPARSE_EXTRA_INCLUDES) " cgcc $(CGCCFLAGS),'"$CC"')'])])
+ [CC='$(if $(C:0=),env REAL_CC="'"$CC"'" CHECK="$(SPARSE) $(SPARSE_WERROR) -I $(top_srcdir)/include/sparse $(SPARSEFLAGS) $(SPARSE_EXTRA_INCLUDES) " cgcc $(CGCCFLAGS),'"$CC"')'])
+
+ AC_ARG_ENABLE(
+ [sparse],
+ [AC_HELP_STRING([--enable-sparse], [Run "sparse" by default])],
+ [], [enable_sparse=no])
+ AM_CONDITIONAL([ENABLE_SPARSE_BY_DEFAULT], [test $enable_sparse = yes])])
dnl OVS_CTAGS_IDENTIFIERS
dnl
--
2.10.2
More information about the dev
mailing list