shithub: aubio

Download patch

ref: 63fc1dfb73714cac40869e4469cb6eac1b37beab
parent: b1ed6ce4dd48b7328ecba01c73010a5ea7d12c1c
parent: cf31ff1ab7505063cf41b960c3cd56d602839082
author: Paul Brossier <piem@piem.org>
date: Sat Jun 29 12:57:24 EDT 2019

Merge branch 'feature/debugmode'

--- a/src/aubio_priv.h
+++ b/src/aubio_priv.h
@@ -236,14 +236,25 @@
 #define AUBIO_ERR(...)               aubio_log(AUBIO_LOG_ERR, "AUBIO ERROR: " __VA_ARGS__)
 #define AUBIO_INF(...)               aubio_log(AUBIO_LOG_INF, "AUBIO INFO: " __VA_ARGS__)
 #define AUBIO_MSG(...)               aubio_log(AUBIO_LOG_MSG, __VA_ARGS__)
-#define AUBIO_DBG(...)               aubio_log(AUBIO_LOG_DBG, __VA_ARGS__)
+#define _AUBIO_DBG(...)              aubio_log(AUBIO_LOG_DBG, __VA_ARGS__)
 #define AUBIO_WRN(...)               aubio_log(AUBIO_LOG_WRN, "AUBIO WARNING: " __VA_ARGS__)
 #else
 #define AUBIO_ERR(format, args...)   aubio_log(AUBIO_LOG_ERR, "AUBIO ERROR: " format , ##args)
 #define AUBIO_INF(format, args...)   aubio_log(AUBIO_LOG_INF, "AUBIO INFO: " format , ##args)
 #define AUBIO_MSG(format, args...)   aubio_log(AUBIO_LOG_MSG, format , ##args)
-#define AUBIO_DBG(format, args...)   aubio_log(AUBIO_LOG_DBG, format , ##args)
+#define _AUBIO_DBG(format, args...)  aubio_log(AUBIO_LOG_DBG, format , ##args)
 #define AUBIO_WRN(format, args...)   aubio_log(AUBIO_LOG_WRN, "AUBIO WARNING: " format, ##args)
+#endif
+
+#ifdef DEBUG
+#define AUBIO_DBG _AUBIO_DBG
+#else
+// disable debug output
+#ifdef HAVE_C99_VARARGS_MACROS
+#define AUBIO_DBG(...)               {}
+#else
+#define AUBIO_DBG(format, args...)   {}
+#endif
 #endif
 
 #define AUBIO_ERROR   AUBIO_ERR
--- a/wscript
+++ b/wscript
@@ -45,6 +45,9 @@
             help = 'whether to compile with (--build-type=release)' \
                     ' or without (--build-type=debug)' \
                     ' compiler opimizations [default: release]')
+    ctx.add_option('--debug', action = 'store_const',
+            dest = 'build_type', const = 'debug',
+            help = 'build in debug mode (see --build-type)')
     add_option_enable_disable(ctx, 'fftw3f', default = False,
             help_str = 'compile with fftw3f instead of ooura (recommended)',
             help_disable_str = 'do not compile with fftw3f')