From nobody Tue Feb 10 03:39:57 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618318197; cv=none; d=zohomail.com; s=zohoarc; b=UFWth5NEc6QFIjy2I0aZ08r1BDS792++wvJia7uSJTa7YGI3fjP3zwc8gKaaJqGG3Nv8XKlg+1DpsK6oAkPl1oCYjrXGJghCoHmOCoQKPSnBQ8ADZB9CRjDya13mNR1e22wLODqCMGxRoPb+SgN5X6GNY4bGsi+POkE3EnaE4vw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618318197; h=Content-Transfer-Encoding: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=e+0DU0nssNE9Dqd2GnOeTqteOT/NqCeugXBt1xrlSO8=; b=MeF2h8/p+BFOVOq4GNdzc9uiTxkebi80y5FkIuWLbZqubMU5Gyv+ksAZ0sTlfAGwWDf8gSc0yOslLUPkLBTXl7xjxKymAED5h+7gRhyOoeASZWFkL3anOSZXYavgt3Fb6VOEO75OqruuNB5zpK66QhQ6UZJ9NgGVoqosdtmYlG0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail 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 1618318197277167.67197377249624; Tue, 13 Apr 2021 05:49:57 -0700 (PDT) Received: from localhost ([::1]:48776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWIUN-0002zV-Ke for importer@patchew.org; Tue, 13 Apr 2021 08:49:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWISc-0001WA-3I for qemu-devel@nongnu.org; Tue, 13 Apr 2021 08:48:06 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]:33349) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lWISa-0001pp-Ef for qemu-devel@nongnu.org; Tue, 13 Apr 2021 08:48:05 -0400 Received: by mail-ej1-x62a.google.com with SMTP id g5so19011958ejx.0 for ; Tue, 13 Apr 2021 05:48:04 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id s9sm8635961edd.16.2021.04.13.05.48.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 05:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e+0DU0nssNE9Dqd2GnOeTqteOT/NqCeugXBt1xrlSO8=; b=Myr/QPM908xZ9uB0eO0WhE1EeGAeJYHtDjcGS/DJLLeO8be32IwJXECLY+7IC8LbW1 X6Uy1jpJ4RaOlwF+7kV/H4gri1AzkrM6Cb1e7B29yneXeHwJ9lZkjw8qgzKvAT6xch6X avs2gBH+RdgRCBcxfKIRLiF428r7O65l4WiyWbeLNW9eCpjeUWMFy4RS9AwDkrsT89Vu 9y0ea/09VPN5r3+HcHpLzWjkyaoMSeAmC+SedMEU2JKEW1ys0FOOhq12XAm1cOmm+VJZ sIuRt+kT52vFlem4iMbH3EGuf+BuRJJBoEPcdhbYNIv7tMzEEtAt0pOTSVgG+BK0feem PBfg== 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:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=e+0DU0nssNE9Dqd2GnOeTqteOT/NqCeugXBt1xrlSO8=; b=BpaYp549Ss6559jNxxCYmJ5HuWC4S2tgkmzDbzx0kWv4Xx+Zest8KGbT2zWyEzbqMI Lx4Ll9nmMnh0veME8EfH2okY23hTWJD3Q9jEcjK9JvFd2adG0hNJzrLzVBBRMNP9lzcy SQkWOLo++d36X2lztwYChcvvHYXuhPH8myiWRcrgUIhCuCeDUXTV4sR4B4ZOvCEKG69d ugFwhjFZ8Rq3VGVJeiSbnP6VH45W0jBywpDXYhlXNAQ9kH24IJhTvaIS3ol6EoAEDZmT mYZLRelJ4mdrAyuGxW8rkmpMJ4SPpvakWhyTWhHySdH+JyF/SD3M9EClh2yMvy4VeoDc i5EQ== X-Gm-Message-State: AOAM530aqCIH5kPff3ZRSS4dJnjIkS1Wcd+BNPdOBUe7m4mnBJ9Xsc6+ BNZqCqwMc8XXCqhMTaRnp8IuDfQ9C3U= X-Google-Smtp-Source: ABdhPJzR367tlnlugoj9j4F8s6uadtsWQ1pW/GRPIqF6Hxx9rerK6zNgWzlxWK3tw4B4MMRmyxHwNw== X-Received: by 2002:a17:906:a45a:: with SMTP id cb26mr6591680ejb.537.1618318083149; Tue, 13 Apr 2021 05:48:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 2/2] osdep: protect qemu/osdep.h with extern "C" Date: Tue, 13 Apr 2021 14:48:00 +0200 Message-Id: <20210413124800.216095-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210413124800.216095-1-pbonzini@redhat.com> References: <20210413124800.216095-1-pbonzini@redhat.com> 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::62a; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x62a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Paolo Bonzini --- disas/nanomips.cpp | 2 +- include/qemu/compiler.h | 6 ++++++ include/qemu/osdep.h | 10 +++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp index 2b09655271..8ddef897f0 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 diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index cf28bb2bcd..091c45248b 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 b67b0a1e8c..3f8785a471 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 @@ -113,6 +113,10 @@ extern int daemon(int, int); =20 #include "glib-compat.h" =20 +#ifdef __cplusplus +extern "C" { +#endif + #ifdef _WIN32 #include "sysemu/os-win32.h" #endif @@ -723,4 +727,8 @@ static inline int platform_does_not_support_system(cons= t char *command) } #endif /* !HAVE_SYSTEM_FUNCTION */ =20 +#ifdef __cplusplus +} +#endif + #endif --=20 2.30.1