diff options
| author | Tyler Retzlaff <[email protected]> | 2024-02-13 10:34:52 -0800 |
|---|---|---|
| committer | David Marchand <[email protected]> | 2024-02-14 13:41:29 +0100 |
| commit | f923fd66bb3b1f048a71f060e71dc86feb35da6e (patch) | |
| tree | cbbc0e28dd16821ca35e79ef7f509690521ee4ce /devtools | |
| parent | 08966fe7f79fdaa5019b7559eebe84a1e3787b89 (diff) | |
devtools: forbid use of compiler alignof and typeof
Add 2 checks forbidding direct use of __alignof__ and __typeof__ instead
C11 alignof and rte_common.h typeof macros should be used.
Signed-off-by: Tyler Retzlaff <[email protected]>
Diffstat (limited to 'devtools')
| -rwxr-xr-x | devtools/checkpatches.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index c9e466f736..e379700897 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -151,6 +151,22 @@ check_forbidden_additions() { # <patch> -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 + # forbid use of __alignof__ + awk -v FOLDERS="lib drivers app examples" \ + -v EXPRESSIONS='\\<__alignof__\\>' \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Using __alignof__, prefer C11 alignof' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + + # forbid use of __typeof__ + awk -v FOLDERS="lib drivers app examples" \ + -v EXPRESSIONS='\\<__typeof__\\>' \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Using __typeof__, prefer typeof' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + # forbid use of non abstracted bit count operations awk -v FOLDERS="lib drivers app examples" \ -v EXPRESSIONS='\\<__builtin_(clz|clzll|ctz|ctzll|popcount|popcountll)\\>' \ |
