[v5,1/6] hash: replace zero length array with flex array

Message ID 1709756036-24068-2-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series more replacement of zero length array |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff March 6, 2024, 8:13 p.m. UTC
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>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/hash/rte_thash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Vladimir Medvedkin March 6, 2024, 8:52 p.m. UTC | #1
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

On 06/03/2024 20:13, Tyler Retzlaff wrote:
> 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>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
> Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>   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 68f653f..10721ef 100644
> --- a/lib/hash/rte_thash.c
> +++ b/lib/hash/rte_thash.c
> @@ -81,7 +81,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__ alignas(RTE_CACHE_LINE_SIZE) uint32_t	compl_table[0];
> +	alignas(RTE_CACHE_LINE_SIZE) uint32_t	compl_table[];
>   	/** < Complementary table */
>   };
>   
> @@ -94,7 +94,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
  

Patch

diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c
index 68f653f..10721ef 100644
--- a/lib/hash/rte_thash.c
+++ b/lib/hash/rte_thash.c
@@ -81,7 +81,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__ alignas(RTE_CACHE_LINE_SIZE) uint32_t	compl_table[0];
+	alignas(RTE_CACHE_LINE_SIZE) uint32_t	compl_table[];
 	/** < Complementary table */
 };
 
@@ -94,7 +94,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