Re: [RFC v2] scripts: kernel-doc: fix typedef support for struct/union parsing

From: Lukas Bulwahn
Date: Thu Feb 25 2021 - 06:49:00 EST


On Wed, Feb 24, 2021 at 2:30 PM Aditya Srivastava <yashsri421@xxxxxxxxx> wrote:
>
> Currently, there are 447 files in the kernel tree, which use 'typedef
> struct/union' syntax for defining some struct/union. In total, there
> are ~1290 such occurrences in the kernel tree.
>
> However, kernel-doc does not support it currently, and running
> scripts/kernel-doc -none on emits:
> "error: Cannot parse struct or union!"
>

I will help rephrasing it more precisely:

Currently, there are ~1290 occurrences in 447 files in the kernel tree
'typedef struct/union' syntax for defining some struct/union. However,
kernel-doc currently does not support that syntax. Of the ~1290
occurrences, there are four occurrences in ./include/linux/zstd.h with
typedef struct/union syntax and a preceding kernel-doc; all other
occurrences have no preceding kernel-doc.

Add support for parsing struct/union following this syntax.



I also tested it; here is my quick diff of "git ls-files | xargs
./scripts/kernel-doc -none 2>&1" before and after patch application:

< include/linux/zstd.h:154: error: Cannot parse struct or union!
< include/linux/zstd.h:171: error: Cannot parse struct or union!
< include/linux/zstd.h:181: error: Cannot parse struct or union!
18857d18853
< include/linux/zstd.h:936: error: Cannot parse struct or union!


So, again:

Tested-by: Lukas Bulwahn <lukas.bulwahn@xxxxxxxxx>

Aditya, can you please pick up my rephrasing and send out a v3.


Lukas