[PATCH 2/7] Initialize 'klass' in |_dbus_type_reader_recurse| to NULL

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Aug 10 10:27:42 UTC 2016


On 09/08/16 20:18, Thomas Zimmermann wrote:
> Initializing 'klass' in |_dbus_type_reader_recurse| avoids a
> compile-time warning about the variable being uninitialized.

This is a "can't validly happen" situation; klass is initialized in all
cases that don't trigger _dbus_assert_not_reached(). Unfortunately,
_dbus_assert_not_reached() compiles to nothing when assertions are
disabled, so gcc doesn't realise this is meant to be a "can't happen"
situation.

I think this would be OK if we also added a _dbus_assert (klass != NULL)
before first dereferencing klass.

-- 
Simon McVittie
Collabora Ltd. <http://www.collabora.com/>



More information about the dbus mailing list