From nobody Fri Apr 26 14:46:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1618581520; cv=none; d=zohomail.com; s=zohoarc; b=dCM8f0SSXjsvjz0zUwcUQXLd8QLxP7OE1B/gpXU+W5UeyOCuOw3TI6lAmeYJRPxAX4lT1yYBZesuXZjE0f+efWP24qgOm53KcoBmOy2u7EJuongKALGYorxOpNfuRdyUuF5449PVHV5FUBEEXGtKFo0sU/L/PEMjymZQCYRPV3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618581520; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AtdhNpA3BF6tCi5f8+toaQnoZ0KKS5XaxPZHuzEnrl4=; b=Bq2lMMpn0WTAKC6OE7EOenyCRkyV2kjiq52RSNu5f0rNK2tqZxUG36tvMeziz9qBtRuYBry79FD2KTK00jVTGcWzdU9Or+SaMOkPSWS4k2Lhv3eeVE+CxVSiUysm6d31XCoHzc9vv4gH9gdZPuUftK2pS1lChssKXI3Nq5K9d2M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161858152036923.026708560986208; Fri, 16 Apr 2021 06:58:40 -0700 (PDT) Received: from localhost ([::1]:36390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXOzX-0002GL-1I for importer@patchew.org; Fri, 16 Apr 2021 09:58:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXOwp-0007JC-Rg for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:51 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:46688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXOwl-0004wI-55 for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:51 -0400 Received: by mail-wr1-x430.google.com with SMTP id c15so17848066wro.13 for ; Fri, 16 Apr 2021 06:55:46 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id p14sm10686528wrn.49.2021.04.16.06.55.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 06:55:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AtdhNpA3BF6tCi5f8+toaQnoZ0KKS5XaxPZHuzEnrl4=; b=P9VOfuYyJmKNvk18yqus4V1OwdIgZNFmHm8gnFI6iJAL9cNoHm53IChpbseJlV/C/w vTOEkgFnay3gcS/WN9LYJgUF781tX7NQsqqWNybPYQN964fZ6/rNDvKVdRQhCIu56kNV 6iAEBFVmDb6tP1KoOx3DhKlXRaQpb2thMWbF0AL+r9A5jy+eiphVmoRu00ZzawSEiNo3 Dbu/tzSlq+mrxdM7M7Y1DdGHcT4slDVa0QLBK29V1uewnHXOKecZBkMh1WTUCbxklrM0 41YqQpIwhEz+bqYeHikBg96ldjfBtp0de4moluwpTj5cw+qyEDQ/oxFfDdzHio+eqlnQ IxPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AtdhNpA3BF6tCi5f8+toaQnoZ0KKS5XaxPZHuzEnrl4=; b=S/NhQTccj/lccQLoqHZKCn5qNcIWnIQjU6HkeaES5RpsMAM781oJk0FtONddTMt14p sEdI9UtOgYLySks0gpuEPDcP/XMrJaeC5shCKPYw+fnFqXHSXOTS25qcXkddFpUYg6TO IAQyc4vCu0YV8+9yGtxVtm2YMVmYjo83EwzHLqrgNPMMBbYGR6UWc4mgknwudjKcQ3Ba BfJIvV4xel02FqNkWkklrPbRS1Swk+km0AK7Fd0QTW7S/Q6cYAE2T454TyfXiXo5hASc bOb7uAgTvH1mUtEVmqu8ex65QibFeKRzvv2zTYhmpaMWFG8Ls8ZGiUrC+Kin9cDAV3kN 89Ww== X-Gm-Message-State: AOAM531ZowWJ4aTdWG+4jkBMYMVmH+ek6c665I2KzN5oJQT1lAF3scl/ 8QMYqIFGbgbgjs7bzAqTxS/sFN9fpAQetqaa X-Google-Smtp-Source: ABdhPJxWrU3bFZ9rYmBoIluAaxzB7KoxN3G2ik9nKHB68114wyVEcckPC3+N24B4ewzu/nA4O5fZRw== X-Received: by 2002:a5d:5091:: with SMTP id a17mr9187543wrt.60.1618581345806; Fri, 16 Apr 2021 06:55:45 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.0? 1/6] osdep: include glib-compat.h before other QEMU headers Date: Fri, 16 Apr 2021 14:55:38 +0100 Message-Id: <20210416135543.20382-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210416135543.20382-1-peter.maydell@linaro.org> References: <20210416135543.20382-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Paolo Bonzini glib-compat.h is sort of like a system header, and it needs to include system headers (glib.h) that may dislike being included under 'extern "C"'. Move it right after all system headers and before all other QEMU headers. Signed-off-by: Paolo Bonzini Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Maydell [PMM: Added comment about why glib-compat.h is special] Signed-off-by: Peter Maydell Acked-by: Paolo Bonzini Reviewed-by: Richard Henderson --- include/qemu/osdep.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index ba15be9c569..ab84ecc7c1c 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -111,6 +111,13 @@ extern int daemon(int, int); #define WEXITSTATUS(x) (x) #endif =20 +/* + * This is somewhat like a system header; it must be outside any extern "C" + * block because it includes system headers itself, including glib.h, + * which will not compile if inside an extern "C" block. + */ +#include "glib-compat.h" + #ifdef _WIN32 #include "sysemu/os-win32.h" #endif @@ -123,7 +130,6 @@ extern int daemon(int, int); #include #endif =20 -#include "glib-compat.h" #include "qemu/typedefs.h" =20 /* --=20 2.20.1 From nobody Fri Apr 26 14:46:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1618581405; cv=none; d=zohomail.com; s=zohoarc; b=J++wn7ON9IlO1sWsw9ZBQRb6o6i5RwzdcV6x5CEDSeQzrG1WnFndLuLHqWEeo/S0xmzmuTgEYb/mQSGt42y3PvAuFIJEOSgt1UT1+Kss+aBpAwvYqcVt1LoTg4k48BQcF2kRu2FjrFk/afUKYXoHYZ228pJsrAabtdaR0b+bEkA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618581405; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IGbPHmqiZp18VB3m9ykl3gVfTn6MP1LZc1HijN6f0ds=; b=EiEUekbCa8VVvmjNWEI0knLOkZMMzPoYl/JeurEh5J7HuFxB9ROi+g5miy7d5B37wJNjw1kwa76MVEqh39y2nGbF1yebGyTxx2QqvIlXB6aZwbfXtakUZTaj7wTM62NlF/zlH0k6W83Nh2BaJWXkjLK5Skci879wthRFhpYDzno= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1618581405232754.7684983848116; Fri, 16 Apr 2021 06:56:45 -0700 (PDT) Received: from localhost ([::1]:59250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXOxg-000050-33 for importer@patchew.org; Fri, 16 Apr 2021 09:56:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXOwn-0007HQ-T1 for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:49 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:36671) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXOwl-0004wx-Sc for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:49 -0400 Received: by mail-wr1-x42d.google.com with SMTP id m9so14042263wrx.3 for ; Fri, 16 Apr 2021 06:55:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id p14sm10686528wrn.49.2021.04.16.06.55.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 06:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IGbPHmqiZp18VB3m9ykl3gVfTn6MP1LZc1HijN6f0ds=; b=SJlBywbInh+hlGAN51pDlfyDbBm2kDQz2TdrqtVPihJwwY81i3ddxlS5B+sDvuHTxU lv8mROPoB1WNT7R/g8q3pqO0P99pBe1eDO93aGoc/dGAEQOl0hbkjb2nMsg7wG9Fy10b zKjKaXIJmz0dzoD0Aegnb1nj59Prjg/qeVHml69HlIDrEW3xg+s6YoklkRFCMFtu0xUU SQGR0cTv6j0WKBD37CUmWZVTTkDvEaXkZ9ZHdQGfOFcdgvJF/gjfpSkQOkHqDw/7k1Ul 1NPtXw5kPpYFgItqPR5A/tmkILkExiy6TpxiYzaWr9GbLneF14Yyz5FvSh6lY3ulScBY nIaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IGbPHmqiZp18VB3m9ykl3gVfTn6MP1LZc1HijN6f0ds=; b=HYplLX75xc0jjR5yKACYt11xgzGSJp1e0Gjgg+xezl5cxwKQ7M1hqJwc3pDPSjphYb RiyV+cYThVmMsmRJPvLL3fNkZEjMk863lX1+P4ASEopPxlXGepahP4BXttiXgyVSH9sP xFrVkfmq73juSBos/xeo1vvw38AiVxzGKS0JlZceYjmct1uL6gR7xUXmQk336AXjhrzZ 5P4UCofaDijy5xOKozqtth0rRcDK4NMcWiIPNg0jsw/ViWnZMceq4BJONrt+WEEE5nc5 hqK1QzcgxEMKcwB56in5zntoYEdZml3JST/UPszonaVvHEbKgnkhj3xwQViUK82MxEWj +mFQ== X-Gm-Message-State: AOAM530/q5lpNtoDigymHR46XC8YtmII/arPab5KUKmUJMPFd5rd11K+ RAdf5eyoNRw8KWyGhOloJvaP6TBkCVC3r0tU X-Google-Smtp-Source: ABdhPJyAZzNONn84ndLPk5K65Fk1UOr3ic9c8tyLq2yyUL2CXwZXM34EsbbIeSYaWH5w2rZk5+5zow== X-Received: by 2002:a5d:6a08:: with SMTP id m8mr9276086wru.57.1618581346504; Fri, 16 Apr 2021 06:55:46 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.0? 2/6] osdep: protect qemu/osdep.h with extern "C" Date: Fri, 16 Apr 2021 14:55:39 +0100 Message-Id: <20210416135543.20382-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210416135543.20382-1-peter.maydell@linaro.org> References: <20210416135543.20382-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Paolo Bonzini System headers may include templates if compiled with a C++ compiler, which cause the compiler to complain if qemu/osdep.h is included within a C++ source file's 'extern "C"' block. Add an 'extern "C"' block directly to qemu/osdep.h, so that system headers can be kept out of it. There is a stray declaration early in qemu/osdep.h, which needs to be special cased. Add a definition in qemu/compiler.h to make it look nice. config-host.h, CONFIG_TARGET, exec/poison.h and qemu/compiler.h are included outside the 'extern "C"' block; that is not an issue because they consist entirely of preprocessor directives. This allows us to move the include of osdep.h in our two C++ source files outside the extern "C" block they were previously using for it, which in turn means that they compile successfully against newer versions of glib which insist that glib.h is *not* inside an extern "C" block. Signed-off-by: Paolo Bonzini Reviewed-by: Daniel P. Berrang=C3=A9 [PMM: Moved disas/arm-a64.cc osdep.h include out of its extern "C" block; explained in commit message why we're doing this] Signed-off-by: Peter Maydell Acked-by: Paolo Bonzini Reviewed-by: Richard Henderson --- include/qemu/compiler.h | 6 ++++++ include/qemu/osdep.h | 10 +++++++++- disas/arm-a64.cc | 2 +- disas/nanomips.cpp | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index cf28bb2bcd7..091c45248b0 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -11,6 +11,12 @@ #define QEMU_STATIC_ANALYSIS 1 #endif =20 +#ifdef __cplusplus +#define QEMU_EXTERN_C extern "C" +#else +#define QEMU_EXTERN_C extern +#endif + #define QEMU_NORETURN __attribute__ ((__noreturn__)) =20 #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index ab84ecc7c1c..6d8562eaf40 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -57,7 +57,7 @@ #define daemon qemu_fake_daemon_function #include #undef daemon -extern int daemon(int, int); +QEMU_EXTERN_C int daemon(int, int); #endif =20 #ifdef _WIN32 @@ -118,6 +118,10 @@ extern int daemon(int, int); */ #include "glib-compat.h" =20 +#ifdef __cplusplus +extern "C" { +#endif + #ifdef _WIN32 #include "sysemu/os-win32.h" #endif @@ -728,4 +732,8 @@ static inline int platform_does_not_support_system(cons= t char *command) } #endif /* !HAVE_SYSTEM_FUNCTION */ =20 +#ifdef __cplusplus +} +#endif + #endif diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc index 9fa779e175e..27613d4b256 100644 --- a/disas/arm-a64.cc +++ b/disas/arm-a64.cc @@ -17,8 +17,8 @@ * along with this program. If not, see . */ =20 -extern "C" { #include "qemu/osdep.h" +extern "C" { #include "disas/dis-asm.h" } =20 diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp index 2b096552719..8ddef897f0d 100644 --- a/disas/nanomips.cpp +++ b/disas/nanomips.cpp @@ -27,8 +27,8 @@ * Reference Manual", Revision 01.01, April 27, 2018 */ =20 -extern "C" { #include "qemu/osdep.h" +extern "C" { #include "disas/dis-asm.h" } =20 --=20 2.20.1 From nobody Fri Apr 26 14:46:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1618581522; cv=none; d=zohomail.com; s=zohoarc; b=dPnZpgL6T6EoOwYYWjSN2oSPXMcXLk9R9OTUzGeL1fUNJWys3mtOHjWho70VeL1A8EdVFOubY5n/vVXp4+ppdx89HG/Hr7ze3W/xocKDbbdonQ7Y3OKXv0QtU+rV13OtnkhitiHZ54FBfitJr4lzxzsbIWWewveyIzT9an3ruRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618581522; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cZehfILUJtGk9HUzuIGzJjH/JKzgTkA2dSQh0622GUc=; b=kbLSiV1nfIFzLQBDbAoto8UJd0mt+RPoz8QawRiruXwx69J0xeDmzO2zjBjJFDDJIs8/OmyMcYvygWnlgAKkA3wa5DDsI7KL1h/l8FeEs9H+Uldi0FZzrS0qWyHJszNiyHbF6IX1gnl24w0dj4ZGSEcOICmWgGS1TzLQLfTXgVY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1618581522022431.95703861176946; Fri, 16 Apr 2021 06:58:42 -0700 (PDT) Received: from localhost ([::1]:36548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXOzY-0002KC-RY for importer@patchew.org; Fri, 16 Apr 2021 09:58:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXOwo-0007HU-1n for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:50 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:46689) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXOwm-0004xz-E0 for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:49 -0400 Received: by mail-wr1-x431.google.com with SMTP id c15so17848138wro.13 for ; Fri, 16 Apr 2021 06:55:48 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id p14sm10686528wrn.49.2021.04.16.06.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 06:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cZehfILUJtGk9HUzuIGzJjH/JKzgTkA2dSQh0622GUc=; b=dNXtTYHnny80kgrQ7dz46aEA/bgDs0WX+Vq0PbbQ4bHZkpnaWiLPy+XTPNL+yo2RfB PpfxPfTelVY/1jz7lOhLGHNhy2YaaRJ22vg0CuuwKN4e2lGYgdSR6w2lKQPusgITj+4X mi415NcY3n3ZzJK4a4nXqjkQrLM8KftGlj9fs4oOdMtBT4ik27YgE5VY4ED5rrSSruJu XuBwWtnqo1zMYbX/DuLEtkAs8XEPWZrv2mhhHaBMWPYojtxPzzzFVq01tiQYkVyL3V5G 6m818YdvVj03wm0ZlcKIX4hMzEgXrQX+rRYrcvxLvVfOyB88YhG7ecVy8kUOYIBT+t+U k9ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cZehfILUJtGk9HUzuIGzJjH/JKzgTkA2dSQh0622GUc=; b=gJfj1VSxvGoRBScilDn0wyyxs2wWAW7qybxFW40P777IuuAzG9qhHoxLHy5r2mbXRS xSvaB5wq7mL8B69KSqjA9xA31zq6wLCl6HwxJmzdc9R3lst1N0CV+3nffjDRNyh559QZ cChDppyfTa/9mxcfK/Stg6GUPtz+EfQS9AUa2IoCSRJz91egj40qh1QNRJR0Kl3EuTL/ j3nAXsGP1kI1+tXKZix4J/UqXzlSWGfOHRPNk1QfQYmnWMhkDc3QcjSUDyosBXxdhJ5V r7NYaBfOkAux3FXGOzpTx4H8bbQ3LSYvZ9AUbenFjtA63/bvDzU4kfFV9nkgqr2uYEu8 Eczw== X-Gm-Message-State: AOAM530VUxD8ewV/wxR2snd2XsmiY8Q3EoFaaDT0L+hqslIVy+zlt5vU X8kS82FyTXTq+/eppR7KQGQIG2mvWjPqWgmY X-Google-Smtp-Source: ABdhPJw07lkIYGLxJkaLJZHEvfZ+qQGobzUmmTYasx7wG65PjE2GGnneUrncBXpsq5nTFBWDK4t4hA== X-Received: by 2002:a05:6000:178c:: with SMTP id e12mr9318241wrg.42.1618581347192; Fri, 16 Apr 2021 06:55:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.0? 3/6] include/qemu/osdep.h: Move system includes to top Date: Fri, 16 Apr 2021 14:55:40 +0100 Message-Id: <20210416135543.20382-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210416135543.20382-1-peter.maydell@linaro.org> References: <20210416135543.20382-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Mostly osdep.h puts the system includes at the top of the file; but there are a couple of exceptions where we include a system header halfway through the file. Move these up to the top with the rest so that all the system headers we include are included before we include os-win32.h or os-posix.h. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 Message-id: 20210414184343.26235-1-peter.maydell@linaro.org Acked-by: Paolo Bonzini Reviewed-by: Richard Henderson --- include/qemu/osdep.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 6d8562eaf40..cb2a07e472e 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -104,6 +104,15 @@ QEMU_EXTERN_C int daemon(int, int); #include #include =20 +#ifdef CONFIG_IOVEC +#include +#endif + +#if defined(__linux__) && defined(__sparc__) +/* The SPARC definition of QEMU_VMALLOC_ALIGN needs SHMLBA */ +#include +#endif + #ifndef _WIN32 #include #else @@ -111,6 +120,10 @@ QEMU_EXTERN_C int daemon(int, int); #define WEXITSTATUS(x) (x) #endif =20 +#ifdef __APPLE__ +#include +#endif + /* * This is somewhat like a system header; it must be outside any extern "C" * block because it includes system headers itself, including glib.h, @@ -130,10 +143,6 @@ extern "C" { #include "sysemu/os-posix.h" #endif =20 -#ifdef __APPLE__ -#include -#endif - #include "qemu/typedefs.h" =20 /* @@ -469,7 +478,6 @@ void qemu_anon_ram_free(void *ptr, size_t size); /* Use 1 MiB (segment size) alignment so gmap can be used by KVM. */ # define QEMU_VMALLOC_ALIGN (256 * 4096) #elif defined(__linux__) && defined(__sparc__) -#include # define QEMU_VMALLOC_ALIGN MAX(qemu_real_host_page_size, SHMLBA) #else # define QEMU_VMALLOC_ALIGN qemu_real_host_page_size @@ -549,8 +557,6 @@ struct iovec { =20 ssize_t readv(int fd, const struct iovec *iov, int iov_cnt); ssize_t writev(int fd, const struct iovec *iov, int iov_cnt); -#else -#include #endif =20 #ifdef _WIN32 --=20 2.20.1 From nobody Fri Apr 26 14:46:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1618581405; cv=none; d=zohomail.com; s=zohoarc; b=lfjwBCuVHTtd8WA9EyJ3UYas7Hz83YD3OCBacxp2a+CRiYu8A1cy0VxiiEZtf5YtK6JCg+/4gQvGSRJ2wNhURFVWORLvlD0AhGkSx3izIxDDgnN498ahVIOIoo5DVnLGUz5R6V/y5PhUGD7wKJWqLcb4GynyMcDB009TDNF1R/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618581405; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yexOzAULOcEYO6I06ENHGVCv2bXclh59mEOkxfhqD7I=; b=QVF/ZPEL3ONAn0xU1fn0HZL+brnSLnR17Q8Ll6wsNWtf66SjONSlgi2POR8m4/u3Y9ww3gjGxYlZH/Lwo3wn9vQknWRdt+EEtFIUP+epWv1ALHsIfOeROMAHxFCFePD0hFGOzc0KsvyBEJ10R3J9W2Q/+PujsfK/M66WKqGV4GE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1618581405846439.5828648598207; Fri, 16 Apr 2021 06:56:45 -0700 (PDT) Received: from localhost ([::1]:59314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXOxg-00006W-IZ for importer@patchew.org; Fri, 16 Apr 2021 09:56:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37406) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXOwp-0007IG-2K for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:51 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:41970) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXOwn-0004yD-FU for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:50 -0400 Received: by mail-wm1-x335.google.com with SMTP id o21-20020a1c4d150000b029012e52898006so4623268wmh.0 for ; Fri, 16 Apr 2021 06:55:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id p14sm10686528wrn.49.2021.04.16.06.55.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 06:55:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yexOzAULOcEYO6I06ENHGVCv2bXclh59mEOkxfhqD7I=; b=vkN41Y2RtysMJYK7aApauhRqXxod31xb23nAQuxwgJI8gP4UAHx9VXWoQ2HxbLobpU QOMjvDX5CF8l9KclFz3V+q6NlaoH2Q0N0FauNQ5FUQioqmxSjhEWNY4BfTU31shbJo23 fwgeUO9lrCFIrtUjjTnBIehnDhJVSAHp3W0JPXGXZYzrond3Qmf8oCUNmSCzdAzHcM2T y4BrTZekILQ9qdr7aeGh7vxr8hNhC7RP+USsH2uYsKCH7UjOGkjsDvwdl5/nGbUH+uY2 rFyk8WG6XLp0ssXAYG2LK+yIHidButlSuNf60v6ImwFtY7MCCksR3xwY6u4t6sc5jYTa KfGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yexOzAULOcEYO6I06ENHGVCv2bXclh59mEOkxfhqD7I=; b=FLyP3MSPU3kN6bLpyWejXkUOWyG4dXASb1Iqf6UUbaLsIMGUs+AFpT63nWZKzsTjW/ 03iU2bm27KKleTaFE8X1LeQckQRCeqCskw7DQxRiIDZwBUSOraq4p2E4kJLLvKZyRjpu yxYaAZ1aWxbhWRVLBZbxHsGYZlRF2JURX1SSEJQ1aWgL/ON9nzHbEKUCHki0VAjRI1I4 GjB3rgZrgh8HAuX4xyr0ESSB+SI6x7GfR5iXHa45rG9Vj6lHO0nsaEyPws129RaXj6s/ DeGHsMmOiDWywjxqfpmypFCPxGX4Jcrcswn77AJS8XhHW1V4BO7ZlTRfxQaUeoDM6jD9 VX5w== X-Gm-Message-State: AOAM530N09I8fbaKkqbMtEsx3yJ33XTwVr3VCchovpD9pLzvIaRTyxjv NW0hYCQwETcjkn1Miv9uT8hDgMjb/6Eq5VNP X-Google-Smtp-Source: ABdhPJw/24+YqhOrWOHF6pepenLOenpQW9VKdmXyRvCfKvTL1TsE+8V8LHT6usUDgee/bE/vgNRCQg== X-Received: by 2002:a05:600c:2159:: with SMTP id v25mr8428478wml.80.1618581347870; Fri, 16 Apr 2021 06:55:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.0? 4/6] osdep: Make os-win32.h and os-posix.h handle 'extern "C"' themselves Date: Fri, 16 Apr 2021 14:55:41 +0100 Message-Id: <20210416135543.20382-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210416135543.20382-1-peter.maydell@linaro.org> References: <20210416135543.20382-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Both os-win32.h and os-posix.h include system header files. Instead of having osdep.h include them inside its 'extern "C"' block, make these headers handle that themselves, so that we don't include the system headers inside 'extern "C"'. This doesn't fix any current problems, but it's conceptually the right way to handle system headers. Signed-off-by: Peter Maydell Acked-by: Paolo Bonzini Reviewed-by: Richard Henderson --- include/qemu/osdep.h | 8 ++++---- include/sysemu/os-posix.h | 8 ++++++++ include/sysemu/os-win32.h | 8 ++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index cb2a07e472e..4c6f2390be4 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -131,10 +131,6 @@ QEMU_EXTERN_C int daemon(int, int); */ #include "glib-compat.h" =20 -#ifdef __cplusplus -extern "C" { -#endif - #ifdef _WIN32 #include "sysemu/os-win32.h" #endif @@ -143,6 +139,10 @@ extern "C" { #include "sysemu/os-posix.h" #endif =20 +#ifdef __cplusplus +extern "C" { +#endif + #include "qemu/typedefs.h" =20 /* diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index 629c8c648b7..2edf33658a4 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -38,6 +38,10 @@ #include #endif =20 +#ifdef __cplusplus +extern "C" { +#endif + void os_set_line_buffering(void); void os_set_proc_name(const char *s); void os_setup_signal_handling(void); @@ -92,4 +96,8 @@ static inline void qemu_funlockfile(FILE *f) funlockfile(f); } =20 +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/sysemu/os-win32.h b/include/sysemu/os-win32.h index 5346d51e890..43f569b5c21 100644 --- a/include/sysemu/os-win32.h +++ b/include/sysemu/os-win32.h @@ -30,6 +30,10 @@ #include #include =20 +#ifdef __cplusplus +extern "C" { +#endif + #if defined(_WIN64) /* On w64, setjmp is implemented by _setjmp which needs a second parameter. * If this parameter is NULL, longjump does no stack unwinding. @@ -194,4 +198,8 @@ ssize_t qemu_recv_wrap(int sockfd, void *buf, size_t le= n, int flags); ssize_t qemu_recvfrom_wrap(int sockfd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t *addrlen); =20 +#ifdef __cplusplus +} +#endif + #endif --=20 2.20.1 From nobody Fri Apr 26 14:46:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1618581602; cv=none; d=zohomail.com; s=zohoarc; b=Kjkr0LK9C56iTVSq3X+IhX0MogKzkIuYijzWq89wbqdn6WhRLuyXWc21Cgz4ktVgjYQbfD3bReYNBajXj/4FcbACpIL24qaMLI1XJjX60aIjUumLFw6yQ1oNKVWCrDtfE10VM+leYLlY8nSAH0aEd8N5jMTcMD7fiqwIG9yo1gQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618581602; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fUFShcPDC317X/vb6vVkDpZRUIQxAt+AfUe4Dq7Bom8=; b=J1BfQCmO/nmi4lHxb96SDUm2Xlma291MAx9s/khLVrLZAFH2jDn81V33m5vKPIKsR+LEsd8kXKsKIOwu+kFztF32pzLOPBb9m+U387cGfeI3uyKFMUeUWo3twY34EmXbBYJSQr4+dG0l2MSBkdnoJXojkO9z5gMBdEmZGo00iKM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1618581602513950.3601210365163; Fri, 16 Apr 2021 07:00:02 -0700 (PDT) Received: from localhost ([::1]:40860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXP0r-00044L-CL for importer@patchew.org; Fri, 16 Apr 2021 10:00:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXOwp-0007Ig-G2 for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:51 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:40559) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXOwn-0004yP-Rb for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:51 -0400 Received: by mail-wm1-x334.google.com with SMTP id y124-20020a1c32820000b029010c93864955so16589163wmy.5 for ; Fri, 16 Apr 2021 06:55:49 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id p14sm10686528wrn.49.2021.04.16.06.55.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 06:55:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fUFShcPDC317X/vb6vVkDpZRUIQxAt+AfUe4Dq7Bom8=; b=kM7cbZo5c5PQVnivS7VKxWw66HdUKfBK8PsHXC5VtfAgnLBtPznXNjISlsJu8RgAxN RBk/t0rARmrBIfFbRAzjqzTq1jJk2rHZVqEDTsvMbTx2owk8iytQADju7N6BGFuTT16W 6n8GH2k+myxoIoqjTtF/OLkr4qgwU2lnlDPtUPNRrmXKSv9pgrdJW4hS7L/EPwNCCzJo 6ycwVRLWKhGbDk2IpsmSLUUR1yRBEJZSobHzVbEMMFE+ZvshuzFBlS40e977LF+wntWd Cp89JBrmPPK9MIO9Xt9oJtbCJ6wmGM/jdwdHOpESlYi/TCNO6ffQioQeXbE1DNgh2sBJ SNXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fUFShcPDC317X/vb6vVkDpZRUIQxAt+AfUe4Dq7Bom8=; b=ohjzWrcJeMdzi9ZDerxV67PVozzRhpBlD3Lc5jjzchlFocd1U97LAl0WAdyjLHszsj PHmLT12bIS82cCTH7ifm30FUM6PeY0ggRndAWpiDq457O/mWj8+zByRDQk/C82QJH7M+ uDHXEMDb3SHMBOMGyS82PwO4V8LGTypPCTO+BzO4neFfXOfLWM1SqYt2wvXti32Rg9k0 iYkv3fUGyo9GhMLdgRcGL1aBwB3giVd6UTah69nguYAcBEdkhKvu2AI9BbBRRttTWsK9 k0tEwS8sgl6dyhwExNy/3LwouqufKNuaB3/9LpmVFG+A+xkQNvN6lvxMIbSHyrt6ixH3 YqFw== X-Gm-Message-State: AOAM532lA1e9+JyiyppHlTYV7UhOOSHVd8PbpwBTtx2ah3iqefZhWlKC OWFaYr/y4nyXkm9iDWcIeIXZD9xftcHUfNa4 X-Google-Smtp-Source: ABdhPJxB3QWeofmB669kmE4yFzoi7BT8F7CPyxA9K5lFQbd4wYHa4I2+wHs0oIaTs5ISvn9r26FA6w== X-Received: by 2002:a1c:1dd0:: with SMTP id d199mr8251569wmd.54.1618581348589; Fri, 16 Apr 2021 06:55:48 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.0? 5/6] include/qemu/bswap.h: Handle being included outside extern "C" block Date: Fri, 16 Apr 2021 14:55:42 +0100 Message-Id: <20210416135543.20382-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210416135543.20382-1-peter.maydell@linaro.org> References: <20210416135543.20382-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Make bswap.h handle being included outside an 'extern "C"' block: all system headers are included first, then all declarations are put inside an 'extern "C"' block. This requires a little rearrangement as currently we have an ifdef ladder that has some system includes and some local declarations or definitions, and we need to separate those out. We want to do this because dis-asm.h includes bswap.h, dis-asm.h may need to be included from C++ files, and system headers should not be included within 'extern "C"' blocks. Signed-off-by: Peter Maydell Acked-by: Paolo Bonzini Reviewed-by: Richard Henderson --- include/qemu/bswap.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 4aaf992b5d7..2d3bb8bbedd 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -1,8 +1,6 @@ #ifndef BSWAP_H #define BSWAP_H =20 -#include "fpu/softfloat-types.h" - #ifdef CONFIG_MACHINE_BSWAP_H # include # include @@ -12,7 +10,18 @@ # include #elif defined(CONFIG_BYTESWAP_H) # include +#define BSWAP_FROM_BYTESWAP +# else +#define BSWAP_FROM_FALLBACKS +#endif /* ! CONFIG_MACHINE_BSWAP_H */ =20 +#ifdef __cplusplus +extern "C" { +#endif + +#include "fpu/softfloat-types.h" + +#ifdef BSWAP_FROM_BYTESWAP static inline uint16_t bswap16(uint16_t x) { return bswap_16(x); @@ -27,7 +36,9 @@ static inline uint64_t bswap64(uint64_t x) { return bswap_64(x); } -# else +#endif + +#ifdef BSWAP_FROM_FALLBACKS static inline uint16_t bswap16(uint16_t x) { return (((x & 0x00ff) << 8) | @@ -53,7 +64,10 @@ static inline uint64_t bswap64(uint64_t x) ((x & 0x00ff000000000000ULL) >> 40) | ((x & 0xff00000000000000ULL) >> 56)); } -#endif /* ! CONFIG_MACHINE_BSWAP_H */ +#endif + +#undef BSWAP_FROM_BYTESWAP +#undef BSWAP_FROM_FALLBACKS =20 static inline void bswap16s(uint16_t *s) { @@ -494,4 +508,8 @@ DO_STN_LDN_P(be) #undef le_bswaps #undef be_bswaps =20 +#ifdef __cplusplus +} +#endif + #endif /* BSWAP_H */ --=20 2.20.1 From nobody Fri Apr 26 14:46:49 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1618581600; cv=none; d=zohomail.com; s=zohoarc; b=fwirtQdp6OSdMwLgRp5oj3vmFmkg5SuSjqFXMAvUF1jaEImmIUy1fbB1KrHGN/lGs7XDZY6bKo8mflsK0WtAynjgsfS3tmf2D50VRZmln1GHyNkhhcu5sxQ2hd07nw8XxMfyZfoLu4Amp/DUoDMGWSh3xb8iNcYPBBbMNOy51q8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618581600; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g/ScmGNLIKtp3C9GZkcmISznCjlb972d3f+b6c16HTs=; b=VnB0Hjke1ToKTddQavHkQYu5B0MtnJpcxx6X3cecgIREvXKMG22JaVoCK2H+OWYFYCyAiSYEDStdY2FiY+GVpCtIvdzet6jCqLtSQFHZ3luRGlfE/2c+it7KLPmiFMt3fIBKbYSDxBkNeEcx9dr77lX14JPC9d3tTg1l6s0KZxc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1618581600486363.2822588441454; Fri, 16 Apr 2021 07:00:00 -0700 (PDT) Received: from localhost ([::1]:40692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXP0p-0003yw-Cg for importer@patchew.org; Fri, 16 Apr 2021 09:59:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXOwq-0007Jm-1y for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:52 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:46029) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXOwo-0004z2-Eo for qemu-devel@nongnu.org; Fri, 16 Apr 2021 09:55:51 -0400 Received: by mail-wm1-x32f.google.com with SMTP id n4-20020a05600c4f84b029013151278decso3060841wmq.4 for ; Fri, 16 Apr 2021 06:55:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id p14sm10686528wrn.49.2021.04.16.06.55.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 06:55:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g/ScmGNLIKtp3C9GZkcmISznCjlb972d3f+b6c16HTs=; b=koTvjzYQFxb6Pi3OcHgnhbwe+9TZv/D0dhLdyUxXdicxAEiMnadKN9toJP3XsiBUCv FsRE2ISJ37KLyTIfJ+D7V/pCS4eNQCnazUCezhFyyyGOXTwLXolXPhGPA0CMjo9lyaIM Fxfr3s0xQlEN86dBKpabj+/2RkEH6Eja2JNbDrhBs+VdR6/wmNc8g0w0zeW41mL5Yo07 Edfn7+ys3DP/0AUmDq4WPkyVUumV+EC/WcNqmpHfCQ1eSDmEZqSS6ErxjWpdp4WPy+jh Kyu//iWc5WUBxAlDevs5OLLjE015XiQ5AcOccLV8oTyhwcFwOJGqFdfLMAgjNhANk0Z6 R6Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g/ScmGNLIKtp3C9GZkcmISznCjlb972d3f+b6c16HTs=; b=GjT6SzyCUxjR1wYAwoxOhDNrpxx6OnwxWM2FsrT4DcN6Ig9xeUh84KF8IgLeul4BqL 9vLp1zr5tb/qIj6e2hzW0XkCfJ1wT0gFQ+BR9o9qOmaxSYnl9pJnh62qCYP3e+KPM5rq 28usvaf67hs8ntJpNt5FFGuaEPkErPnfm05YF0xZI2F7CTYc9F55FUmqljAlnok2xE0n +mODkYpEl8fyBKrrCahUgfa6KSwNumiPAZT2bRXi+uCCU2gavQzaeyBR/7nuYih2x+bY ei9Kakgx0zfIQY+ZTkl8ppbN1fadPb7X1m1T8sVyZWMOmijohhJproQiYwU55nt6y6nc LIoA== X-Gm-Message-State: AOAM532VLxVeezklu8YKqna6ldchvm9LpsvyjSFpRqFzH/WXHJNkq8sQ PQoosd8VkDepKu7WR+dVnxsL72Ia9nR31Hxn X-Google-Smtp-Source: ABdhPJxGuWbFj2hQFHFR+TNE5PxgyLKsHoCJ+79w5vAwzhvajpCYYjJDDvxkyByfkgnRmG8MH6YkRg== X-Received: by 2002:a05:600c:4e91:: with SMTP id f17mr8132216wmq.6.1618581349218; Fri, 16 Apr 2021 06:55:49 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH for-6.0? 6/6] include/disas/dis-asm.h: Handle being included outside 'extern "C"' Date: Fri, 16 Apr 2021 14:55:43 +0100 Message-Id: <20210416135543.20382-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210416135543.20382-1-peter.maydell@linaro.org> References: <20210416135543.20382-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , "Daniel P. Berrange" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Make dis-asm.h handle being included outside an 'extern "C"' block; this allows us to remove the 'extern "C"' blocks that our two C++ files that include it are using. Signed-off-by: Peter Maydell Acked-by: Paolo Bonzini Reviewed-by: Richard Henderson --- include/disas/dis-asm.h | 12 ++++++++++-- disas/arm-a64.cc | 2 -- disas/nanomips.cpp | 2 -- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h index 13fa1edd411..4701445e806 100644 --- a/include/disas/dis-asm.h +++ b/include/disas/dis-asm.h @@ -9,6 +9,12 @@ #ifndef DISAS_DIS_ASM_H #define DISAS_DIS_ASM_H =20 +#include "qemu/bswap.h" + +#ifdef __cplusplus +extern "C" { +#endif + typedef void *PTR; typedef uint64_t bfd_vma; typedef int64_t bfd_signed_vma; @@ -479,8 +485,6 @@ bool cap_disas_plugin(disassemble_info *info, uint64_t = pc, size_t size); =20 /* from libbfd */ =20 -#include "qemu/bswap.h" - static inline bfd_vma bfd_getl64(const bfd_byte *addr) { return ldq_le_p(addr); @@ -508,4 +512,8 @@ static inline bfd_vma bfd_getb16(const bfd_byte *addr) =20 typedef bool bfd_boolean; =20 +#ifdef __cplusplus +} +#endif + #endif /* DISAS_DIS_ASM_H */ diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc index 27613d4b256..a1402a2e071 100644 --- a/disas/arm-a64.cc +++ b/disas/arm-a64.cc @@ -18,9 +18,7 @@ */ =20 #include "qemu/osdep.h" -extern "C" { #include "disas/dis-asm.h" -} =20 #include "vixl/a64/disasm-a64.h" =20 diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp index 8ddef897f0d..9be8df75dd6 100644 --- a/disas/nanomips.cpp +++ b/disas/nanomips.cpp @@ -28,9 +28,7 @@ */ =20 #include "qemu/osdep.h" -extern "C" { #include "disas/dis-asm.h" -} =20 #include #include --=20 2.20.1