[Spice-devel] [spice-server v2] build-sys: Improve ENABLE_EXTRA_CHECK setting
Christophe Fergeau
cfergeau at redhat.com
Tue Sep 12 10:48:27 UTC 2017
Currently, ENABLE_EXTRA_CHECK is defined to be 0 or 1, and has to be
defined this way, otherwise this will break display-channel.c
compilation.
This is different from most AC_DEFINE() preprocessor constants which are
usually either set to 1, or unset.
This commit switches ENABLE_EXTRA_CHECK setting in configure.ac to the
usual way, and defines a second constant to 0/1 depending on whether
it's set or not in display-channel.c.
Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
Changes since v1:
- adjusted documentation string for HAVE_EXTRA_CHECKS
- reuse HAVE_EXTRA_CHECKS symbol rather than introducing an extra one
configure.ac | 6 +++---
server/display-channel.c | 6 +++++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 483dbfdf8..dd15a787c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -237,9 +237,9 @@ AC_ARG_ENABLE([extra-checks],
AS_HELP_STRING([--enable-extra-checks=@<:@yes/no@:>@],
[Enable expensive checks @<:@default=no@:>@]))
AM_CONDITIONAL(ENABLE_EXTRA_CHECKS, test "$enable_extra_checks" = "yes")
-AC_DEFINE_UNQUOTED([ENABLE_EXTRA_CHECKS],
- [$(test "x$enable_extra_checks" = xyes && echo 1 || echo 0)],
- [Define to 1 to enable extra checks on code otherwise define to 0])
+AS_IF([test "x$enable_extra_checks" = xyes],
+ AC_DEFINE([ENABLE_EXTRA_CHECKS], [1],
+ [Whether to enable extra runtime consistency checks or not]))
dnl ===========================================================================
dnl check compiler flags
diff --git a/server/display-channel.c b/server/display-channel.c
index f7e36dbb4..4eb2f43fb 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -80,6 +80,10 @@ display_channel_set_property(GObject *object,
}
}
+#ifndef HAVE_EXTRA_CHECKS
+#define HAVE_EXTRA_CHECKS 0
+#endif
+
static void
display_channel_finalize(GObject *object)
{
@@ -88,7 +92,7 @@ display_channel_finalize(GObject *object)
display_channel_destroy_surfaces(self);
image_cache_reset(&self->priv->image_cache);
- if (ENABLE_EXTRA_CHECKS) {
+ if (HAVE_EXTRA_CHECKS) {
unsigned int count;
_Drawable *drawable;
Stream *stream;
--
2.13.5
More information about the Spice-devel
mailing list