[libvirt] [PATCH] libvirt-domain.h: Fix enum description placement

Daniel P. Berrange berrange at redhat.com
Fri Jul 21 14:38:13 UTC 2017


On Fri, Jul 21, 2017 at 04:33:06PM +0200, Jiri Denemark wrote:
> On Fri, Jul 21, 2017 at 14:42:05 +0100, Daniel P. Berrange wrote:
> > On Fri, Jul 21, 2017 at 03:00:20PM +0200, Martin Kletzander wrote:
> 
> > > struct meh {
> > >       /*# This is comment for the following member foo */
> > >       unsigned int foo;
> > >       int bar; /*< This is for member bar that's on the same line */
> > > }
> > > 
> > > and so on.  If that doesn't help either and it never worked,
> > > then... it's a pity :-/
> > 
> > That is ambiguous - without seeing whitespace, the parser cannot
> > distinguish between these two scenarios:
> > 
> >  struct meh {
> >        unsigned int foo; /*# This is comment for the following member foo */
> >        int bar;
> >  }
> 
> Martin suggested < to be used instead of # for this type of comments to
> remove the ambiguity.
> 
> >  struct meh {
> >        unsigned int foo;
> >        
> >         /*# This is comment for the following member foo */
> >        int bar;
> >  }
> 
> However, I think we could just simply force using only comments above
> each member in our public header files and fix the generator to properly
> work with them. This should be a lot easier than fixing it to handle
> both options.

I'd probably go for doing that. In many cases where we put the comment
at the end of the line, we're forced to split it across many lines
anyway, lest the line get too long. Putting commments before the
item means we won't hit the line length so easily, so more comments
will fit on one line.

Oh and this issue affects struct field members too IIUC

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list