[libvirt] [PATCH v2] gobject: Add wrapper virDomainSetTime()

Christophe Fergeau cfergeau at redhat.com
Mon Nov 16 09:10:14 UTC 2015


On Fri, Nov 13, 2015 at 02:13:35PM -0500, Zeeshan Ali (Khattak) wrote:
> Hi,
> 
> >> +    guint settime_flags;
> >> +
> >> +    g_return_val_if_fail(GVIR_IS_DOMAIN(dom), FALSE);
> >> +    g_return_val_if_fail(err == NULL || *err == NULL, FALSE);
> >
> > I'd keep a g_return_val_if_fail(flags == 0, FALSE);
> 
> But doesn't that make G_GNUC_UNUSED declaration wrong then? I think
> it's more important to optimize it out rather than ensuring programmer
> doesn't pass wrong value by mistake, here.

G_GNUC_UNUSED indicates that a value _may_ be unused, it's not a
programmer's promise that it is actually unused. Checking that flags
actually is 0 is useful if someone passes a wrong flag by mistake, and
then people copy and paste that code in other places. The wrong flag
could then be forced into ABI you have to keep compat with forever if
changing it would break people's applications badly.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20151116/07d554b2/attachment-0001.sig>


More information about the libvir-list mailing list