2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 13:27:59 +00:00

configure: New --enable-sparse option to enable sparse checking by default.

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@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
This commit is contained in:
Ben Pfaff 2018-01-11 15:49:24 -08:00
parent 2daae85a06
commit d4042a708f
4 changed files with 19 additions and 4 deletions

View File

@ -312,6 +312,13 @@ generated by the build. For example::
$ ./configure --enable-Werror $ ./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``:: To build with gcov code coverage support, add ``--enable-coverage``::
$ ./configure --enable-coverage $ ./configure --enable-coverage
@ -355,9 +362,6 @@ Building
$ make -C _gcc $ make -C _gcc
$ make -C _clang $ make -C _clang
For improved warnings if you installed ``sparse`` (see "Prerequisites"), add
``C=1`` to the command line.
.. note:: .. note::
Some versions of Clang and ccache are not completely compatible. If you Some versions of Clang and ccache are not completely compatible. If you
see unusual warnings when you use both together, consider disabling see unusual warnings when you use both together, consider disabling

View File

@ -129,6 +129,10 @@ check_SCRIPTS =
pkgconfig_DATA = pkgconfig_DATA =
FLAKE8_PYFILES = FLAKE8_PYFILES =
if ENABLE_SPARSE_BY_DEFAULT
C ?= 1
endif
scriptsdir = $(pkgdatadir)/scripts scriptsdir = $(pkgdatadir)/scripts
completiondir = $(sysconfdir)/bash_completion.d completiondir = $(sysconfdir)/bash_completion.d
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig

1
NEWS
View File

@ -46,6 +46,7 @@ Post-v2.8.0
* Datapath IDs may now be specified as 0x1 (etc.) instead of 16 digits. * Datapath IDs may now be specified as 0x1 (etc.) instead of 16 digits.
* Configuring a controller, or unconfiguring all controllers, now deletes * Configuring a controller, or unconfiguring all controllers, now deletes
all groups and meters (as well as all flows). 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 v2.8.0 - 31 Aug 2017
-------------------- --------------------

View File

@ -1005,7 +1005,13 @@ AC_DEFUN([OVS_ENABLE_SPARSE],
: ${SPARSE=sparse} : ${SPARSE=sparse}
AC_SUBST([SPARSE]) AC_SUBST([SPARSE])
AC_CONFIG_COMMANDS_PRE( 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 OVS_CTAGS_IDENTIFIERS
dnl dnl