| Summary: |
Make DEBUG a no-op static inline with --disable-debug. |
| Product: |
Telepathy
|
Reporter: |
Will Thompson <will> |
| Component: |
general | Assignee: |
Telepathy bugs list <telepathy-bugs> |
| Status: |
RESOLVED
FIXED
|
QA Contact: |
Telepathy bugs list <telepathy-bugs> |
| Severity: |
normal
|
|
|
| Priority: |
medium
|
Keywords: |
patch |
| Version: |
git master | |
|
| Hardware: |
Other | |
|
| OS: |
All | |
|
| Whiteboard: |
r+ |
|
i915 platform:
|
|
i915 features:
|
|
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.
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