History

checkpatch.pl: add union and struct to the exceptions list

Here is a small code snippet, which will be complained about by checkpatch.pl: #define __STRUCT_KFIFO_COMMON(recsize, ptrtype) \ union { \ struct { \ unsigned int in; \ unsigned int out; \ }; \ char rectype[recsize]; \ ptrtype *ptr; \ const ptrtype *ptr_const; \ }; This construct is legal and safe, so checkpatch.pl should accept this. It should be also true for struct defined in a macro. Add the `struct' and `union' keywords to the exceptions list of the checkpatch.pl script, to prevent error message "Macros with multiple statements should be enclosed in a do - while loop". Otherwise it is not possible to build a struct or union with a macro.

Stefani Seibold committed 16 years ago

Commit 22fd2d31 parent 52131291 file · +2 −0Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+2−0
@@ -2361,6 +2361,8 @@ sub process { · 2360 unmodified lines
23612361 DECLARE_PER_CPU|
23622362 DEFINE_PER_CPU|
23632363 __typeof__\(|
2364+ union|
2365+ struct|
23642366 \.$Ident\s*=\s*|
23652367 ^\"|\"$
23662368 }x;