From: Ferruh Yigit Date: Wed, 19 May 2021 19:24:49 +0000 (+0200) Subject: devtools: check %l format specifier X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d991d879f985c55cccd42aa8a383b7bbb72d0344;p=dpdk.git devtools: check %l format specifier %lx or %llx tend to be wrong for 32-bit platform if used for fixed size variable like uint64_t. A checkpatch warning will avoid this common mistake. Signed-off-by: Ferruh Yigit Signed-off-by: Thomas Monjalon --- diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index ba43f84e64..c30dadd962 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -69,6 +69,14 @@ check_forbidden_additions() { # -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 + # check %l or %ll format specifier + awk -v FOLDERS='lib drivers app examples' \ + -v EXPRESSIONS='%ll*[xud]' \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Using %l format, prefer %PRI*64 if type is [u]int64_t' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + # forbid variable declaration inside "for" loop awk -v FOLDERS='.' \ -v EXPRESSIONS='for[[:space:]]*\\((char|u?int|unsigned|s?size_t)' \