Bug 83767 - turn runtime assertions into compile-time assertions
Summary: turn runtime assertions into compile-time assertions
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: low enhancement
Assignee: Simon McVittie
QA Contact:
URL:
Whiteboard: review?
Keywords: patch
Depends on:
Blocks:
 
Reported: 2014-09-11 13:34 UTC by Simon McVittie
Modified: 2014-09-15 12:02 UTC (History)
4 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Add _DBUS_GNUC_UNUSED, and use it in _DBUS_STATIC_ASSERT (1.62 KB, patch)
2014-09-11 13:35 UTC, Simon McVittie
Details | Splinter Review
Replace some runtime assertions with compile-time assertions (6.42 KB, patch)
2014-09-11 13:35 UTC, Simon McVittie
Details | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Simon McVittie 2014-09-11 13:34:13 UTC
Static assertions are good: they prevent dbus from even compiling on platforms where certain assumptions don't hold.
Comment 1 Simon McVittie 2014-09-11 13:35:42 UTC
Created attachment 106131 [details] [review]
Add _DBUS_GNUC_UNUSED, and use it in _DBUS_STATIC_ASSERT

This means we can use _DBUS_STATIC_ASSERT at non-global scope without
tripping -Wunused-local-typedefs.

Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>

---

My colleague Alban already reviewed this internally.
Comment 2 Simon McVittie 2014-09-11 13:35:57 UTC
Created attachment 106132 [details] [review]
Replace some runtime assertions with compile-time  assertions

This requires a little bit of code re-ordering, because
_DBUS_STATIC_ASSERT can appear anywhere that a variable declaration
would be valid, i.e. not after executable code.
Comment 3 Alban Crequy 2014-09-12 16:24:58 UTC
Comment on attachment 106132 [details] [review]
Replace some runtime assertions with compile-time  assertions

Review of attachment 106132 [details] [review]:
-----------------------------------------------------------------

It looks good to me.
Comment 4 Simon McVittie 2014-09-15 12:02:23 UTC
Fixed in git for 1.9.0


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.