[libvirt] [PATCH v5 2/9] libxl: pass driver config to libxlMakeDomBuildInfo

Marek Marczykowski-Górecki marmarek at invisiblethingslab.com
Fri Mar 16 19:38:15 UTC 2018


On Fri, Mar 16, 2018 at 05:36:44PM +0000, Daniel P. Berrangé wrote:
> On Wed, Mar 14, 2018 at 03:26:09AM +0100, Marek Marczykowski-Górecki wrote:
> > @@ -48,6 +49,19 @@ VIR_MOCK_IMPL_RET_ARGS(xc_interface_open,
> >  }
> >  
> >  
> > +VIR_MOCK_IMPL_RET_ARGS(libxl_get_version_info,
> > +                       const libxl_version_info*,
> > +                       libxl_ctx *, ctx)
> > +{
> > +    static libxl_version_info info;
> > +
> > +    memset(&info, 0, sizeof(info));
> > +
> > +    return &info;
> > +    /* silence gcc warning */
> > +    return real_libxl_get_version_info(ctx);
> 
> Why was gcc warning about that requires the second return
> statement ?  I would have though this would /cause/ a
> warning by creating unreachable code ?

Because or static real_##name in (unused otherwise):

# define VIR_MOCK_IMPL_RET_ARGS(name, rettype, ...) \
    rettype name(VIR_MOCK_ARGTYPENAMES(__VA_ARGS__)); \
    static rettype (*real_##name)(VIR_MOCK_ARGTYPES(__VA_ARGS__)); \
    rettype name(VIR_MOCK_ARGTYPENAMES_UNUSED(__VA_ARGS__))

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180316/9ff6fad8/attachment-0001.sig>


More information about the libvir-list mailing list