Most Telepathy(-related) C components define DEBUG(...) to do { } while (0); if --disable-debug is passed to configure. This has the unpleasant side-effect of triggering unused variable warnings and the like. I realised today that they could instead be defined as follows: static inline void DEBUG (const gchar *format, ...) { } This avoids us ever having to guard variables only used in debug statements with ENABLE_DEBUG ever again. If the compiler is smart enough (which it should be), it will optimise away the function call; if it's *really* smart it'll also optimize away the variables which (after the function call has been eliminated) are set but never used. (I don't know how smart GCC is, but it *should* do at least the first.) I've got branches for Wocky and tp-glib so far. I vetted tp-glib and there are no particularly expensive function calls as arguments to DEBUG(). The most expensive is tp_handle_set_size(). http://cgit.collabora.com/git/user/wjt/wocky.git/log/?h=oh-god-the-warnings http://cgit.collabora.com/git/user/wjt/telepathy-glib.git/log/?h=debug-stub
Here's a Gabble one: http://cgit.collabora.com/git/user/wjt/telepathy-gabble-wjt.git/commit/?h=debug-stubs
tp-glib branch++
Merged to Wocky, Gabble and tp-glib master. Ta!
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.