devtools: add llx format specifier check

Message ID 20210209152643.1832506-1-ferruh.yigit@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series devtools: add llx format specifier check |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing warning Testing issues
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS
ci/checkpatch success coding style OK

Commit Message

Ferruh Yigit Feb. 9, 2021, 3:26 p.m. UTC
  %llx tends to be wrong when used for fixed size, like uint64_t,
variables, adding a warning to double check them.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: David Marchand <david.marchand@redhat.com>
Cc: Aaron Conole <aconole@redhat.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Thomas Monjalon Feb. 9, 2021, 4:38 p.m. UTC | #1
09/02/2021 16:26, Ferruh Yigit:
> %llx tends to be wrong when used for fixed size, like uint64_t,
> variables, adding a warning to double check them.
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> +	# check %llx usage
> +	awk -v FOLDERS='lib drivers app examples' \
> +		-v EXPRESSIONS='%ll*[xud]' \
> +		-v RET_ON_FAIL=1 \
> +		-v MESSAGE='Please check %llx usage which tends to be wrong most of the times' \

+1

It reminds me this old email:
http://mails.dpdk.org/archives/dev/2018-February/091483.html

The title mentions llx, but it should be %ll in general:
	devtools: check %ll format specifier
  

Patch

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 78a408ef9823..68005389820a 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -118,6 +118,14 @@  check_forbidden_additions() { # <patch>
 		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
 		"$1" || res=1
 
+	# check %llx usage
+	awk -v FOLDERS='lib drivers app examples' \
+		-v EXPRESSIONS='%ll*[xud]' \
+		-v RET_ON_FAIL=1 \
+		-v MESSAGE='Please check %llx usage which tends to be wrong most of the times' \
+		-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' \