diff options
author | 2024-12-21 23:22:14 +0100 | |
---|---|---|
committer | 2024-12-30 11:15:10 -0700 | |
commit | da3ecf00ffc7b169b9a31a1218bbb52aa19d8df7 (patch) | |
tree | fc6353efc70c3f924d6e03388e78935c4bc41fe2 /scripts | |
parent | Documentation: move dev-tools debugging files to process/debugging/ (diff) | |
download | wireguard-linux-da3ecf00ffc7b169b9a31a1218bbb52aa19d8df7.tar.xz wireguard-linux-da3ecf00ffc7b169b9a31a1218bbb52aa19d8df7.zip |
scripts/kernel-doc: fix identifier parsing regex
John wrote:
> kernel-doc gets confused by code like the following:
>
> /**
> * define HOMA_MIN_DEFAULT_PORT - The 16-bit port space is divided into
> * two nonoverlapping regions. Ports 1-32767 are reserved exclusively
> * for well-defined server ports. The remaining ports are used for client
> * ports; these are allocated automatically by Homa. Port 0 is reserved.
> */
> #define HOMA_MIN_DEFAULT_PORT 0x8000
>
> It seems to use the last "-" on the line (the one in "16-bit") rather
> than the first one, so it produces the following false error message:
>
> homa.h:50: warning: expecting prototype for HOMA_MIN_DEFAULT_PORT -
> The 16(). Prototype was for HOMA_MIN_DEFAULT_PORT() instead
>
> There are similar problems if there is a ":" later on the line.
The problem is the regex for the identifier, which is a greedy /.*/ that
matches everything up to the last - or : (i.e. $decl_end). Fix it by
tightening up this regex and not matching those characters as part of the
identifier.
Link: https://lore.kernel.org/all/CAGXJAmzfRzE=A94NT5ETtj3bZc-=2oLg-9E5Kjh4o_-iuw1q8g@mail.gmail.com/
Reported-by: John Ousterhout <ouster@cs.stanford.edu>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20241221222214.1969823-1-vegard.nossum@oracle.com
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/kernel-doc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 4ee843d3600e..e57c5e989a0a 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -2085,7 +2085,7 @@ sub process_name($$) { # Look for foo() or static void foo() - description; or misspelt # identifier elsif (/^$decl_start$fn_type?(\w+)\s*$parenthesis?\s*$decl_end?$/ || - /^$decl_start$fn_type?(\w+.*)$parenthesis?\s*$decl_end$/) { + /^$decl_start$fn_type?(\w+[^-:]*)$parenthesis?\s*$decl_end$/) { $identifier = $1; $decl_type = 'function'; $identifier =~ s/^define\s+//; |