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 <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #16840
This commit is contained in:
Rob Norris 2024-12-04 19:43:47 +11:00 committed by Brian Behlendorf
parent 87947f2440
commit 73a73cba71

View File

@ -695,10 +695,13 @@ line: while (<$filehandle>) {
err("unary * followed by space");
}
}
if ($check_posix_types) {
if ($check_posix_types && !$in_macro_call) {
# try to detect old non-POSIX types.
# POSIX requires all non-standard typedefs to end in _t,
# but historically these have been used.
#
# We don't check inside macro invocations because macros have
# legitmate uses for these names in function generators.
if (/\b(unchar|ushort|uint|ulong|u_int|u_short|u_long|u_char|quad)\b/) {
err("non-POSIX typedef $1 used: use $old2posix{$1} instead");
}