[dpdk-dev] [PATCH v7 04/17] build: remove redundant _GNU_SOURCE definitions

Thomas Monjalon thomas at monjalon.net
Fri Mar 19 15:57:17 CET 2021


The feature macro _GNU_SOURCE is defined globally,
but there was some remaining useless settings.

The internal definition in config/meson.build is kept,
all other internal definitions of _GNU_SOURCE are removed,
except in examples, which can be built as external applications.
Note: external applications do not inherit of _GNU_SOURCE.

Fixes: 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default")
Fixes: 28188cee2aa0 ("build: enable BSD features visibility for FreeBSD")
Fixes: e6cdc54cc0ef ("net/mlx5: add socket server for external tools")
Cc: stable at dpdk.org

Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
Acked-by: David Marchand <david.marchand at redhat.com>
---
 app/test/meson.build                     | 2 --
 drivers/bus/fslmc/qbman/include/compat.h | 3 ---
 drivers/common/dpaax/compat.h            | 4 ----
 drivers/common/dpaax/meson.build         | 1 -
 drivers/net/memif/rte_eth_memif.h        | 4 ----
 drivers/net/mlx5/linux/mlx5_socket.c     | 4 ----
 6 files changed, 18 deletions(-)

diff --git a/app/test/meson.build b/app/test/meson.build
index 099895fc87..76eaaea457 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -398,8 +398,6 @@ if cc.has_argument('-Wno-format-truncation')
     cflags += '-Wno-format-truncation'
 endif
 
-# specify -D_GNU_SOURCE unconditionally
-cflags += '-D_GNU_SOURCE'
 # Strict-aliasing rules are violated by uint8_t[] to context size casts.
 cflags += '-fno-strict-aliasing'
 
diff --git a/drivers/bus/fslmc/qbman/include/compat.h b/drivers/bus/fslmc/qbman/include/compat.h
index 1ddd69e127..a4471a80af 100644
--- a/drivers/bus/fslmc/qbman/include/compat.h
+++ b/drivers/bus/fslmc/qbman/include/compat.h
@@ -8,9 +8,6 @@
 #ifndef HEADER_COMPAT_H
 #define HEADER_COMPAT_H
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
diff --git a/drivers/common/dpaax/compat.h b/drivers/common/dpaax/compat.h
index 1a5f36e99e..c69e76ab96 100644
--- a/drivers/common/dpaax/compat.h
+++ b/drivers/common/dpaax/compat.h
@@ -10,10 +10,6 @@
 #define __COMPAT_H
 
 #include <sched.h>
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #include <stdint.h>
 #include <stdlib.h>
 #include <stddef.h>
diff --git a/drivers/common/dpaax/meson.build b/drivers/common/dpaax/meson.build
index 4535482701..b7f177a62e 100644
--- a/drivers/common/dpaax/meson.build
+++ b/drivers/common/dpaax/meson.build
@@ -10,7 +10,6 @@ sources = files('dpaax_iova_table.c', 'dpaa_of.c', 'caamflib.c')
 
 includes += include_directories('caamflib')
 
-cflags += ['-D_GNU_SOURCE']
 if cc.has_argument('-Wno-cast-qual')
 	cflags += '-Wno-cast-qual'
 endif
diff --git a/drivers/net/memif/rte_eth_memif.h b/drivers/net/memif/rte_eth_memif.h
index 24321d3a39..2038bda742 100644
--- a/drivers/net/memif/rte_eth_memif.h
+++ b/drivers/net/memif/rte_eth_memif.h
@@ -5,10 +5,6 @@
 #ifndef _RTE_ETH_MEMIF_H_
 #define _RTE_ETH_MEMIF_H_
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif				/* GNU_SOURCE */
-
 #include <sys/queue.h>
 
 #include <ethdev_driver.h>
diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c
index 1938453980..b1f41bc102 100644
--- a/drivers/net/mlx5/linux/mlx5_socket.c
+++ b/drivers/net/mlx5/linux/mlx5_socket.c
@@ -2,10 +2,6 @@
  * Copyright 2019 Mellanox Technologies, Ltd
  */
 
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-- 
2.30.1



More information about the dev mailing list