devtools: forbid variable declaration inside for
authorThomas Monjalon <thomas@monjalon.net>
Sun, 24 May 2020 17:30:07 +0000 (19:30 +0200)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 3 Jul 2020 08:04:15 +0000 (10:04 +0200)
commit43e73483a4b80f7a7673ab6656c2159ed768ca07
treed24e3b28af87f2be54fe8b7cd38ea5b1a4192a55
parentb98447077b0609750c10b84b7b2e7be0c8504fad
devtools: forbid variable declaration inside for

Some compilers raise an error when declaring a variable
in the middle of a function. This is a C99 allowance.
Even if DPDK switches globally to C99 or C11 standard,
the coding rules are for declarations at the beginning
of a block:
http://doc.dpdk.org/guides/contributing/coding_style.html#local-variables

This coding style is enforced by adding a check of
the common patterns like "for (int i;"

The occurrences of the checked pattern are fixed:
'for *(\(char\|u\?int\|unsigned\|s\?size_t\)'
In the file dpaa2_sparser.c, the fix is to remove the unused macros.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
devtools/checkpatches.sh
doc/guides/prog_guide/eventdev.rst
drivers/common/mlx5/linux/mlx5_glue.c
drivers/common/mlx5/mlx5_devx_cmds.c
drivers/crypto/caam_jr/caam_jr.c
drivers/net/dpaa2/dpaa2_sparser.c