Skip to content

Commit

Permalink
cstyle: ignore old non-POSIX types in macro invocations
Browse files Browse the repository at this point in the history
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
  • Loading branch information
robn authored and behlendorf committed Dec 6, 2024
1 parent ba00a6f commit 0de8ae5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/cstyle.pl
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,13 @@ ($$)
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");
}
Expand Down

0 comments on commit 0de8ae5

Please sign in to comment.