telepathy-gabble: Remove --disable-debug option

Simon McVittie smcv at kemper.freedesktop.org
Mon Nov 4 13:14:47 CET 2013


Module: telepathy-gabble
Branch: master
Commit: 980e1f402485eac690627425e45b6442baad7553
URL:    http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=980e1f402485eac690627425e45b6442baad7553

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Nov  1 16:17:19 2013 +0000

Remove --disable-debug option

It makes the executable basically impossible to debug and we don't
recommend that anyone uses it.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=26609
Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>

---

 Makefile.am                 |    2 +-
 configure.ac                |   10 ----------
 lib/gibber/gibber-debug.c   |    4 ----
 lib/gibber/gibber-debug.h   |   16 ----------------
 src/conn-aliasing.c         |    2 --
 src/debug.h                 |   36 ++++--------------------------------
 src/gabble.c                |    8 --------
 src/roster.c                |   14 ++------------
 tests/twisted/Makefile.am   |    7 -------
 tests/twisted/test-debug.py |    8 --------
 10 files changed, 7 insertions(+), 100 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 288478b..516610d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4
 
 SUBDIRS = docs tools extensions lib src data m4 plugins tests gabble
 
-DISTCHECK_CONFIGURE_FLAGS = --disable-debug --enable-gtk-doc
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
 
 CLEANFILES = FIXME.out
 
diff --git a/configure.ac b/configure.ac
index ee589bc..317be20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,10 +149,6 @@ if test -n "$with_ca_certificates"; then
     fi
 fi
 
-AC_ARG_ENABLE(debug,
-  AC_HELP_STRING([--disable-debug],[compile without debug code]),
-    enable_debug=$enableval, enable_debug=yes )
-
 ifelse(gabble_nano_version, 0,
     [ # Gabble is version x.y.z - disable coding style checks by default
 AC_ARG_ENABLE(coding-style-checks,
@@ -167,11 +163,6 @@ AC_ARG_ENABLE(coding-style-checks,
     [ENABLE_CODING_STYLE_CHECKS=$enableval], [ENABLE_CODING_STYLE_CHECKS=yes])
     ])
 
-if test x$enable_debug = xyes; then
-  AC_DEFINE(ENABLE_DEBUG, [], [Enable debug code])
-fi
-AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = xyes])
-
 AC_SUBST([ENABLE_CODING_STYLE_CHECKS])
 
 AC_ARG_ENABLE([installed-tests],
@@ -451,7 +442,6 @@ Configure summary:
         Compiler Flags..............:  ${CFLAGS} ${ERROR_CFLAGS}
         Prefix......................:  ${prefix}
         Coding style checks.........:  ${ENABLE_CODING_STYLE_CHECKS}
-        Enable debug................:  ${enable_debug}
         Python tests................:  ${tests_enabled}
         Install unit tests..........:  ${installed_tests}
 
diff --git a/lib/gibber/gibber-debug.c b/lib/gibber/gibber-debug.c
index 29b74f4..69cf1a6 100644
--- a/lib/gibber/gibber-debug.c
+++ b/lib/gibber/gibber-debug.c
@@ -6,8 +6,6 @@
 
 #include "gibber-debug.h"
 
-#ifdef ENABLE_DEBUG
-
 static DebugFlags flags = 0;
 static gboolean initialized = FALSE;
 
@@ -96,5 +94,3 @@ gibber_debug_stanza (DebugFlags flag,
     }
 }
 #endif
-
-#endif
diff --git a/lib/gibber/gibber-debug.h b/lib/gibber/gibber-debug.h
index 8c813bd..7bc7f18 100644
--- a/lib/gibber/gibber-debug.h
+++ b/lib/gibber/gibber-debug.h
@@ -12,8 +12,6 @@
 
 G_BEGIN_DECLS
 
-#ifdef ENABLE_DEBUG
-
 typedef enum
 {
   DEBUG_TRANSPORT         = 1 << 0,
@@ -59,20 +57,6 @@ void gibber_debug_stanza (DebugFlags flag, GibberXmppStanza *stanza,
 
 #endif /* DEBUG_FLAG */
 
-#else /* ENABLE_DEBUG */
-
-#ifdef DEBUG_FLAG
-
-#define DEBUG(format, ...) G_STMT_START { } G_STMT_END
-
-#define DEBUG_STANZA(stanza, format, ...) G_STMT_START { } G_STMT_END
-
-#define DEBUGGING (0)
-
-#endif /* DEBUG_FLAG */
-
-#endif /* ENABLE_DEBUG */
-
 G_END_DECLS
 
 #endif
diff --git a/src/conn-aliasing.c b/src/conn-aliasing.c
index d7870ee..e5bef80 100644
--- a/src/conn-aliasing.c
+++ b/src/conn-aliasing.c
@@ -470,7 +470,6 @@ nick_publish_msg_reply_cb (GabbleConnection *conn,
                            GObject *object,
                            gpointer user_data)
 {
-#ifdef ENABLE_DEBUG
   GError *error = NULL;
 
   if (wocky_stanza_extract_errors (reply_msg, NULL, &error, NULL, NULL))
@@ -480,7 +479,6 @@ nick_publish_msg_reply_cb (GabbleConnection *conn,
 
       g_clear_error (&error);
     }
-#endif
 }
 
 static gboolean
diff --git a/src/debug.h b/src/debug.h
index 83bf432..6566eda 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -73,49 +73,21 @@ G_END_DECLS
   gabble_log (G_LOG_LEVEL_INFO, DEBUG_FLAG, "%s (%s): " format, \
       G_STRFUNC, G_STRLOC, ##__VA_ARGS__)
 
-#ifdef ENABLE_DEBUG
-#   define DEBUG(format, ...) \
+#define DEBUG(format, ...) \
       gabble_log (G_LOG_LEVEL_DEBUG, DEBUG_FLAG, "%s (%s): " format, \
           G_STRFUNC, G_STRLOC, ##__VA_ARGS__)
-#   define DEBUGGING gabble_debug_flag_is_set (DEBUG_FLAG)
+#define DEBUGGING gabble_debug_flag_is_set (DEBUG_FLAG)
 
-#   define STANZA_DEBUG(st, s) \
+#define STANZA_DEBUG(st, s) \
       NODE_DEBUG (wocky_stanza_get_top_node (st), s)
 
-#   define NODE_DEBUG(n, s) \
+#define NODE_DEBUG(n, s) \
     G_STMT_START { \
       gchar *debug_tmp = wocky_node_to_string (n); \
       gabble_log (G_LOG_LEVEL_DEBUG, DEBUG_FLAG, "%s: %s:\n%s", G_STRFUNC, s, debug_tmp); \
       g_free (debug_tmp); \
     } G_STMT_END
 
-#else /* !defined (ENABLE_DEBUG) */
-static inline void
-DEBUG (
-    const gchar *format,
-    ...)
-{
-}
-
-#   define DEBUGGING 0
-
-static inline void
-STANZA_DEBUG (
-    WockyStanza *stanza,
-    const gchar *format,
-    ...)
-{
-}
-
-static inline void
-NODE_DEBUG (
-    WockyNode *node,
-    const gchar *format,
-    ...)
-{
-}
-#endif /* !defined (ENABLE_DEBUG) */
-
 #endif /* DEBUG_FLAG */
 
 #endif /* __DEBUG_H__ */
diff --git a/src/gabble.c b/src/gabble.c
index e7e4da4..64c6bf4 100644
--- a/src/gabble.c
+++ b/src/gabble.c
@@ -44,7 +44,6 @@ construct_cm (void)
       GABBLE_TYPE_CONNECTION_MANAGER, NULL);
 }
 
-#ifdef ENABLE_DEBUG
 static TpDebugSender *debug_sender = NULL;
 
 static void
@@ -102,9 +101,6 @@ log_handler (const gchar *log_domain,
     log_to_debug_sender (log_domain, log_level, message);
 }
 
-#endif
-
-
 void
 gabble_init (void)
 {
@@ -148,7 +144,6 @@ gabble_main (int argc,
   g_log_set_always_fatal (fatal_mask);
 #endif
 
-#ifdef ENABLE_DEBUG
   gabble_debug_set_flags_from_env ();
 
   stamp_logs = (g_getenv ("GABBLE_TIMING") != NULL);
@@ -168,7 +163,6 @@ gabble_main (int argc,
 
   if (g_getenv ("GABBLE_PERSIST") != NULL)
     tp_debug_set_persistent (TRUE);
-#endif
 
   loader = gabble_plugin_loader_dup ();
 
@@ -179,10 +173,8 @@ gabble_main (int argc,
 
   g_object_unref (loader);
 
-#ifdef ENABLE_DEBUG
   g_log_set_default_handler (g_log_default_handler, NULL);
   g_object_unref (debug_sender);
-#endif
 
   wocky_deinit ();
 
diff --git a/src/roster.c b/src/roster.c
index 4c7300b..aa07a60 100644
--- a/src/roster.c
+++ b/src/roster.c
@@ -728,8 +728,6 @@ _gabble_roster_item_update (GabbleRoster *roster,
   return item;
 }
 
-
-#ifdef ENABLE_DEBUG
 static void
 _gabble_roster_item_dump_group (gpointer k,
     gpointer v,
@@ -768,8 +766,6 @@ _gabble_roster_item_dump (GabbleRosterItem *item)
 
   return g_string_free (str, FALSE);
 }
-#endif /* ENABLE_DEBUG */
-
 
 static WockyStanza *
 _gabble_roster_message_new (GabbleRoster *roster,
@@ -1155,14 +1151,13 @@ process_roster (
 
       item = _gabble_roster_item_update (roster, handle, item_node,
                                          google_roster, &nickname_updated);
-#ifdef ENABLE_DEBUG
+
       if (DEBUGGING)
         {
           gchar *dump = _gabble_roster_item_dump (item);
           DEBUG ("jid: %s, %s", jid, dump);
           g_free (dump);
         }
-#endif
 
       if (nickname_updated)
         g_array_append_val (updated_nicknames, handle);
@@ -2027,14 +2022,12 @@ roster_item_apply_edits (GabbleRoster *roster,
 
   memcpy (&edited_item, item, sizeof (GabbleRosterItem));
 
-#ifdef ENABLE_DEBUG
   if (DEBUGGING)
     {
       gchar *dump = _gabble_roster_item_dump (&edited_item);
       DEBUG ("Before, contact#%u: %s", contact, dump);
       g_free (dump);
     }
-#endif
 
   if (edits->create)
     {
@@ -2110,7 +2103,6 @@ roster_item_apply_edits (GabbleRoster *roster,
   if (edits->add_to_groups != NULL || edits->remove_from_groups != NULL ||
       edits->remove_from_all_other_groups)
     {
-#ifdef ENABLE_DEBUG
       if (DEBUGGING)
         {
           if (edits->add_to_groups != NULL)
@@ -2142,7 +2134,7 @@ roster_item_apply_edits (GabbleRoster *roster,
               DEBUG ("Not removing from any groups");
             }
         }
-#endif
+
       edited_item.groups = g_hash_table_new_full (g_str_hash, g_str_equal,
           g_free, NULL);
 
@@ -2184,14 +2176,12 @@ roster_item_apply_edits (GabbleRoster *roster,
       edited_item.subscription = GABBLE_ROSTER_SUBSCRIPTION_NONE;
     }
 
-#ifdef ENABLE_DEBUG
   if (DEBUGGING)
     {
       gchar *dump = _gabble_roster_item_dump (&edited_item);
       DEBUG ("After, contact#%u: %s", contact, dump);
       g_free (dump);
     }
-#endif
 
   if (!altered)
     {
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 5865b14..22cf954 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -312,12 +312,6 @@ else
 	@echo "and then re-run configure."
 endif
 
-if ENABLE_DEBUG
-DEBUGGING_PYBOOL = True
-else
-DEBUGGING_PYBOOL = False
-endif
-
 if ENABLE_PLUGINS
 PLUGINS_ENABLED_PYBOOL = True
 else
@@ -352,7 +346,6 @@ config.py: Makefile
 	$(AM_V_GEN) { \
 		echo "PACKAGE_STRING = \"$(PACKAGE_STRING)\""; \
 		echo "CLIENT_TYPE = '$(CLIENT_TYPE)'"; \
-		echo "DEBUGGING = $(DEBUGGING_PYBOOL)"; \
 		echo "PLUGINS_ENABLED = $(PLUGINS_ENABLED_PYBOOL)"; \
 		echo "GOOGLE_RELAY_ENABLED = $(GOOGLE_RELAY_ENABLED_PYBOOL)"; \
 		echo "FILE_TRANSFER_ENABLED = $(FILE_TRANSFER_ENABLED_PYBOOL)"; \
diff --git a/tests/twisted/test-debug.py b/tests/twisted/test-debug.py
index d3662a5..6c079a3 100644
--- a/tests/twisted/test-debug.py
+++ b/tests/twisted/test-debug.py
@@ -7,7 +7,6 @@ from servicetest import assertEquals, sync_dbus, call_async, ProxyWrapper
 from servicetest import EventPattern
 from gabbletest import exec_test
 import constants as cs
-from config import DEBUGGING
 
 def test(q, bus, conn, stream):
     messages = []
@@ -19,13 +18,6 @@ def test(q, bus, conn, stream):
             cs.DEBUG_IFACE)
     debug.connect_to_signal('NewDebugMessage', new_message)
 
-    if not DEBUGGING:
-        # If we're built with --disable-debug, check that the Debug object
-        # isn't present.
-        call_async(q, debug, 'GetMessages')
-        q.expect('dbus-error', method='GetMessages')
-        return
-
     assert len(debug.GetMessages()) > 0
 
     # Turn signalling on and generate some messages.



More information about the telepathy-commits mailing list