[dpdk-dev,v3,22/24] rte_hash_crc.h: stack vars declared at top of function

Message ID 152609043291.121661.10977996123332031645.stgit@localhost.localdomain (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andy Green May 12, 2018, 2 a.m. UTC
  /projects/lagopus/src/dpdk/build/include/rte_hash_crc.h:
In function 'crc32c_2words':
/projects/lagopus/src/dpdk/build/include/rte_hash_crc.h:347:2:
warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
  uint32_t crc, term1, term2;

Signed-off-by: Andy Green <andy@warmcat.com>
---
 lib/librte_hash/rte_hash_crc.h |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Thomas Monjalon May 13, 2018, 8:44 p.m. UTC | #1
12/05/2018 04:00, Andy Green:
> /projects/lagopus/src/dpdk/build/include/rte_hash_crc.h:
> In function 'crc32c_2words':
> /projects/lagopus/src/dpdk/build/include/rte_hash_crc.h:347:2:
> warning: ISO C90 forbids mixed declarations and code
> [-Wdeclaration-after-statement]
>   uint32_t crc, term1, term2;

    Fixes: d983cf41698f ("hash: add software CRC32 implementation")
    Cc: stable@dpdk.org

> Signed-off-by: Andy Green <andy@warmcat.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_hash/rte_hash_crc.h b/lib/librte_hash/rte_hash_crc.h
index 479f84b14..5f5fb3db1 100644
--- a/lib/librte_hash/rte_hash_crc.h
+++ b/lib/librte_hash/rte_hash_crc.h
@@ -338,14 +338,13 @@  crc32c_1word(uint32_t data, uint32_t init_val)
 static inline uint32_t
 crc32c_2words(uint64_t data, uint32_t init_val)
 {
+	uint32_t crc, term1, term2;
 	union {
 		uint64_t u64;
 		uint32_t u32[2];
 	} d;
 	d.u64 = data;
 
-	uint32_t crc, term1, term2;
-
 	crc = init_val;
 	crc ^= d.u32[0];