diff mbox series

[v4,3/4] build: indicate usage at build time for public headers

Message ID 20210306000500.8698-4-dmitry.kozliuk@gmail.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series eal/windows: do not expose POSIX symbols | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Dmitry Kozlyuk March 6, 2021, 12:04 a.m. UTC
DPDK code often relies on functions that are not standard C,
but are found on all platforms, even if by slightly different names.
Some headers provide macros or inline difinitions for such symbols.
However, when placed in public headers, these symbols are unnecessarily
exposed to DPDK consumers.

Define RTE_BUILD_INTERNAL at build time.
In its presense public headers can provide additional definitions
for internal code, but hide them from external consumers.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 config/meson.build | 3 +++
 1 file changed, 3 insertions(+)

Comments

Thomas Monjalon March 16, 2021, 9:59 a.m. UTC | #1
06/03/2021 01:04, Dmitry Kozlyuk:
> DPDK code often relies on functions that are not standard C,
> but are found on all platforms, even if by slightly different names.
> Some headers provide macros or inline difinitions for such symbols.
> However, when placed in public headers, these symbols are unnecessarily
> exposed to DPDK consumers.
> 
> Define RTE_BUILD_INTERNAL at build time.
> In its presense public headers can provide additional definitions
> for internal code, but hide them from external consumers.

Is there a way to split public and internal headers,
and avoid playing with RTE_BUILD_INTERNAL?
diff mbox series

Patch

diff --git a/config/meson.build b/config/meson.build
index 3cf560b8a..51a49855c 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -287,6 +287,9 @@  dpdk_conf.set('RTE_EAL_VFIO', is_linux)
 # specify -D_GNU_SOURCE unconditionally
 add_project_arguments('-D_GNU_SOURCE', language: 'c')
 
+# specify that sources are building as part of DPDK
+add_project_arguments('-DRTE_BUILD_INTERNAL', language: 'c')
+
 # specify -D__BSD_VISIBLE for FreeBSD
 if is_freebsd
 	add_project_arguments('-D__BSD_VISIBLE', language: 'c')