buildtools/chkincs: test headers for C++ compatibility

Add support for checking each of our headers for issues when included in
a C++ file.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
Bruce Richardson 2022-02-11 11:36:41 +00:00 committed by Thomas Monjalon
parent b93ad98c35
commit 5e437164df
5 changed files with 26 additions and 2 deletions

View File

@ -74,6 +74,7 @@ fi
if [ "$BUILD_32BIT" = "true" ]; then if [ "$BUILD_32BIT" = "true" ]; then
OPTS="$OPTS -Dc_args=-m32 -Dc_link_args=-m32" OPTS="$OPTS -Dc_args=-m32 -Dc_link_args=-m32"
OPTS="$OPTS -Dcpp_args=-m32 -Dcpp_link_args=-m32"
export PKG_CONFIG_LIBDIR="/usr/lib32/pkgconfig" export PKG_CONFIG_LIBDIR="/usr/lib32/pkgconfig"
fi fi

View File

@ -116,7 +116,7 @@ jobs:
libdw-dev libdw-dev
- name: Install i386 cross compiling packages - name: Install i386 cross compiling packages
if: env.BUILD_32BIT == 'true' if: env.BUILD_32BIT == 'true'
run: sudo apt install -y gcc-multilib run: sudo apt install -y gcc-multilib g++-multilib
- name: Install aarch64 cross compiling packages - name: Install aarch64 cross compiling packages
if: env.AARCH64 == 'true' if: env.AARCH64 == 'true'
run: sudo apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross run: sudo apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross

View File

@ -0,0 +1,4 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2021 Intel Corporation
*/
int main(void) { return 0; }

View File

@ -27,3 +27,21 @@ executable('chkincs', sources,
include_directories: includes, include_directories: includes,
dependencies: deps, dependencies: deps,
install: false) install: false)
# run tests for c++ builds also
if not add_languages('cpp', required: false)
subdir_done()
endif
gen_cpp_files = generator(gen_c_file_for_header,
output: '@BASENAME@.cpp',
arguments: ['@INPUT@', '@OUTPUT@'])
cpp_sources = files('main.cpp')
cpp_sources += gen_cpp_files.process(dpdk_chkinc_headers)
executable('chkincs-cpp', cpp_sources,
cpp_args: ['-include', 'rte_config.h', cflags],
include_directories: includes,
dependencies: deps,
install: false)

View File

@ -246,7 +246,8 @@ if check_cc_flags '-m32' ; then
export PKG_CONFIG_LIBDIR='/usr/lib/pkgconfig' export PKG_CONFIG_LIBDIR='/usr/lib/pkgconfig'
fi fi
target_override='i386-pc-linux-gnu' target_override='i386-pc-linux-gnu'
build build-32b cc ABI -Dc_args='-m32' -Dc_link_args='-m32' build build-32b cc ABI -Dc_args='-m32' -Dc_link_args='-m32' \
-Dcpp_args='-m32' -Dcpp_link_args='-m32'
target_override= target_override=
unset PKG_CONFIG_LIBDIR unset PKG_CONFIG_LIBDIR
fi fi