From 0de8ae56f7138e63be8a215c63212c62b354bd62 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Wed, 4 Dec 2024 19:43:47 +1100 Subject: [PATCH] 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 Signed-off-by: Rob Norris Closes #16840 --- scripts/cstyle.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/cstyle.pl b/scripts/cstyle.pl index 5483c3fe7c8a..123020b08127 100755 --- a/scripts/cstyle.pl +++ b/scripts/cstyle.pl @@ -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"); }