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

Simon McVittie <simon.mcvittie-ZGY8ohtN/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Organization Collabora Ltd.
Message-ID <[email protected]>
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/>

_______________________________________________
dbus mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.