[1/2] hash: replace zero length array with flex array

Message ID 1706134657-17446-2-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series more replacement of zero length array |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff Jan. 24, 2024, 10:17 p.m. UTC
  Zero length arrays are GNU extension. Replace with
standard flex array.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/hash/rte_thash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Honnappa Nagarahalli Jan. 24, 2024, 10:57 p.m. UTC | #1
> -----Original Message-----
> From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Sent: Wednesday, January 24, 2024 4:18 PM
> To: dev@dpdk.org
> Cc: Bruce Richardson <bruce.richardson@intel.com>; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; Sameh Gobriel
> <sameh.gobriel@intel.com>; Vladimir Medvedkin
> <vladimir.medvedkin@intel.com>; Yipeng Wang <yipeng1.wang@intel.com>;
> Stephen Hemminger <stephen@networkplumber.org>; Tyler Retzlaff
> <roretzla@linux.microsoft.com>
> Subject: [PATCH 1/2] hash: replace zero length array with flex array
> 
> Zero length arrays are GNU extension. Replace with standard flex array.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>

> ---
>  lib/hash/rte_thash.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index e8de071..1982051
> 100644
> --- a/lib/hash/rte_thash.c
> +++ b/lib/hash/rte_thash.c
> @@ -80,7 +80,7 @@ struct rte_thash_subtuple_helper {
>  	uint32_t	tuple_offset;	/** < Offset in bits of the subtuple */
>  	uint32_t	tuple_len;	/** < Length in bits of the subtuple */
>  	uint32_t	lsb_msk;	/** < (1 << reta_sz_log) - 1 */
> -	__extension__ uint32_t	compl_table[0] __rte_cache_aligned;
> +	uint32_t	compl_table[] __rte_cache_aligned;
>  	/** < Complementary table */
>  };
> 
> @@ -93,7 +93,7 @@ struct rte_thash_ctx {
>  	uint32_t	flags;
>  	uint64_t	*matrices;
>  	/**< matrices used with rte_thash_gfni implementation */
> -	uint8_t		hash_key[0];
> +	uint8_t		hash_key[];
>  };
> 
>  int
> --
> 1.8.3.1
  
Morten Brørup Jan. 25, 2024, 7:16 a.m. UTC | #2
> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Wednesday, 24 January 2024 23.18
flex array
> 
> Zero length arrays are GNU extension. Replace with
> standard flex array.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
  

Patch

diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c
index e8de071..1982051 100644
--- a/lib/hash/rte_thash.c
+++ b/lib/hash/rte_thash.c
@@ -80,7 +80,7 @@  struct rte_thash_subtuple_helper {
 	uint32_t	tuple_offset;	/** < Offset in bits of the subtuple */
 	uint32_t	tuple_len;	/** < Length in bits of the subtuple */
 	uint32_t	lsb_msk;	/** < (1 << reta_sz_log) - 1 */
-	__extension__ uint32_t	compl_table[0] __rte_cache_aligned;
+	uint32_t	compl_table[] __rte_cache_aligned;
 	/** < Complementary table */
 };
 
@@ -93,7 +93,7 @@  struct rte_thash_ctx {
 	uint32_t	flags;
 	uint64_t	*matrices;
 	/**< matrices used with rte_thash_gfni implementation */
-	uint8_t		hash_key[0];
+	uint8_t		hash_key[];
 };
 
 int