From 4db1ee388bbcad8ec9ea39ad2d7c5b7e3700fd66 Mon Sep 17 00:00:00 2001 From: David Marchand Date: Wed, 18 Oct 2023 10:02:16 +0200 Subject: [PATCH] buildtools/chkincs: check headers without internal API Checking all headers with internal symbols may let some incorrect calls leak in normal applications headers. Track the driver headers in a new list and check it with ALLOW_INTERNAL_API. At the same time, include driver headers from bus drivers. Fixes: b232b2aa212b ("buildtools/chkincs: check SDK headers for C++ compatibility") Signed-off-by: David Marchand --- buildtools/chkincs/meson.build | 16 ++++++++++++++-- drivers/meson.build | 1 + lib/meson.build | 2 +- meson.build | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build index 04187fa872f..b4882b400ca 100644 --- a/buildtools/chkincs/meson.build +++ b/buildtools/chkincs/meson.build @@ -12,7 +12,6 @@ gen_c_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cflags = machine_args -cflags += '-DALLOW_INTERNAL_API' sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers) @@ -39,6 +38,19 @@ executable('chkincs-exp', sources, dependencies: deps, install: false) +cflags += '-DALLOW_INTERNAL_API' + +if dpdk_chkinc_driver_headers.length() != 0 + sources_driver = files('main.c') + sources_driver += gen_c_files.process(dpdk_chkinc_driver_headers) + + executable('chkincs-driver', sources_driver, + c_args: cflags, + include_directories: includes, + dependencies: deps, + install: false) +endif + # run tests for c++ builds also if not add_languages('cpp', required: false) subdir_done() @@ -59,7 +71,7 @@ gen_cpp_files = generator(gen_c_file_for_header, arguments: ['@INPUT@', '@OUTPUT@']) cpp_sources = files('main.cpp') -cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers) +cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers + dpdk_chkinc_driver_headers) executable('chkincs-cpp', cpp_sources, cpp_args: ['-include', 'rte_config.h', cflags], diff --git a/drivers/meson.build b/drivers/meson.build index 8c775bbe62e..2e6327845f8 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -218,6 +218,7 @@ foreach subpath:subdirs if get_option('enable_driver_sdk') install_headers(driver_sdk_headers) endif + dpdk_chkinc_driver_headers += driver_sdk_headers if headers.length() > 0 dpdk_includes += include_directories(drv_path) diff --git a/lib/meson.build b/lib/meson.build index 6c143ce5a60..2720bddc845 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -240,7 +240,7 @@ foreach l:libraries install_headers(driver_sdk_headers) endif dpdk_chkinc_headers += headers - dpdk_chkinc_headers += driver_sdk_headers + dpdk_chkinc_driver_headers += driver_sdk_headers libname = 'rte_' + name includes += include_directories(l) diff --git a/meson.build b/meson.build index 5e161f43e58..b5516b986c4 100644 --- a/meson.build +++ b/meson.build @@ -39,6 +39,7 @@ dpdk_static_libraries = [] dpdk_shared_lib_deps = [] dpdk_static_lib_deps = [] dpdk_chkinc_headers = [] +dpdk_chkinc_driver_headers = [] dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = []