From nobody Sat May 11 20:09:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) client-ip=209.85.221.51; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f51.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1621185028; cv=none; d=zohomail.com; s=zohoarc; b=hIMN+PC2jOIdXkzIrQIEhK7Zmyr3uwWcfD5QflJz3QhibuMWwFJIUpszXoO6ePAPSI4gWg8vpx4nXKd7DodmqCFhGJY/EXCdQIPCW/G47uc/vTzLmmG0cya6fqZyXCZ7/qra0uHkNFw+lhZ75LJdPp9K3rN2FME2iyUY3g7PA7M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621185028; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Sender:Subject:To; bh=0P5Fx5SuV8faClmAUI+F8RjAJD5UOdXGEqtptqHamIw=; b=D+lkdujuBVcycXUcILI5nVukqruW/ohyaoAtHfoj+TDoK2t3K9C+hmZuT9PqyVsV0kA5EzcXj/b2ToRda3bOwfJnbnqR7SDNgriX40jjpkQpSolV0jZC+Q9XrPCUHHWoRMS1G7ittjJAdB7KH+0uG8ULtfe7HK59Cf6AZKr3Kgo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.51 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mx.zohomail.com with SMTPS id 1621185028204402.44015781463133; Sun, 16 May 2021 10:10:28 -0700 (PDT) Received: by mail-wr1-f51.google.com with SMTP id x8so4011330wrq.9 for ; Sun, 16 May 2021 10:10:27 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (31.red-83-51-215.dynamicip.rima-tde.net. [83.51.215.31]) by smtp.gmail.com with ESMTPSA id b10sm16248370wrr.27.2021.05.16.10.10.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 May 2021 10:10:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0P5Fx5SuV8faClmAUI+F8RjAJD5UOdXGEqtptqHamIw=; b=J9wt2IyXWyla1h0HUBd0bhETTyLtNgosjQLJ5QMkYJ7mmrcAYPhLpOaAH8UnKvHI7b hhK2TSfgldF3Twlqe+F0Z4EMovF61kcuOED3oTKeAWNxOgCyu5QAlT/PKfWXLGtPteSh m4sNY/xlF5qG5fyDjlB1gsFnzemBQEPymBN39E185XdRkERWrOgnJLB7/suVwMJw8rZS NJuQDxJJNOVh0A+mCW0PyhxThXlEMVjM1LRjoWMl0/imz2TNno/sdpj9uejcGG8uSD+c 1wvJGEQLxJSpVHdtDQQ1KwXKvfebMbxZYlpjMpwFV04SscwyQs8YC0vGdvK//dPmW8K2 eoTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=0P5Fx5SuV8faClmAUI+F8RjAJD5UOdXGEqtptqHamIw=; b=K/pHMePgc0svf6OgVDqIAdQvTQQDaAov6HUowlMA0lj4W+5H8XN6MCDC4V/3D/oMsn AeP1OeJW8kO4rYxvnh8cpAJxxGNvYMwIXB3JMAVLtRuW+9ygsJAKbw7d/CFp+UlipMLK 9d1wb3hSquq7NfMzak9cFdeLYY3e5dXVpR/dtO9Llg+ECh5fzOOZP9Bf+RbD7f4cKr8c 3lq6DWTi7jKFYa7P6LtK+pDrmK08yk78dAF2UB8I8C6jen8xahsL80IJjF0bq+3kSAnJ vq7s1vIggZgMz/P4vOTpBkd8uFn56SGwcWFvFbVQpPieqY8uNKucfYtj99cTvKUW67MA VQug== X-Gm-Message-State: AOAM531CTp5r2V02+VZobHp/QiLuVVXlfSwaD5B+0hyz9KhieP0U7tAB sFYJOUq1HMkRg13gY1UzydE= X-Google-Smtp-Source: ABdhPJz41svpws81egDmU8lGnC2yPsSBL1kTeV0Q5hSxBREMwvv/7f2yz2ZfNt8hHz+uDrk9xlL6gA== X-Received: by 2002:a05:6000:1c1:: with SMTP id t1mr69077150wrx.421.1621185026510; Sun, 16 May 2021 10:10:26 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Peter Maydell , Richard Henderson , Eric Blake , Michael Tokarev , qemu-arm@nongnu.org, =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PATCH v2] disas/libvixl: Protect C system header for C++ compiler Date: Sun, 16 May 2021 19:10:23 +0200 Message-Id: <20210516171023.510778-1-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) When selecting an ARM target on Debian unstable, we get: Compiling C++ object libcommon.fa.p/disas_libvixl_vixl_utils.cc.o FAILED: libcommon.fa.p/disas_libvixl_vixl_utils.cc.o c++ -Ilibcommon.fa.p -I. -I.. [...] -o libcommon.fa.p/disas_libvixl_vixl_= utils.cc.o -c ../disas/libvixl/vixl/utils.cc In file included from /home/philmd/qemu/disas/libvixl/vixl/utils.h:30, from ../disas/libvixl/vixl/utils.cc:27: /usr/include/string.h:36:43: error: missing binary operator before token = "(" 36 | #if defined __cplusplus && (__GNUC_PREREQ (4, 4) \ | ^ /usr/include/string.h:53:62: error: missing binary operator before token = "(" 53 | #if defined __USE_MISC || defined __USE_XOPEN || __GLIBC_USE (ISO= C2X) | ^ /usr/include/string.h:165:21: error: missing binary operator before token= "(" 165 | || __GLIBC_USE (LIB_EXT2) || __GLIBC_USE (ISOC2X)) | ^ /usr/include/string.h:174:43: error: missing binary operator before token= "(" 174 | #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) || __GLIBC_U= SE (ISOC2X) | ^ /usr/include/string.h:492:19: error: missing binary operator before token= "(" 492 | #if __GNUC_PREREQ (3,4) | ^ Relevant information from the host: $ lsb_release -d Description: Debian GNU/Linux 11 (bullseye) $ gcc --version gcc (Debian 10.2.1-6) 10.2.1 20210110 $ dpkg -S /usr/include/string.h libc6-dev: /usr/include/string.h $ apt-cache show libc6-dev Package: libc6-dev Version: 2.31-11 Partially cherry-pick vixl commit 78973f258039f6e96 [*]: Refactor VIXL to use `extern` block when including C header that do not have a C++ counterpart. which is similar to commit 875df03b221 ('osdep: protect qemu/osdep.h with extern "C"'). [*] https://git.linaro.org/arm/vixl.git/commit/?id=3D78973f258039f6e96 Buglink: https://bugs.launchpad.net/qemu/+bug/1914870 Suggested-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth --- disas/libvixl/vixl/code-buffer.h | 2 +- disas/libvixl/vixl/globals.h | 16 +++++++++------- disas/libvixl/vixl/invalset.h | 2 +- disas/libvixl/vixl/platform.h | 2 ++ disas/libvixl/vixl/utils.h | 2 +- disas/libvixl/vixl/utils.cc | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/disas/libvixl/vixl/code-buffer.h b/disas/libvixl/vixl/code-buf= fer.h index f93ebb6b822..b95babbdee2 100644 --- a/disas/libvixl/vixl/code-buffer.h +++ b/disas/libvixl/vixl/code-buffer.h @@ -27,7 +27,7 @@ #ifndef VIXL_CODE_BUFFER_H #define VIXL_CODE_BUFFER_H =20 -#include +#include #include "vixl/globals.h" =20 namespace vixl { diff --git a/disas/libvixl/vixl/globals.h b/disas/libvixl/vixl/globals.h index 7099aa599fb..3a71942f1e5 100644 --- a/disas/libvixl/vixl/globals.h +++ b/disas/libvixl/vixl/globals.h @@ -40,15 +40,17 @@ #define __STDC_FORMAT_MACROS #endif =20 -#include +extern "C" { #include - -#include -#include -#include #include -#include -#include +} + +#include +#include +#include +#include +#include + #include "vixl/platform.h" =20 =20 diff --git a/disas/libvixl/vixl/invalset.h b/disas/libvixl/vixl/invalset.h index ffdc0237b47..2e0871f8c3f 100644 --- a/disas/libvixl/vixl/invalset.h +++ b/disas/libvixl/vixl/invalset.h @@ -27,7 +27,7 @@ #ifndef VIXL_INVALSET_H_ #define VIXL_INVALSET_H_ =20 -#include +#include =20 #include #include diff --git a/disas/libvixl/vixl/platform.h b/disas/libvixl/vixl/platform.h index ab588f07f54..26a74de81bb 100644 --- a/disas/libvixl/vixl/platform.h +++ b/disas/libvixl/vixl/platform.h @@ -28,7 +28,9 @@ #define PLATFORM_H =20 // Define platform specific functionalities. +extern "C" { #include +} =20 namespace vixl { inline void HostBreakpoint() { raise(SIGINT); } diff --git a/disas/libvixl/vixl/utils.h b/disas/libvixl/vixl/utils.h index 5ab134e240a..ecb0f1014ab 100644 --- a/disas/libvixl/vixl/utils.h +++ b/disas/libvixl/vixl/utils.h @@ -27,8 +27,8 @@ #ifndef VIXL_UTILS_H #define VIXL_UTILS_H =20 -#include #include +#include #include "vixl/globals.h" #include "vixl/compiler-intrinsics.h" =20 diff --git a/disas/libvixl/vixl/utils.cc b/disas/libvixl/vixl/utils.cc index 3b8bd75fba1..69304d266d7 100644 --- a/disas/libvixl/vixl/utils.cc +++ b/disas/libvixl/vixl/utils.cc @@ -25,7 +25,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =20 #include "vixl/utils.h" -#include +#include =20 namespace vixl { =20 --=20 2.26.3