From nobody Mon Feb 9 23:18:24 2026 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 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