[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <90e1b43d-92a4-50fc-e82d-4590a9651de1@infradead.org>
Date: Fri, 26 May 2023 08:24:57 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Akira Yokosawa <akiyks@...il.com>
Cc: Mark Rutland <mark.rutland@....com>, linux-kernel@...r.kernel.org,
boqun.feng@...il.com, corbet@....net, keescook@...omium.org,
linux-arch@...r.kernel.org, linux@...linux.org.uk,
linux-doc@...r.kernel.org, paulmck@...nel.org,
sstabellini@...nel.org, will@...nel.org,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH 24/26] locking/atomic: scripts: generate kerneldoc
comments
On 5/26/23 03:27, Akira Yokosawa wrote:
> Hi Randy,
>
> On 2023/05/26 13:51, Randy Dunlap wrote:
>> Hi Akira,
>>
>> On 5/25/23 20:17, Akira Yokosawa wrote:
>>> On Wed, 24 May 2023 16:11:52 +0200, Peter Zijlstra wrote:
>>>> On Wed, May 24, 2023 at 11:03:58PM +0900, Akira Yokosawa wrote:
>>>>
>>>>>> * All ops are described as an expression using their usual C operator.
>>>>>> For example:
>>>>>>
>>>>>> andnot: "Atomically updates @v to (@v & ~@i)"
>>>>>
>>>>> The kernel-doc script converts "~@i" into reST source of "~**i**",
>>>>> where the emphasis of i is not recognized by Sphinx.
>>>>>
>>>>> For the "@" to work as expected, please say "~(@i)" or "~ @i".
>>>>> My preference is the former.
>>>>
>>>> And here we start :-/ making the actual comment less readable because
>>>> retarded tooling.
>>>>
>>>>>> inc: "Atomically updates @v to (@v + 1)"
>>>>>>
>>>>>> Which may be clearer to non-naative English speakers, and allows all
>>>>> non-native
>>>>>
>>>>>> the operations to be described in the same style.
>>>>>>
>>>>>> * All conditional ops have their condition described as an expression
>>>>>> using the usual C operators. For example:
>>>>>>
>>>>>> add_unless: "If (@v != @u), atomically updates @v to (@v + @i)"
>>>>>> cmpxchg: "If (@v == @old), atomically updates @v to @new"
>>>>>>
>>>>>> Which may be clearer to non-naative English speakers, and allows all
>>>>>
>>>>> Ditto.
>>>>
>>>> How about we just keep it as is, and all the rst and html weenies learn
>>>> to use a text editor to read code comments?
>>>
>>> :-) :-) :-)
>>>
>>> It turns out that kernel-doc is aware of !@var [1].
>>> Similar tricks can be added for ~@....
>>> So let's keep it as is!
>>>
>>> I'll ask documentation forks for updating kernel-doc when this change
>>> is merged eventually.
>>
>> What do you mean by that?
>> What needs to be updated and how?
>
> I mean, scripts/kernel-doc needs to be updated so that "~@var"
> is converted into "**~var**".
>
> I think adding "~" to the substitution pattern added in [1] as follows
> should do the trick (not well tested):
>
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index 2486689ffc7b..eb70c1fd4e86 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -64,7 +64,7 @@ my $type_constant = '\b``([^\`]+)``\b';
> my $type_constant2 = '\%([-_\w]+)';
> my $type_func = '(\w+)\(\)';
> my $type_param = '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
> -my $type_param_ref = '([\!]?)\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
> +my $type_param_ref = '([\!~]?)\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
> my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params
> my $type_fp_param2 = '\@(\w+->\S+)\(\)'; # Special RST handling for structs with func ptr params
> my $type_env = '(\$\w+)';
>
At a quick glance, that looks OK.
I haven't had enough coffee yet to be able to read all of that regex though.
Just submit the patch (when it is needed) to see what breaks. :)
>>
>>
>>> [1]: ee2aa7590398 ("scripts: kernel-doc: accept negation like !@var")
>>
Thanks.
--
~Randy
Powered by blists - more mailing lists