DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	Aaron Conole <aconole@redhat.com>,
	Michael Santana <maicolgabriel@hotmail.com>
Subject: [PATCH v5 2/2] buildtools/chkincs: test headers for C++ compatibility
Date: Fri, 11 Feb 2022 11:36:41 +0000	[thread overview]
Message-ID: <20220211113641.755308-3-bruce.richardson@intel.com> (raw)
In-Reply-To: <20220211113641.755308-1-bruce.richardson@intel.com>

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>
---
 .ci/linux-build.sh             |  1 +
 .github/workflows/build.yml    |  2 +-
 buildtools/chkincs/main.cpp    |  4 ++++
 buildtools/chkincs/meson.build | 18 ++++++++++++++++++
 devtools/test-meson-builds.sh  |  3 ++-
 5 files changed, 26 insertions(+), 2 deletions(-)
 create mode 100644 buildtools/chkincs/main.cpp

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index c10c1a8ab5..67d68535e0 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -74,6 +74,7 @@ fi
 
 if [ "$BUILD_32BIT" = "true" ]; then
     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"
 fi
 
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 6cf997d6ee..d30cfd08d7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -116,7 +116,7 @@ jobs:
           libdw-dev
     - name: Install i386 cross compiling packages
       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
       if: env.AARCH64 == 'true'
       run: sudo apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
diff --git a/buildtools/chkincs/main.cpp b/buildtools/chkincs/main.cpp
new file mode 100644
index 0000000000..d25bb8852a
--- /dev/null
+++ b/buildtools/chkincs/main.cpp
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Intel Corporation
+ */
+int main(void) { return 0; }
diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build
index 7ea136ff95..790f700619 100644
--- a/buildtools/chkincs/meson.build
+++ b/buildtools/chkincs/meson.build
@@ -27,3 +27,21 @@ executable('chkincs', sources,
         include_directories: includes,
         dependencies: deps,
         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)
diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 4ed61328b9..c07fd16fdc 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -246,7 +246,8 @@ if check_cc_flags '-m32' ; then
 		export PKG_CONFIG_LIBDIR='/usr/lib/pkgconfig'
 	fi
 	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=
 	unset PKG_CONFIG_LIBDIR
 fi
-- 
2.32.0


  parent reply	other threads:[~2022-02-11 11:37 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04 17:42 [PATCH 0/7] Verify C++ compatibility of public headers Bruce Richardson
2022-02-04 17:42 ` [PATCH 1/7] eal: fix header build with C++ Bruce Richardson
2022-02-04 17:42 ` [PATCH 2/7] eventdev: " Bruce Richardson
2022-02-07  9:40   ` Jerin Jacob
2022-02-04 17:42 ` [PATCH 3/7] graph: add explicit cast to allow C++ build Bruce Richardson
2022-02-04 18:12   ` Stephen Hemminger
2022-02-07  9:41     ` Jerin Jacob
2022-02-04 17:42 ` [PATCH 4/7] ipsec: " Bruce Richardson
2022-02-04 17:42 ` [PATCH 5/7] table: add explicit casts for C++ compatibility Bruce Richardson
2022-02-04 17:42 ` [PATCH 6/7] vhost: remove non-C++ compatible includes Bruce Richardson
2022-02-04 18:18   ` Bruce Richardson
2022-02-09  9:10     ` Wang, Xiao W
2022-02-09  9:21       ` Bruce Richardson
2022-02-04 17:42 ` [PATCH 7/7] buildtools/chkincs: test headers for C++ compatibility Bruce Richardson
2022-02-10 12:02 ` [PATCH v2 0/7] Verify C++ compatibility of public headers Bruce Richardson
2022-02-10 12:02   ` [PATCH v2 1/7] eal: fix header build with C++ Bruce Richardson
2022-02-10 12:57     ` David Marchand
2022-02-10 14:07       ` Bruce Richardson
2022-02-10 12:02   ` [PATCH v2 2/7] eventdev: " Bruce Richardson
2022-02-10 12:02   ` [PATCH v2 3/7] graph: fix missing explicit cast for C++ build Bruce Richardson
2022-02-10 12:02   ` [PATCH v2 4/7] ipsec: " Bruce Richardson
2022-02-10 12:42     ` Ananyev, Konstantin
2022-02-10 12:02   ` [PATCH v2 5/7] table: fix missing explicit casts " Bruce Richardson
2022-02-10 12:02   ` [PATCH v2 6/7] vhost: fix incompatible header includes for C++ Bruce Richardson
2022-02-10 12:02   ` [PATCH v2 7/7] buildtools/chkincs: test headers for C++ compatibility Bruce Richardson
2022-02-10 14:03 ` [PATCH v3 0/7] Verify C++ compatibility of public headers Bruce Richardson
2022-02-10 14:03   ` [PATCH v3 1/7] eal: fix header build with C++ Bruce Richardson
2022-02-10 14:03   ` [PATCH v3 2/7] eventdev: " Bruce Richardson
2022-02-10 14:03   ` [PATCH v3 3/7] graph: fix missing explicit cast for C++ build Bruce Richardson
2022-02-10 14:03   ` [PATCH v3 4/7] ipsec: " Bruce Richardson
2022-02-10 14:03   ` [PATCH v3 5/7] table: fix missing explicit casts " Bruce Richardson
2022-02-10 14:03   ` [PATCH v3 6/7] vhost: fix incompatible header includes for C++ Bruce Richardson
2022-02-10 14:03   ` [PATCH v3 7/7] buildtools/chkincs: test headers for C++ compatibility Bruce Richardson
2022-02-10 14:37     ` David Marchand
2022-02-10 15:21       ` Bruce Richardson
2022-02-10 15:42 ` [PATCH v4 0/7] Verify C++ compatibility of public headers Bruce Richardson
2022-02-10 15:42   ` [PATCH v4 1/7] eal: fix header build with C++ Bruce Richardson
2022-02-14  9:30     ` Joyce Kong
2022-02-10 15:42   ` [PATCH v4 2/7] eventdev: " Bruce Richardson
2022-02-10 15:42   ` [PATCH v4 3/7] graph: fix missing explicit cast for C++ build Bruce Richardson
2022-02-10 15:42   ` [PATCH v4 4/7] ipsec: " Bruce Richardson
2022-02-10 15:42   ` [PATCH v4 5/7] table: fix missing explicit casts " Bruce Richardson
2022-02-10 15:42   ` [PATCH v4 6/7] vhost: fix incompatible header includes for C++ Bruce Richardson
2022-02-10 15:42   ` [PATCH v4 7/7] buildtools/chkincs: test headers for C++ compatibility Bruce Richardson
2022-02-10 21:58     ` Thomas Monjalon
2022-02-11 10:31       ` Bruce Richardson
2022-02-11 10:57         ` Bruce Richardson
2022-02-11 17:22           ` Thomas Monjalon
2022-02-10 22:07   ` [PATCH v4 0/7] Verify C++ compatibility of public headers Thomas Monjalon
2022-02-11 11:36 ` [PATCH v5 0/2] " Bruce Richardson
2022-02-11 11:36   ` [PATCH v5 1/2] buildtools/chkincs: remove unnecesary linkage Bruce Richardson
2022-02-11 11:36   ` Bruce Richardson [this message]
2022-02-12 13:27   ` [PATCH v5 0/2] Verify C++ compatibility of public headers Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220211113641.755308-3-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=aconole@redhat.com \
    --cc=dev@dpdk.org \
    --cc=maicolgabriel@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).