From nobody Sun May 19 02:07:04 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 ARC-Seal: i=1; a=rsa-sha256; t=1693410241; cv=none; d=zohomail.com; s=zohoarc; b=AUWtHlncFzEMv19jFqEUcf0zWZzAQQBCJPonY1Zhphkyo+ROTCC3pHdeyfeNKwpt8KPmI2W/DDPX8v5yNaqiBO1DM+x2+FwFKrIRQ7u1zB4VXYRCJtjtoK8VZ4zooEDpYXHIRZ0pKmZbec88H7+yyggvGT95SJUy1lqI1j4pggs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693410241; 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=8dJ9TkQAZUpgc686GsI19q/GGiHeugYLNIbj9BWx/2w=; b=U1snTO6mMg2xFXOhNJDvsPC9xc43+iI0uspU3Zllme6tz9BoCSenZ4+Zd+Sqb89ii18b7bJmB8X9shff0wU9VoB2RT4LK7xT9J4qECQkg12lk1pg06KttazaXy475xClXY64Ho2CL1rejxg9/fxRtVB+yH0JBSU35x2ZY5IzM4U= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1693410241434860.0407141804365; Wed, 30 Aug 2023 08:44:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbNMC-0004FW-Qh; Wed, 30 Aug 2023 11:43:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qbNMB-0004FC-Jf for qemu-devel@nongnu.org; Wed, 30 Aug 2023 11:43:47 -0400 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbNLx-00049U-PA for qemu-devel@nongnu.org; Wed, 30 Aug 2023 11:43:37 -0400 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-34cb5c41777so17844765ab.1 for ; Wed, 30 Aug 2023 08:43:26 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id h14-20020a92c08e000000b00345e3a04f2dsm3899980ile.62.2023.08.30.08.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 08:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1693410205; x=1694015005; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8dJ9TkQAZUpgc686GsI19q/GGiHeugYLNIbj9BWx/2w=; b=JpDHJ2j8tI7d1T21YJ+4NL4KdH1x3Hpxkhj0/4qgvxmfIxzl9xojRz7We4LQ03JXWg XMJtNUkPFMb4A/mOw8MHrZn+N/V5o+w9MPmQbz4PZAm5yOPBaqk0ekINkf6BBlsZcJ23 OR54pQee70i0qfWMP5hfCABvzUlcHeDQAuDmI+/OA7rQVVC1jGkCbY73Hhv/1h3TLQjz ZdXLDSN+UGjRJlmjxCde/mQ9jl2Qr05Lnr4KqS0q85GJmbDKcWv6tK5uPnhgDPiPl6CW tbLR5oIQAVNtfHOnQXNMlmRjygSJaL3zeUJg3Cyf/QG2b0fUi2C9QCfmPZNQLOBs2rLd JQtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693410205; x=1694015005; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8dJ9TkQAZUpgc686GsI19q/GGiHeugYLNIbj9BWx/2w=; b=PlMFUuMu8zjO0g7ccdqE/2v52qdvhSCPrWzQSPt56HXFfYOmiR7Ciq2Kx1dFPyRggB gEyQ4fJKirSFy+ETmuTR+KHmlHzUZ7D8a97b0BV4p52w2pIpOmLfO++hdW8PEgO8jg88 wzcmmT0kAZwcS5l6g8RlbfsETuVarWgM3OI/C78l26frdjsgl4iObCTucYeqFWsxtHMw WbjgKoHSEG55eKaqXpfdtjYwJ+cEopsiuFivm83HL6Wr9Q5VAQ8THKTqX3sajvi1iwqQ vTTS9NlpXz46uW/MTKsfStWR5d7zBIcrL+C8LeaN5OhfKsJX9YmNXK4hxOWeYtePDtel woUg== X-Gm-Message-State: AOJu0YwEKv0KP6QKsS8Ie+bw36slj/GE+WJh0+Y9/FEqVuDmgQX20fMH 8Zqz1przl8frQr7B5a+MoH6WHL62Frkm9tbMokU= X-Google-Smtp-Source: AGHT+IEWX7a9jRr9tctP8UhTBfG18Uddg5us4JRnKEZ2kJPaN2/EzEL1l0ZP7SgfDSk4CppqzxglWg== X-Received: by 2002:a05:6e02:ca3:b0:34c:e84b:4c5e with SMTP id 3-20020a056e020ca300b0034ce84b4c5emr2786790ilg.8.1693410205649; Wed, 30 Aug 2023 08:43:25 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: Kyle Evans , Beraldo Leal , Wainer dos Santos Moschetta , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Laurent Vivier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Warner Losh , Peter Maydell Subject: [PULL 1/1] bsd-user: Move PRAGMA_DISABLE_PACKED_WARNING etc to qemu.h Date: Wed, 30 Aug 2023 09:40:07 -0600 Message-ID: <20230830154007.54297-2-imp@bsdimp.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230830154007.54297-1-imp@bsdimp.com> References: <20230830154007.54297-1-imp@bsdimp.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: none client-ip=2607:f8b0:4864:20::129; envelope-from=imp@bsdimp.com; helo=mail-il1-x129.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @bsdimp-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1693410244088100001 Content-Type: text/plain; charset="utf-8" For the moment, move PRAGMA_DISABLE_PACKED_WARNING and PRAGMA_ENABLE_PACKED_WARNING back to bsd-user/qemu.h. Of course, these should be in compiler.h, but that interferes with too many things at the moment, so take one step back to unbreak clang linux-user builds first. Use the exact same version that's in linux-user/qemu.h since that's what should be in compiler.h. Signed-off-by: Warner Losh Reviewed-by: Peter Maydell --- bsd-user/qemu.h | 27 +++++++++++++++++++++++++++ include/qemu/compiler.h | 30 ------------------------------ 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 4cfd5c63371..d3158bc2edd 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -273,6 +273,33 @@ static inline bool access_ok(int type, abi_ulong addr,= abi_ulong size) * These are usually used to access struct data members once the struct ha= s been * locked - usually with lock_user_struct(). */ + +/* + * Tricky points: + * - Use __builtin_choose_expr to avoid type promotion from ?:, + * - Invalid sizes result in a compile time error stemming from + * the fact that abort has no parameters. + * - It's easier to use the endian-specific unaligned load/store + * functions than host-endian unaligned load/store plus tswapN. + * - The pragmas are necessary only to silence a clang false-positive + * warning: see https://bugs.llvm.org/show_bug.cgi?id=3D39113 . + * - gcc has bugs in its _Pragma() support in some versions, eg + * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D83256 -- so we only + * include the warning-suppression pragmas for clang + */ +#if defined(__clang__) && __has_warning("-Waddress-of-packed-member") +#define PRAGMA_DISABLE_PACKED_WARNING \ + _Pragma("GCC diagnostic push"); \ + _Pragma("GCC diagnostic ignored \"-Waddress-of-packed-member\"") + +#define PRAGMA_REENABLE_PACKED_WARNING \ + _Pragma("GCC diagnostic pop") + +#else +#define PRAGMA_DISABLE_PACKED_WARNING +#define PRAGMA_REENABLE_PACKED_WARNING +#endif + #define __put_user_e(x, hptr, e) = \ do { = \ PRAGMA_DISABLE_PACKED_WARNING; = \ diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index b0374425180..a309f90c768 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -22,36 +22,6 @@ #define QEMU_EXTERN_C extern #endif =20 -/* - * Tricky points: - * - Use __builtin_choose_expr to avoid type promotion from ?:, - * - Invalid sizes result in a compile time error stemming from - * the fact that abort has no parameters. - * - It's easier to use the endian-specific unaligned load/store - * functions than host-endian unaligned load/store plus tswapN. - * - The pragmas are necessary only to silence a clang false-positive - * warning: see https://bugs.llvm.org/show_bug.cgi?id=3D39113 . - * - We have to disable -Wpragmas warnings to avoid a complaint about - * an unknown warning type from older compilers that don't know about - * -Waddress-of-packed-member. - * - gcc has bugs in its _Pragma() support in some versions, eg - * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D83256 -- so we only - * include the warning-suppression pragmas for clang - */ -#ifdef __clang__ -#define PRAGMA_DISABLE_PACKED_WARNING \ - _Pragma("GCC diagnostic push"); \ - _Pragma("GCC diagnostic ignored \"-Wpragmas\""); \ - _Pragma("GCC diagnostic ignored \"-Waddress-of-packed-member\"") - -#define PRAGMA_REENABLE_PACKED_WARNING \ - _Pragma("GCC diagnostic pop") - -#else -#define PRAGMA_DISABLE_PACKED_WARNING -#define PRAGMA_REENABLE_PACKED_WARNING -#endif - #if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__)) # define QEMU_PACKED __attribute__((gcc_struct, packed)) #else --=20 2.41.0