[PATCH 3/3] buildtools/chkincs: check headers with stable API only

David Marchand david.marchand at redhat.com
Tue Oct 15 14:10:45 CEST 2024


An exported header should be usable w/ and w/o ALLOW_EXPERIMENTAL_API so
that an application that only wants stable API may include it.

Plus, the widely common case is that an application will not use
internal API.

Cover those cases but keep the original test.

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 buildtools/chkincs/meson.build | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
index 8da221fc33..787d70272b 100644
--- a/buildtools/chkincs/meson.build
+++ b/buildtools/chkincs/meson.build
@@ -12,8 +12,6 @@ gen_c_files = generator(gen_c_file_for_header,
         arguments: ['@INPUT@', '@OUTPUT@'])
 
 cflags = machine_args
-cflags += '-DALLOW_EXPERIMENTAL_API'
-cflags += '-DALLOW_INTERNAL_API'
 
 sources = files('main.c')
 sources += gen_c_files.process(dpdk_chkinc_headers)
@@ -32,6 +30,18 @@ executable('chkincs', sources,
         dependencies: deps,
         install: false)
 
+executable('chkincs-exp', sources,
+        c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'],
+        include_directories: includes,
+        dependencies: deps,
+        install: false)
+
+executable('chkincs-all', sources,
+        c_args: [cflags, '-DALLOW_EXPERIMENTAL_API', '-DALLOW_INTERNAL_API'],
+        include_directories: includes,
+        dependencies: deps,
+        install: false)
+
 # run tests for c++ builds also
 if not add_languages('cpp', required: false)
     subdir_done()
@@ -49,3 +59,16 @@ executable('chkincs-cpp', cpp_sources,
         include_directories: includes,
         dependencies: deps,
         install: false)
+
+executable('chkincs-cpp-exp', cpp_sources,
+        cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API'],
+        include_directories: includes,
+        dependencies: deps,
+        install: false)
+
+executable('chkincs-cpp-all', cpp_sources,
+        cpp_args: ['-include', 'rte_config.h', cflags, '-DALLOW_EXPERIMENTAL_API',
+                   '-DALLOW_INTERNAL_API'],
+        include_directories: includes,
+        dependencies: deps,
+        install: false)
-- 
2.46.2



More information about the dev mailing list