Various libraries use "static assertions" to check invariants at compile-time, with no runtime overhead. For instance, it's easy to check that things have the expected sizeof(). Under gcc 4, __alignof__() is also easy to check.
Created attachment 49677 [details] [review] [PATCH 1/2] Add _DBUS_STATIC_ASSERT (based on GLib's G_STATIC_ASSERT) and use it
Created attachment 49678 [details] [review] [PATCH 2/2] dbus-marshal-basic: assert that the size and (on gcc) alignment of all types is as expected The __alignof__() checks here will fail if compiling for an architecture where more-than-natural alignment is needed. --- Possibly those architectures can't exist, or can't implement ISO C; I don't really care. If they exist, the checks will make D-Bus fail to compile there (where previously it failed at runtime), and if they don't, the checks have no effect at runtime anyway.
Review of attachment 49677 [details] [review]: ++
Review of attachment 49678 [details] [review]: Looks fine!
Thanks, fixed in 1.4.16, 1.5.8
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.