From 3aec2d14d646b57f5529534b26e8bcbd0a918d94 Mon Sep 17 00:00:00 2001 From: Adrien Mazarguil Date: Fri, 30 Jun 2017 19:19:08 +0200 Subject: [PATCH] net/mlx: update C compliance standard This commit addresses a compilation issue against Glibc >= 2.25, which implements assert() through a nonstandard ({ }) construct. Such constructs can normally not be used without __extension__ keyword when -pedantic is enabled, as is the case when compiling mlx4 and mlx5 PMDs in debug mode. While assert.h checks for the compiler ability to support GNU extensions, Clang, unlike GCC, does not allow the above syntax when combining -std=gnu99 with -pedantic. Work around missing keyword by moving these PMDs to a stricter compliance standard without GNU extensions but properly checked by Glibc. Doing so is supported on the DPDK side since includes have been cleaned up. Even in C11, using types other than _Bool or signed/unsigned int for bit-fields is an extension. Some GCC versions complain about that when -pedantic checks are enabled. The RTE_STD_C11 macro correctly prevented this issue with C99 but not with C11 as it becomes a no-op. Forcing the extension keyword addresses it. Signed-off-by: Adrien Mazarguil Tested-by: Yongseok Koh --- drivers/net/mlx4/Makefile | 2 +- drivers/net/mlx5/Makefile | 2 +- drivers/net/mlx5/mlx5_rxtx.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile index e873fb4805..755c8a4f3a 100644 --- a/drivers/net/mlx4/Makefile +++ b/drivers/net/mlx4/Makefile @@ -40,7 +40,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_flow.c # Basic CFLAGS. CFLAGS += -O3 -CFLAGS += -std=gnu99 -Wall -Wextra +CFLAGS += -std=c11 -Wall -Wextra CFLAGS += -g CFLAGS += -I. CFLAGS += -D_BSD_SOURCE diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index daf80134bc..8b8f6eaac6 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -52,7 +52,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_flow.c # Basic CFLAGS. CFLAGS += -O3 -CFLAGS += -std=gnu99 -Wall -Wextra +CFLAGS += -std=c11 -Wall -Wextra CFLAGS += -g CFLAGS += -I. CFLAGS += -D_BSD_SOURCE diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 450a569667..4195665f87 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -240,7 +240,7 @@ struct hash_rxq { }; /* TX queue descriptor. */ -RTE_STD_C11 +__extension__ struct txq { uint16_t elts_head; /* Current index in (*elts)[]. */ uint16_t elts_tail; /* First element awaiting completion. */ -- 2.20.1