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 <roret...@linux.microsoft.com>
---
 devtools/checkpatches.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index c9e466f..e379700 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)\\>' \
-- 
1.8.3.1

Reply via email to