[Spice-commits] common/log.h configure.ac m4/spice-deps.m4

Frediano Ziglio fziglio at kemper.freedesktop.org
Mon Mar 19 14:48:26 UTC 2018


 common/log.h     |    6 ++++++
 configure.ac     |    1 +
 m4/spice-deps.m4 |   14 ++++++++++++++
 3 files changed, 21 insertions(+)

New commits:
commit 4c2d0e977272c5540634d24f485dd64c424f6748
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Mar 19 13:39:27 2018 +0000

    Add --enable-extra-checks option
    
    Allow to enable code to do additional or expensive checks.
    The option should be used by higher level libraries.
    By default the option is disabled.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>

diff --git a/common/log.h b/common/log.h
index 06d48d2..e0fd34b 100644
--- a/common/log.h
+++ b/common/log.h
@@ -93,6 +93,12 @@ void spice_log(GLogLevelFlags log_level,
     }                                                   \
 } G_STMT_END
 
+#if ENABLE_EXTRA_CHECKS
+enum { spice_extra_checks = 1 };
+#else
+enum { spice_extra_checks = 0 };
+#endif
+
 SPICE_END_DECLS
 
 #endif /* H_SPICE_LOG */
diff --git a/configure.ac b/configure.ac
index 3542161..3da85de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,6 +27,7 @@ fi
 AM_PROG_CC_C_O
 
 SPICE_CHECK_SYSDEPS
+SPICE_EXTRA_CHECKS
 
 AC_ARG_ENABLE([alignment-checks],
   AS_HELP_STRING([--enable-alignment-checks],
diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 68e3091..a6f4b7b 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -23,6 +23,20 @@ AC_DEFUN([SPICE_PRINT_MESSAGES],[
 ])
 
 
+# SPICE_EXTRA_CHECKS()
+# --------------------
+# Check for --enable-extra-checks option
+# --------------------
+AC_DEFUN([SPICE_EXTRA_CHECKS],[
+AC_ARG_ENABLE([extra-checks],
+               AS_HELP_STRING([--enable-extra-checks=@<:@yes/no@:>@],
+                              [Enable expensive checks @<:@default=no@:>@]))
+AM_CONDITIONAL(ENABLE_EXTRA_CHECKS, test "x$enable_extra_checks" = "xyes")
+AS_IF([test "x$enable_extra_checks" = "xyes"],
+      [AC_DEFINE([ENABLE_EXTRA_CHECKS], 1, [Enable extra checks on code])])
+])
+
+
 # SPICE_CHECK_SYSDEPS()
 # ---------------------
 # Checks for header files and library functions needed by spice-common.


More information about the Spice-commits mailing list