Re: typedef output question/issue?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jani,

On 11/21/24 11:28 AM, Jani Nikula wrote:
> On Thu, 21 Nov 2024, Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
>> On 11/21/24 3:19 AM, Jani Nikula wrote:
>>> On Thu, 21 Nov 2024, Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx> wrote:
>>>> On Wed, 20 Nov 2024, Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
>>>>> Hi,
>>>>>
>>>>> If I print a typedef in html (make htmldocs) from a .rst file,
>>>>> I see:
>>>>>
>>>>> type dma_cookie_t
>>>>>     an opaque DMA cookie
>>>>>
>>>>> Description
>>>>>
>>>>> if dma_cookie_t is >0 it’s a DMA request cookie, <0 it’s an error code
>>>>>
>>>>> ~~~~~~~~~~~~~~~~~~~
>>>>>
>>>>> If I print the same typedef in man format, it says 'typedef' instead of
>>>>> 'type', which is what I expect to see.
>>>>
>>>> I'm sorry, it's unambigous to me which one you expect.
>>>
>>> *ambiguous, obvs!
>>
>> Sorry about that. I would like to see 'typedef' instead of 'type'.
> 
> Right, so looking into it, Sphinx actually has two forms for documenting
> types, described at [1]:
> 
> .. c:type:: foo_t
> 
> .. c:type:: int foo_t
> 
> The former is simple, and becomes a generic "type" in rendered
> documentation, while the latter can contain a "typedef-like
> declaration", and becomes "typedef" in rendered documentation.
> 
> So, if you can make kernel-doc emit a proper typedef for the c:type

What a big "if"!  Not your problem though.

What this exercise has shown me is that the scripts/kernel-doc processing of
'typedef' is sorely lacking. I.e., "typedef [many options]" is too complex for it. ;)

My test case has 3 typedefs in a row and scripts/kernel-doc sees only the first one
as a typedef, skips the second one, and parses the third one as a macro. (!)


> directive, the output will contain typedef, but otherwise remains just
> type. Whether having the actual typedef declaration in the output is
> something you also want, is a different matter.

Thanks for your assistance.

-- 
~Randy





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux