mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-05-10 10:48:27 +03:00
cstyle: understand macro params can be empty
It's not uncommon to have empty parameters in code generator macros, usually when multiple parameters are concatenated or stringified into a single token or literal. So, exclude the space-before-comma check, which will allow construction like `MACRO_CALL(foo, , baz)`. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #16840
This commit is contained in:
parent
903895ea5f
commit
ba00a6f9a3
@ -572,7 +572,9 @@ line: while (<$filehandle>) {
|
|||||||
err("comma or semicolon followed by non-blank");
|
err("comma or semicolon followed by non-blank");
|
||||||
}
|
}
|
||||||
# allow "for" statements to have empty "while" clauses
|
# allow "for" statements to have empty "while" clauses
|
||||||
if (/\s[,;]/ && !/^[\t]+;$/ && !/^\s*for \([^;]*; ;[^;]*\)/) {
|
# allow macro invocations to have empty parameters
|
||||||
|
if (/\s[,;]/ && !/^[\t]+;$/ &&
|
||||||
|
!($in_macro_call || /^\s*for \([^;]*; ;[^;]*\)/)) {
|
||||||
err("comma or semicolon preceded by blank");
|
err("comma or semicolon preceded by blank");
|
||||||
}
|
}
|
||||||
if (/^\s*(&&|\|\|)/) {
|
if (/^\s*(&&|\|\|)/) {
|
||||||
|
Loading…
Reference in New Issue
Block a user