lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250607120501.7a0db912@foz.lan>
Date: Sat, 7 Jun 2025 12:05:01 +0200
From: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>
To: Jonathan Corbet <corbet@....net>
Cc: linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/9] docs: kdoc: simplify the kerneldoc recognition code

Em Fri,  6 Jun 2025 10:34:33 -0600
Jonathan Corbet <corbet@....net> escreveu:

> process_name() looks for the first line of a kerneldoc comment.  It
> contains two nearly identical regular expressions, the second of which only
> catches six cases in the kernel, all of the form:
> 
>   define SOME_MACRO_NAME - description
> 
> Simply put the "define" into the regex and discard it, eliminating the loop
> and the code to remove it specially.
> 
> Note that this still treats these defines as if they were functions, but
> that's a separate issue.
> 
> There is no change in the generated output.
> 
> Signed-off-by: Jonathan Corbet <corbet@....net>

Nice cleanup!

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@...nel.org>

> ---
>  scripts/lib/kdoc/kdoc_parser.py | 24 ++++++++----------------
>  1 file changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
> index 90b53b70cfee..3ea260b423e2 100644
> --- a/scripts/lib/kdoc/kdoc_parser.py
> +++ b/scripts/lib/kdoc/kdoc_parser.py
> @@ -1230,26 +1230,18 @@ class KernelDoc:
>  
>              # Test for data declaration
>              r = KernRe(r"^\s*\*?\s*(struct|union|enum|typedef)\b\s*(\w*)")
> +            r2 = KernRe(fr"^{decl_start}{fn_type}(?:define\s+)?(\w+)\s*{parenthesis}\s*{decl_end}?$")
>              if r.search(line):
>                  self.entry.decl_type = r.group(1)
>                  self.entry.identifier = r.group(2)
>                  self.entry.is_kernel_comment = True
> -            else:
> -                # Look for foo() or static void foo() - description;
> -                # or misspelt identifier
> -
> -                r1 = KernRe(fr"^{decl_start}{fn_type}(\w+)\s*{parenthesis}\s*{decl_end}?$")
> -                r2 = KernRe(fr"^{decl_start}{fn_type}(\w+[^-:]*){parenthesis}\s*{decl_end}$")
> -
> -                for r in [r1, r2]:
> -                    if r.search(line):
> -                        self.entry.identifier = r.group(1)
> -                        self.entry.decl_type = "function"
> -
> -                        r = KernRe(r"define\s+")
> -                        self.entry.identifier = r.sub("", self.entry.identifier)
> -                        self.entry.is_kernel_comment = True
> -                        break
> +            #
> +            # Look for a function description
> +            #
> +            elif r2.search(line):
> +                self.entry.identifier = r2.group(1)
> +                self.entry.decl_type = "function"
> +                self.entry.is_kernel_comment = True
>  
>              self.entry.identifier = self.entry.identifier.strip(" ")
>  



Thanks,
Mauro

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ