Skip to content

Commit

Permalink
buildtools/chkincs: check headers without internal API
Browse files Browse the repository at this point in the history
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: b232b2a ("buildtools/chkincs: check SDK headers for C++ compatibility")

Signed-off-by: David Marchand <[email protected]>
  • Loading branch information
david-marchand committed Oct 18, 2023
1 parent 5b1515a commit 4db1ee3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
16 changes: 14 additions & 2 deletions buildtools/chkincs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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],
Expand Down
1 change: 1 addition & 0 deletions drivers/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down

0 comments on commit 4db1ee3

Please sign in to comment.