scripts: checkpatch: add special consideration for DIR
DIR is a POSIX type defined via the dirent.h header. In Zephyr, we define it as `typedef void DIR`, since it is only ever described via a pointer (much like `FILE`). However, in checkpatch.pl, functions that return DIR* or accept a DIR* argument are met with an error of the form below: ``` ERROR:SPACING: need consistent spacing around '*' (ctx:WxV) ``` Examples that trigger this false positive are, for example ```cpp int dirfd(DIR *dirp); DIR *fdopendir(int fd); ``` Include `DIR` as a class of specific POSIX types that should be matched as types rather than other tokens. Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
parent
fa841fe7bd
commit
3e49a19b17
1 changed files with 4 additions and 1 deletions
|
|
@ -464,10 +464,13 @@ our $typeKernelTypedefs = qr{(?x:
|
|||
(?:__)?(?:u|s|be|le)(?:8|16|32|64)|
|
||||
atomic_t
|
||||
)};
|
||||
# DIR is misinterpreted as a macro or value in some POSIX headers
|
||||
our $typePosixTypedefs = qr{DIR};
|
||||
our $typeTypedefs = qr{(?x:
|
||||
$typeC99Typedefs\b|
|
||||
$typeOtherOSTypedefs\b|
|
||||
$typeKernelTypedefs\b
|
||||
$typeKernelTypedefs\b|
|
||||
$typePosixTypedefs\b
|
||||
)};
|
||||
|
||||
our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b};
|
||||
|
|
|
|||
Loading…
Reference in a new issue