devtools: forbid variable declaration inside for
[dpdk.git] / devtools / checkpatches.sh
index 158087f..e24414b 100755 (executable)
@@ -69,6 +69,14 @@ check_forbidden_additions() { # <patch>
                -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
                "$1" || res=1
 
+       # forbid variable declaration inside "for" loop
+       awk -v FOLDERS='.' \
+               -v EXPRESSIONS='for *\\((char|u?int|unsigned|s?size_t)' \
+               -v RET_ON_FAIL=1 \
+               -v MESSAGE='Declaring a variable inside for()' \
+               -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+               "$1" || res=1
+
        # svg figures must be included with wildcard extension
        # because of png conversion for pdf docs
        awk -v FOLDERS='doc' \