From nobody Sat May 4 19:04:51 2024 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=1618314194; cv=none; d=zohomail.com; s=zohoarc; b=WkESuXfsWZIFzBVDEVXrmfMjjyHcRpDLhdQCmQbsHvwSknlJhzuFoAivxKKDxYDsab27pT5fRpAoNg5/ehlccYA/2XHEH+FH/kfMhXrSt3QYjDlAnTuEwOS1diVpcF3Ok5IA1IMjc7sVqDttZyddH/6A/ticb5jkBzUQ9vML28k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618314194; 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=GYYM676T6K8E6MUwjt+OWaC5EYYCUhAjll3beQRTaTY=; b=m22s1U3I+wqUsco9CAlOUNxdKkdzXh77dv0VIp+cLMOmKwfAZzqO+mHXMq30AZu158bs6WQ6YVbzRini9HlVZ9RU4WlmTOrVL9pdKS7NYl0D2zN9R3X6zIGLJlIDZtK9pnIQDvmbKcOoYwzbhZhETeEpr6+aOZm9vcJ86Nhtdho= 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 1618314194560483.9031963186835; Tue, 13 Apr 2021 04:43:14 -0700 (PDT) Received: from localhost ([::1]:60018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWHRp-0001AG-Fl for importer@patchew.org; Tue, 13 Apr 2021 07:43:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWHMY-0005mQ-KK for qemu-devel@nongnu.org; Tue, 13 Apr 2021 07:37:46 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]:34537) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lWHMX-0005GV-5E for qemu-devel@nongnu.org; Tue, 13 Apr 2021 07:37:46 -0400 Received: by mail-ej1-x629.google.com with SMTP id x12so4574258ejc.1 for ; Tue, 13 Apr 2021 04:37:44 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id s17sm7640965ejx.10.2021.04.13.04.37.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 04:37:43 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=GYYM676T6K8E6MUwjt+OWaC5EYYCUhAjll3beQRTaTY=; b=ZOOQ+n+wCsKkFdMB31nAe8ddEInJJ/7wxVf2O0UgGS5yxToQxTVGNQRZOhV+h40q1x mUsW6WpR2sKpqYUDQExAOQOPrDbCAhGFXKEbV7J+MO8Gd/3DPU/S92W+4MoxNrYv4CiO ntceUNVM4hz8EWfkgH/+XQlMM38CLNaFQJl9FkGg4d1Ul+Bwtmi9+dFYnGrUKlVKFhAK O814qqhnoAjbMM6J8Az6GCbsrc2yOuneDxGc4eU2fV/i5uAHrJBSZIDCf9K7Neg82itF 2b+yQ+648g7CnHx9KQzmLP2cwIHkxzao6bc3p5Yce5rGHKt/5TWlbfDPAhBKHh+CtsKk 94iQ== 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 :in-reply-to:references:mime-version:content-transfer-encoding; bh=GYYM676T6K8E6MUwjt+OWaC5EYYCUhAjll3beQRTaTY=; b=NanDjR8YMuLJJhRzzIO6xVheB7Tj24PIGZKFgxlsyN58k+S45TVqz+mxVgz6eOEyLL KegiAQ0H6rfZeatQI3na/LCZptHvGxF5hGimsLr798gT/qIcxaygsQFnCxLcgZq6LU6+ uaxldGijHd6zk1FA9fJMnec4uF9SdR7zbld7lgzqfojR1CTK1kKp0VohJ7GIH+tMLnjI wz3IA5HkJI4I7MYsSbaostw7uDeeszWW7eiE7kIVBnjp93ld3k8NJWlz86vg0hEqGfM2 OZqhssQCNPA9ymCr0planAnadP8+2sV/1oAapnlkkRbza5thlXkRIvEFZILsUkuGJhsd yAUQ== X-Gm-Message-State: AOAM532dFREMIbBFUlyevq1jmkGoskNT1e4a5s0h7N6fTodobU/ERUXx d1FwHDc8RoMxfRIcCQCHEkuoMnIKia8= X-Google-Smtp-Source: ABdhPJyQEOV8TsQ2TurAQZ2x9KvvevJaA0ZgtdHiJ9LCZWiCuKNOSn3xJhfuRclaTreqJsUB2OZsIQ== X-Received: by 2002:a17:906:c0c8:: with SMTP id bn8mr31114484ejb.445.1618313863453; Tue, 13 Apr 2021 04:37:43 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 1/2] osdep: include glib-compat.h before other QEMU headers Date: Tue, 13 Apr 2021 13:37:40 +0200 Message-Id: <20210413113741.214867-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210413113741.214867-1-pbonzini@redhat.com> References: <20210413113741.214867-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::629; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x629.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: , Cc: peter.maydell@linaro.org, berrange@redhat.com 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" 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 --- include/qemu/osdep.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index ba15be9c56..b67b0a1e8c 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -111,6 +111,8 @@ extern int daemon(int, int); #define WEXITSTATUS(x) (x) #endif =20 +#include "glib-compat.h" + #ifdef _WIN32 #include "sysemu/os-win32.h" #endif @@ -123,7 +125,6 @@ extern int daemon(int, int); #include #endif =20 -#include "glib-compat.h" #include "qemu/typedefs.h" =20 /* --=20 2.30.1 From nobody Sat May 4 19:04:51 2024 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=1618314160; cv=none; d=zohomail.com; s=zohoarc; b=n5eRdYq4vV423JwzmVnPSSY7lwf1g/xgdAAWzLn/mGvxxjktT6iPWfM2dfWCXlkUOWQsKBfyfOlpUEVl1fVCLDqPrSwl6vFeyvDzDVudilG3KpsNltAdB8HnGeR6o5FXv+r5jtijawWNf6FTu0oBeybvPTKx0j4sJpPAgb3A5Ic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618314160; 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=e+0DU0nssNE9Dqd2GnOeTqteOT/NqCeugXBt1xrlSO8=; b=iWvez4BXoXSMIMjdMf+FHt8WOkOt69TfqL228v5FzHKJSC7heWHty83ceN7X6ms/wG5TC3NJ/8+nQI1vHf1j42KAYdn8ZK+12tYMeUy3i4T6FJQHr+6jJ65jjsMC/7576iPrvE7FVS3xlVtP8qNYLGkmLIU5PZ+kZwf8kEfiRvw= 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 1618314160168397.4230881528101; Tue, 13 Apr 2021 04:42:40 -0700 (PDT) Received: from localhost ([::1]:58802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWHRH-0000e1-3a for importer@patchew.org; Tue, 13 Apr 2021 07:42:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWHMZ-0005nC-8G for qemu-devel@nongnu.org; Tue, 13 Apr 2021 07:37:51 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]:45631) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lWHMX-0005HE-Lh for qemu-devel@nongnu.org; Tue, 13 Apr 2021 07:37:46 -0400 Received: by mail-ed1-x52d.google.com with SMTP id bx20so17830595edb.12 for ; Tue, 13 Apr 2021 04:37:45 -0700 (PDT) Received: from avogadro.redhat.com ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id s17sm7640965ejx.10.2021.04.13.04.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 04:37:43 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=e+0DU0nssNE9Dqd2GnOeTqteOT/NqCeugXBt1xrlSO8=; b=D1h/Qv2DJIlsLdhJjqtOPwpVinJWSusclLuOOpV5Wbwmh1VWsaQByxNFnn2xgBXt00 YriByx7A36CTVHPXgD/DFzGpYj1cdYPkuww30SKFqgv5QCjzFvD/gMvfusXei4j/Mqd7 RyDxIKtb/OJhLKnXczCwoZ/UTcV6x0V5NoHNf2Th3R/GU8oG6Ez1FVvkgmH26KeiW0CV Pl4CWC73HiVRQdDhfPDZiFKc8LBYZGybCSMvPOA+4zeB7lBdFLPozQ2kSjhYm5fjH+E5 FGssc5XoRgLMkCwLDgaUlyz1yaYSH9pzRGmqzsdO9WobeWS4KCt4c4fatWPyj9PiuOuE gSKg== 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 :in-reply-to:references:mime-version:content-transfer-encoding; bh=e+0DU0nssNE9Dqd2GnOeTqteOT/NqCeugXBt1xrlSO8=; b=mVRyJjh5+l6PVBsii/FLviZgJfvFaKYeUEaBrPQe9bXc7+QiA5j19pzvHZRsSRP4jB cBX91/ACAOCNpfDqSzZ69ihDxw4qtzlvtus5nItXNJxIk9Yiv4YVeJprERlTsEwHUh8j 8Vb9n8t8uiXH4+aCNQufjaEepkEd1P1CPjUw38xr7PRtvPYDo5fOpkLpj2OCqK7uKx/B jtdm6qaqv+QBNWTbjIxXA4o6iyhL4r1kqy0F+eVG64eqKJHYx2tlMTJi99DwuUgGYmeB IjQKsfxdiwK6kzrvEBlw0dGmEZTS8lYzvg+oTGrQg833R7izLS4MVTavomUjM/6VZfmc J8lA== X-Gm-Message-State: AOAM533gzmcGhrlpAOUo+lln+UCzIs6Sq8HsEovwWhxoq1C5G2G5ri4P 8HwPz2d7aF8zjwPpHPc35Sd4+Tk6o0U= X-Google-Smtp-Source: ABdhPJzHXAD396Z1JP05NLrEmuH7y+oSOKaPQi3DzgqpLh+0NgX4huYr80UTBX+x9Fin7QUuUVLyJg== X-Received: by 2002:a05:6402:3593:: with SMTP id y19mr34376040edc.317.1618313864254; Tue, 13 Apr 2021 04:37:44 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 2/2] osdep: protect qemu/osdep.h with extern "C" Date: Tue, 13 Apr 2021 13:37:41 +0200 Message-Id: <20210413113741.214867-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210413113741.214867-1-pbonzini@redhat.com> References: <20210413113741.214867-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::52d; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52d.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: , Cc: peter.maydell@linaro.org, berrange@redhat.com 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