mirror of
https://git.proxmox.com/git/mirror_zfs
synced 2025-04-28 09:46:17 +00: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
0e87150b6c
commit
87947f2440
@ -572,7 +572,9 @@ line: while (<$filehandle>) {
|
||||
err("comma or semicolon followed by non-blank");
|
||||
}
|
||||
# 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");
|
||||
}
|
||||
if (/^\s*(&&|\|\|)/) {
|
||||
|
Loading…
Reference in New Issue
Block a user