Skip to content

Commit 0de8ae5

Browse files
robnbehlendorf
authored andcommitted
cstyle: ignore old non-POSIX types in macro invocations
In code generation macros, we often use names like `uint` when constructing handler functions. These are not being used as types, so exclude them from the admonishment to use POSIX type names. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes #16840
1 parent ba00a6f commit 0de8ae5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/cstyle.pl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,10 +695,13 @@ ($$)
695695
err("unary * followed by space");
696696
}
697697
}
698-
if ($check_posix_types) {
698+
if ($check_posix_types && !$in_macro_call) {
699699
# try to detect old non-POSIX types.
700700
# POSIX requires all non-standard typedefs to end in _t,
701701
# but historically these have been used.
702+
#
703+
# We don't check inside macro invocations because macros have
704+
# legitmate uses for these names in function generators.
702705
if (/\b(unchar|ushort|uint|ulong|u_int|u_short|u_long|u_char|quad)\b/) {
703706
err("non-POSIX typedef $1 used: use $old2posix{$1} instead");
704707
}

0 commit comments

Comments
 (0)