lkml.org 
[lkml]   [2020]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 49/56] refcount.h: fix a kernel-doc markup
On Sat, Oct 24, 2020 at 08:28:27AM +0200, Mauro Carvalho Chehab wrote:
> If the intent is to document the struct and its internal fields,
> this kernel-doc should work:
>
> /**
> * struct refcount_struct - variant of atomic_t specialized for reference counts
> * @refs: atomic_t counter field
> *
> * The counter saturates at REFCOUNT_SATURATED and will not move once
> * there. This avoids wrapping the counter and causing 'spurious'
> * use-after-free bugs.
> */
>
> Which produces this result:

Who cares... :-(

> If you want both, then you would either split struct and typedef, e. g.
> with something like:
>
> /**
> * struct refcount_struct - variant of atomic_t specialized for reference counts
> * @refs: atomic_t counter field
> *
> * The counter saturates at REFCOUNT_SATURATED and will not move once
> * there. This avoids wrapping the counter and causing 'spurious'
> * use-after-free bugs.
> */
> struct refcount_struct {
> atomic_t refs;
> };
>
> /**
> * typedef refcount_t - variant of atomic_t specialized for reference counts
> * @refs: atomic_t counter field
> *
> * The counter saturates at REFCOUNT_SATURATED and will not move once
> * there. This avoids wrapping the counter and causing 'spurious'
> * use-after-free bugs.
> */
> typedef struct refcount_struct refcount_t;
>
> Or, you could add the member at the description field. E. g. something
> like this:
>
> /**
> * typedef refcount_t - variant of atomic_t specialized for reference counts
> *
> * The counter saturates at REFCOUNT_SATURATED and will not move once
> * there. This avoids wrapping the counter and causing 'spurious'
> * use-after-free bugs.
> *
> * Members:
> * ``refs``
> * atomic_t counter field
> */
> typedef struct refcount_struct {
> atomic_t refs;
> } refcount_t;
>
> If you want to test it, you can run kernel-doc directly, to see how
> it will parse it. For ReST output, that's the syntax:
>
> ./scripts/kernel-doc --sphinx-version 3 include/linux/refcount.h

I'll just go ahead and remove the superfluous * from the comment... It's
trivially clear what is meant. If the stupid tool can't deal with that,
I don't care.

All this wanking about docs and making perfectly fine comments bloody
unreadable shit has to stop.

\
 
 \ /
  Last update: 2020-10-26 09:32    [W:0.097 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site