[libvirt] [PATCH 01/15] util: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStorageAuthDef

Erik Skultety eskultet at redhat.com
Fri Feb 8 07:49:21 UTC 2019


On Thu, Feb 07, 2019 at 12:12:14PM -0500, John Ferlan wrote:
>
>
> On 2/7/19 11:54 AM, Andrea Bolognani wrote:
> > On Thu, 2019-02-07 at 17:36 +0100, Erik Skultety wrote:
> >> On Thu, Feb 07, 2019 at 05:11:24PM +0100, Andrea Bolognani wrote:
> >>> On Thu, 2019-02-07 at 16:55 +0100, Erik Skultety wrote:
> >>>> On Thu, Feb 07, 2019 at 04:24:13PM +0100, Andrea Bolognani wrote:
> >>>>> Please keep the semicolon! If a macro is used like a function, then
> >>>>> its call sites should also look like those of a function.
> >>>>
> >>>> Except VIR_DEFINE_AUTOPTR_FUNC macro is not used like a function, it defines a
> >>>> function.
> >>>
> >>> Sure, and the way you make that happen is by writing
> >>>
> >>>   MACRO_NAME(argument_one, argument_two);
> >>>
> >>> How is that not using it like a function? :)
> >>
> >> I may need to replace my dictionary, because the way I understand the
> >> expression "like a function" is that the macro is called like function and it
> >> behaves like a function, i.e. returns a value, IOW by using the macro its
> >> expansion will perform the usual set of operation on the stack that a function
> >> call involves (push parameters, return address, jump into function,
> >> pop the return value...)
> >
> > I guess abort() is not a function either then, since it doesn't have
> > any parameters to push or values to return! :P
> >
> > Anyway, the point is that we have already started mandating the use
> > of semicolon after other macros that expand to definitions, such as
> > VIR_ENUM_DECL(), VIR_ENUM_IMPL(), and VIR_ONCE_GLOBAL_INIT(): we
> > should do the same for VIR_DEFINE_AUTOPTR_FUNC() and increase
> > consistency instead of pushing in the opposite direction.
> >
>
> Since the issue is consistency, how about a patch that adds the ; to the
> existing VIR_DEFINE_AUTOPTR_FUNC's that don't have it?  Ironically, I
> found one that has it:
>
> VIR_DEFINE_AUTOPTR_FUNC(virSEVCapability, virSEVCapabilitiesFree);

That sounds reasonable, I didn't want to end up with one set of macros
following one direction and another following other one, so go ahead ;).

Erik




More information about the libvir-list mailing list