[next] telepathy-rakia: Always build with debug infrastructure

Simon McVittie smcv at kemper.freedesktop.org
Mon May 12 03:00:27 PDT 2014


Module: telepathy-rakia
Branch: next
Commit: fc60501b4f2d13f9f8291768f9de5ab4c41d88ef
URL:    http://cgit.freedesktop.org/telepathy/telepathy-rakia/commit/?id=fc60501b4f2d13f9f8291768f9de5ab4c41d88ef

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon May 12 11:00:19 2014 +0100

Always build with debug infrastructure

Similar to Gabble commit 980e1f40. Disabling it makes the executable
basically impossible to debug and we don't recommend that anyone does so;
it was also breaking distcheck.

---

 Makefile.am                   |    2 +-
 configure.ac                  |    9 ---------
 rakia/base-connection-sofia.c |    4 ----
 rakia/debug.c                 |    6 ------
 rakia/debug.h                 |    6 +++---
 rakia/sip-media.c             |   11 -----------
 rakia/sip-session.c           |   14 --------------
 src/telepathy-rakia.c         |    2 --
 tests/twisted/Makefile.am     |    7 -------
 tests/twisted/test-debug.py   |    6 +-----
 10 files changed, 5 insertions(+), 62 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 659c241..b88cdb5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,7 +26,7 @@ SUBDIRS = \
 include tools/lcov.am
 LCOV_CHECK_ARGS = CHECK_TWISTED_SLEEP=6
 
-DISTCHECK_CONFIGURE_FLAGS = --disable-debug --enable-gtk-doc
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
 
 clean-local: lcov-clean
 
diff --git a/configure.ac b/configure.ac
index 0bf9364..152f92c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,15 +75,6 @@ if test "x$enable_fatal_warnings" = xyes; then
   TP_ADD_LINKER_FLAG([ERROR_LDFLAGS], [-Wl,--no-copy-dt-needed-entries])
 fi
 
-AC_ARG_ENABLE(debug,
-  AS_HELP_STRING([--disable-debug],[omit debug code]),
-    enable_debug=$enableval, enable_debug=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_C_INLINE
 
 dnl GTK docs
diff --git a/rakia/base-connection-sofia.c b/rakia/base-connection-sofia.c
index 437fa82..7a93bc5 100644
--- a/rakia/base-connection-sofia.c
+++ b/rakia/base-connection-sofia.c
@@ -81,7 +81,6 @@ priv_r_unregister (int status,
 }
 #endif
 
-#ifdef ENABLE_DEBUG
 static void
 priv_r_get_params (int status,
                    nua_t *nua,
@@ -97,7 +96,6 @@ priv_r_get_params (int status,
   /* note: print contents of all tags to stdout */
   tl_print(stdout, "Sofia-SIP NUA stack parameters:\n", tags);
 }
-#endif
 
 /**
  * Callback for events delivered by the SIP stack.
@@ -120,11 +118,9 @@ rakia_base_connection_sofia_callback (nua_event_t event,
 
   switch (event)
     {
-#ifdef ENABLE_DEBUG
     case nua_r_get_params:
       priv_r_get_params (status, nua, nh, tags);
       return;
-#endif
     case nua_r_shutdown:
       priv_r_shutdown (status, nua);
       return;
diff --git a/rakia/debug.c b/rakia/debug.c
index 1709d6e..4585ef0 100644
--- a/rakia/debug.c
+++ b/rakia/debug.c
@@ -41,9 +41,7 @@ static const GDebugKey rakia_debug_keys[] = {
 
 static GHashTable *flag_to_domains = NULL;
 
-#ifdef ENABLE_DEBUG
 static GString *sofia_log_buf = NULL;
-#endif
 
 static void rakia_sofia_log_close (void);
 
@@ -146,7 +144,6 @@ void rakia_log (RakiaDebugFlags flag,
 void
 rakia_sofia_log_handler (void *logdata, const char *format, va_list args)
 {
-#ifdef ENABLE_DEBUG
   if (G_UNLIKELY (sofia_log_buf == NULL))
     sofia_log_buf = g_string_sized_new (
         g_printf_string_upper_bound (format, args));
@@ -162,13 +159,11 @@ rakia_sofia_log_handler (void *logdata, const char *format, va_list args)
           sofia_log_buf->str);
       g_string_truncate (sofia_log_buf, 0);
     }
-#endif
 }
 
 static void
 rakia_sofia_log_close (void)
 {
-#ifdef ENABLE_DEBUG
   if (sofia_log_buf == NULL)
     return;
 
@@ -183,5 +178,4 @@ rakia_sofia_log_close (void)
 
   g_string_free (sofia_log_buf, TRUE);
   sofia_log_buf = NULL;
-#endif
 }
diff --git a/rakia/debug.h b/rakia/debug.h
index db92e7b..5b7bfc5 100644
--- a/rakia/debug.h
+++ b/rakia/debug.h
@@ -48,7 +48,7 @@ void rakia_sofia_log_handler (void *logdata, const char *format, va_list args);
 
 G_END_DECLS
 
-#if defined(ENABLE_DEBUG) && defined(DEBUG_FLAG)
+#if defined(DEBUG_FLAG)
 
 #define DEBUG(format, ...) \
   rakia_log(DEBUG_FLAG, G_LOG_LEVEL_DEBUG, "%s: " format, \
@@ -60,12 +60,12 @@ G_END_DECLS
   rakia_log(DEBUG_FLAG, G_LOG_LEVEL_MESSAGE, "%s: " format, \
       G_STRFUNC, ##__VA_ARGS__)
 
-#else /* ENABLE_DEBUG && DEBUG_FLAG */
+#else
 
 #define DEBUG(format, ...) G_STMT_START { } G_STMT_END
 #define WARNING(format, ...) G_STMT_START { } G_STMT_END
 #define MESSAGE(format, ...) G_STMT_START { } G_STMT_END
 
-#endif /* ENABLE_DEBUG && DEBUG_FLAG */
+#endif
 
 #endif /* __DEBUG_H__ */
diff --git a/rakia/sip-media.c b/rakia/sip-media.c
index 6eb15e8..b913b46 100644
--- a/rakia/sip-media.c
+++ b/rakia/sip-media.c
@@ -39,9 +39,6 @@
 #include "rakia/codec-param-formats.h"
 #include "rakia/sip-session.h"
 
-
-#ifdef ENABLE_DEBUG
-
 #define MEDIA_DEBUG(media, format, ...) \
   rakia_log (DEBUG_FLAG, G_LOG_LEVEL_DEBUG, "media %s %p: " format, \
       priv_media_type_to_str ((media)->priv->media_type), (media),  \
@@ -52,14 +49,6 @@
       priv_media_type_to_str ((media)->priv->media_type), (media), \
       ##__VA_ARGS__)
 
-#else
-
-#define MEDIA_DEBUG(media, format, ...) G_STMT_START { } G_STMT_END
-#define MEDIA_MESSAGE(media, format, ...) G_STMT_START { } G_STMT_END
-
-#endif
-
-
 /* The timeout for outstanding re-INVITE transactions in seconds.
  * Chosen to match the allowed cancellation timeout for proxies
  * described in RFC 3261 Section 13.3.1.1 */
diff --git a/rakia/sip-session.c b/rakia/sip-session.c
index aed3ecb..6c91385 100644
--- a/rakia/sip-session.c
+++ b/rakia/sip-session.c
@@ -54,10 +54,6 @@ G_DEFINE_TYPE_WITH_CODE(RakiaSipSession,
     G_IMPLEMENT_INTERFACE (RAKIA_TYPE_EVENT_TARGET, event_target_init)
 )
 
-
-
-#ifdef ENABLE_DEBUG
-
 /**
  * Sip session states:
  * - created, objects created, local cand/codec query ongoing
@@ -92,14 +88,6 @@ static const char *const session_states[NUM_RAKIA_SIP_SESSION_STATES] =
   rakia_log (DEBUG_FLAG, G_LOG_LEVEL_MESSAGE, "%s [%-17s]: " format, \
       G_STRFUNC, session_states[(session)->priv->state],##__VA_ARGS__)
 
-#else /* !ENABLE_DEBUG */
-
-#define SESSION_DEBUG(session, format, ...) G_STMT_START { } G_STMT_END
-#define SESSION_MESSAGE(session, format, ...) G_STMT_START { } G_STMT_END
-
-#endif /* ENABLE_DEBUG */
-
-
 /* properties */
 enum
 {
@@ -499,13 +487,11 @@ priv_save_event (RakiaSipSession *self)
 
   rakia_base_connection_save_event (priv->conn, priv->saved_event);
 
-#ifdef ENABLE_DEBUG
   {
     nua_event_data_t const *ev_data = nua_event_data (priv->saved_event);
     g_assert (ev_data != NULL);
     DEBUG("saved the last event: %s %hd %s", nua_event_name (ev_data->e_event), ev_data->e_status, ev_data->e_phrase);
   }
-#endif
 }
 
 static void
diff --git a/src/telepathy-rakia.c b/src/telepathy-rakia.c
index efc4234..577b284 100644
--- a/src/telepathy-rakia.c
+++ b/src/telepathy-rakia.c
@@ -56,9 +56,7 @@ main (int argc, char** argv)
   fatal_mask |= G_LOG_LEVEL_CRITICAL;
   g_log_set_always_fatal (fatal_mask);  
 
-#ifdef ENABLE_DEBUG
   rakia_debug_set_flags_from_env ();
-#endif
 
   if (g_getenv ("RAKIA_PERSIST") || g_getenv ("TPSIP_PERSIST"))
     {
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index c871feb..0453ac8 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -34,16 +34,9 @@ check-twisted: $(BUILT_SOURCES)
 	  CHECK_TWISTED_SLEEP=$$rakia_test_sleep \
 	  ./run-test.sh "$(TWISTED_TESTS)"
 
-if ENABLE_DEBUG
-DEBUGGING_PYBOOL = True
-else
-DEBUGGING_PYBOOL = False
-endif
-
 config.py: Makefile
 	$(AM_V_GEN) { \
 		echo "PACKAGE_STRING = \"$(PACKAGE_STRING)\""; \
-		echo "DEBUGGING = $(DEBUGGING_PYBOOL)"; \
 	} > $@
 
 twisted-tests.list: Makefile
diff --git a/tests/twisted/test-debug.py b/tests/twisted/test-debug.py
index 46c8e5b..28ec717 100644
--- a/tests/twisted/test-debug.py
+++ b/tests/twisted/test-debug.py
@@ -8,7 +8,6 @@ import dbus
 from servicetest import assertEquals, sync_dbus, call_async
 from sofiatest import exec_test
 import constants as cs
-from config import DEBUGGING
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -41,10 +40,7 @@ def test(q, bus, conn, stream):
 
     q.expect('dbus-signal', signal='NewChannel')
 
-    if DEBUGGING:
-        assert len(messages) > 0
-    else:
-        assertEquals([], messages)
+    assert len(messages) > 0
 
     # Turn signalling off and check we don't get any more messages.
 



More information about the telepathy-commits mailing list