[Spice-devel] [PATCH spice-gtk 1/4] coroutine: don't force coroutine_init checking

Marc-André Lureau marcandre.lureau at gmail.com
Tue Nov 19 08:38:29 PST 2013


On Tue, Nov 19, 2013 at 5:25 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> On Tue, Nov 19, 2013 at 05:12:39PM +0100, Marc-André Lureau wrote:
>> On Tue, Nov 19, 2013 at 5:09 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
>> > On Tue, Nov 19, 2013 at 11:05:13AM -0500, Marc-André Lureau wrote:
>> >>
>> >>
>> >> ----- Original Message -----
>> >> > On Tue, Nov 19, 2013 at 04:14:22PM +0100, Marc-André Lureau wrote:
>> >> > > Just like any other C function
>> >> >
>> >> > NACK, I just added this annotation as not checking its return value will
>> >> > cause very hard to track down failures (no usable backtraces), so better to
>> >> > force it to be checked, especially as this is only used internally.
>> >>
>> >> This is really different from any other C API.
>> >
>> > GList, GSList make extensive use of it, and it's also used in a several other
>> > places in glib.
>>
>> Because they return object that contains allocated data, or are
>> critical to there mode of working.
>
> _init() succeeding is critical to the coroutine being properly initialized,
> and once again, not checking it can cause hard to diagnose failures, so
> this function is special.
>
>> Any other function that returns an error code doesn't have
>> G_GNUC_WARN_UNUSED_RESULT.
>>
>> I'll modify the patch to abort, and return void.
>
> Hrm, all of this would have been more useful during the review of "Check
> coroutine_init() return value" as this is an alternate approach I
> experimented with, but then I preferred to try to avoid adding more abort()
> to spice-gtk.

spice-gtk follows glib/gtk principle of API and failure.

It's not too late to fix this (and it's not too late to admit that
G_GNUC_WARN_UNUSED_RESULT. shouldn't be used for error codes ;)

-- 
Marc-André Lureau


More information about the Spice-devel mailing list