[PATCH 05/17] lib/thread: add macro for debug printing of threading

Subject: [PATCH 05/17] lib/thread: add macro for debug printing of threading

Date: Tue, 4 Sep 2018 07:57:11 -0300

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


This is analogous to DEBUG_DATABASE_SANITY, and is intended to help
debugging and to help users submit bug reports.
---
 lib/notmuch-private.h | 1 +
 lib/thread.cc         | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index bd9d2747..02cc0e09 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -56,6 +56,7 @@ NOTMUCH_BEGIN_DECLS
 
 #ifdef DEBUG
 # define DEBUG_DATABASE_SANITY 1
+# define DEBUG_THREADING 1
 # define DEBUG_QUERY 1
 #endif
 
diff --git a/lib/thread.cc b/lib/thread.cc
index b599a97d..6d15c49b 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -24,6 +24,12 @@
 #include <gmime/gmime.h>
 #include <glib.h> /* GHashTable */
 
+#ifdef DEBUG_THREADING
+#define THREAD_DEBUG(format, ...) fprintf(stderr, format " (%s).\n", ##__VA_ARGS__, __location__)
+#else
+#define THREAD_DEBUG(format, ...) do {} while (0) /* ignored */
+#endif
+
 #define EMPTY_STRING(s) ((s)[0] == '\0')
 
 struct _notmuch_thread {
-- 
2.11.0

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: