lkml.org 
[lkml]   [2019]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/4] checkpatch: fix multiple const * types
From
Date
On Wed, 2019-05-08 at 14:27 +0200, Antonio Borneo wrote:
> Commit 1574a29f8e76 ("checkpatch: allow multiple const * types")
> claims to support repetition of pattern "const *", but it actually
> allows only one extra instance.
> Check the following lines
> int a(char const * const x[]);
> int b(char const * const *x);
> int c(char const * const * const x[]);
> int d(char const * const * const *x);
> with command
> ./scripts/checkpatch.pl --show-types -f filename
> to find that only the first line passes the test, while a warning
> is triggered by the other 3 lines:
> WARNING:FUNCTION_ARGUMENTS: function definition argument
> 'char const * const' should also have an identifier name
> The reason is that the pattern match halts at the second asterisk
> in the line, thus the remaining text starting with asterisk fails
> to match a valid name for a variable.
>
> Fixed by replacing "?" (Match 1 or 0 times) with "*" (Match 0 or
> more times) in the regular expression.
> Fix also the similar test for types in unusual order.

It might be better to use a max match like {0,4} instead of *

perl is pretty memory intensive at multiple unrestricted matches
of somewhat complex patterns.


\
 
 \ /
  Last update: 2019-05-08 16:52    [W:0.112 / U:1.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site