diff mbox series

[v2,for-3.2,v2,19/30] slirp: always build with debug statements

Message ID 20181121220647.18844-20-marcandre.lureau@redhat.com
State New
Headers show
Series slirp: make it again a standalone project | expand

Commit Message

Marc-André Lureau Nov. 21, 2018, 10:06 p.m. UTC
Make debug statements condiitonal only on slirp_debug flags, instead
of the pre-processor DEBUG blocks, as it may introduce breakage
easily, since the debug code isn't always compiled.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 slirp/debug.h | 15 +++------------
 slirp/misc.c  |  6 +++++-
 2 files changed, 8 insertions(+), 13 deletions(-)

Comments

Samuel Thibault Nov. 21, 2018, 10:35 p.m. UTC | #1
Marc-André Lureau, le jeu. 22 nov. 2018 02:06:36 +0400, a ecrit:
> Make debug statements condiitonal only on slirp_debug flags, instead
> of the pre-processor DEBUG blocks, as it may introduce breakage
> easily, since the debug code isn't always compiled.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Applied to my tree, thanks!
diff mbox series

Patch

diff --git a/slirp/debug.h b/slirp/debug.h
index ca3a4b04da..ff920f0b87 100644
--- a/slirp/debug.h
+++ b/slirp/debug.h
@@ -5,9 +5,8 @@ 
  * terms and conditions of the copyright.
  */
 
-//#define DEBUG 1
-
-#ifdef DEBUG
+#ifndef DEBUG_H_
+#define DEBUG_H_
 
 #define DBG_CALL 0x1
 #define DBG_MISC 0x2
@@ -50,12 +49,4 @@  extern int slirp_debug;
     }                                           \
 } while (0)
 
-#else
-
-#define DEBUG_CALL(fmt, ...)
-#define DEBUG_ARG(fmt, ...)
-#define DEBUG_ARGS(fmt, ...)
-#define DEBUG_MISC(fmt, ...)
-#define DEBUG_ERROR(fmt, ...)
-
-#endif
+#endif /* DEBUG_H_ */
diff --git a/slirp/misc.c b/slirp/misc.c
index 6ee0ff0231..0b7ec89595 100644
--- a/slirp/misc.c
+++ b/slirp/misc.c
@@ -12,9 +12,13 @@ 
 #include "qemu/main-loop.h"
 
 #ifdef DEBUG
-int slirp_debug = DBG_CALL|DBG_MISC|DBG_ERROR;
+#define SLIRP_DEBUG (DBG_CALL | DBG_MISC | DBG_ERROR)
+#else
+#define SLIRP_DEBUG 0
 #endif
 
+int slirp_debug = SLIRP_DEBUG;
+
 inline void
 insque(void *a, void *b)
 {