]> git.baikalelectronics.ru Git - kernel.git/commit
checkpatch: warn on macros with flow control statements
authorJoe Perches <joe@perches.com>
Mon, 13 Oct 2014 22:51:55 +0000 (15:51 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 Oct 2014 00:18:15 +0000 (02:18 +0200)
commit2160df1c4643336165e298b30a70e92333529bc7
treee1cddaa649c00e4181f19c01d76fead28b5af8e0
parent59c2e4115199e763fd869b9a55044e3f1b2bbfac
checkpatch: warn on macros with flow control statements

Macros with flow control statements (goto and return) are not very nice to
read as any flow movement is unexpected.

Try to highlight them and emit a warning on their definition.

Avoid warning on macros that use argument concatenation as those macros
commonly create another function where the concatenation is used in the
function name definition like:

#define FOO_FUNC(name, rtn_type) \
rtn_type func##name(arg1, ...) \
{ \
rtn_type rtn; \
[code...] \
return rtn; \
}

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl