From nobody Tue May 14 03:31:21 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=1693407088; cv=none; d=zohomail.com; s=zohoarc; b=mPVJXTmQedc0ihzR9psfQxt3x7xubsmQ9lCwSL+eQCcWD+6cXXfMcdsL7t5ZtNbqBqQ5bN+YU8JYIwzpxUMCER4p1FAsOXXPO/cUvHE76CFwZBeI4rDv1OG9bSz2z5bhxPYndeNCRlqVeCfKvh3JLy6uNtb22w19lwG5dWEZrfc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1693407088; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Ntj3mUoC94qWUYkkh5x/XtSzHVTmxFdCwJPtYzRoLVg=; b=lksfOloG0cW8Lujw+849k0EMPvMN46BWDLeLTex+LcM4hwV+oHWW6qnWioSI7OVv19ACk/C80fWWCA2NXGTd9SEGF7jYV3OSe253VGXocHmadJmFOA5i8JDEaJr+NpZQx48bNJrlDls5I2WIkl4f0jTSfQRwyITvw3VXESC/oSQ= 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 1693407088258551.6300589244148; Wed, 30 Aug 2023 07:51:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qbMXE-00089h-Ln; Wed, 30 Aug 2023 10:51:08 -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 1qbMXC-00089U-Rc for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:51:06 -0400 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qbMX9-00008g-0q for qemu-devel@nongnu.org; Wed, 30 Aug 2023 10:51:05 -0400 Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-7951f0e02ecso22867439f.0 for ; Wed, 30 Aug 2023 07:51:02 -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 b8-20020a05663801a800b004290fd3a68dsm3936486jaq.1.2023.08.30.07.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 07:51:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1693407061; x=1694011861; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Ntj3mUoC94qWUYkkh5x/XtSzHVTmxFdCwJPtYzRoLVg=; b=MVu8rc/t+N0rXoS10xr3+8EWekiO0ZUw0rB2ptiqevMNfK7IVZFoOQXMygRUpEVkVr a0h7mLw42wsaezmxUY8XdsGjSaFd6XcPPeQJCh9pt9YsGfjwUT7iCHOn/+mUFnNoaQU0 m5S/HTfc/5bnSLlLhn83Ka8Amhno+6o2RElGyFxwyBP12NPE+LHjqQcVxMbZ3Q/RnoeQ mOLc2s5v3UF12JCjkjk8LfD1JytCV05dNMBIbiCLY3Iqc89MjiI+lRrfqwNz7Zdy9+hN NKTVjHBp5DTVaDZg9c4Mq10sZ3imKSFztr+DszWJAGWFrW5agUbb9S4lE0HUmS+py6R8 K0IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693407061; x=1694011861; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ntj3mUoC94qWUYkkh5x/XtSzHVTmxFdCwJPtYzRoLVg=; b=W0ZwjdCm5N+7zzqqa+FZpxuC+F+SI0iEQ0UBNocxAX4igBYi6Ndqwl7fi5hMvA6yRz Wa1BV7ni+gbWhv2zJ0PUUwO7jp2aZUoSNXSHLOBiCH8tUk0yJmdBwkwDRIxoUkS5OyUh qpQ1gCbvbZbtyt9+Dyi+vbXDo7pFnXm+nUWyQeheLbgPRoh+L9v1+7Y4mUtsDg5MCpw9 vrkQ0rZ0EJYBJpmsE7vh+pmtASXAGEVIre0mNRnXEGnMQ+IWl7GEEq2tF77oUVazI3Ku QQcG9qJTpqLEDNvPtj01AuhUPsygp5NBoaudb0mu9f5eAnGKPsbezfwBk7YZbxR/lNJD u19Q== X-Gm-Message-State: AOJu0YwkONA75pXkds40mXPWGWlFqJClgH080DHq21D9OHdkOUE7MzTz 8kLO1NCVVqNbDe7F+zZlpFNTjCbTYNNnwXAs9Ws= X-Google-Smtp-Source: AGHT+IHy294/0Mog+ZxbHyMS2DttFoKvROc6qE14PZASDA71hCC54N3ePydp7SeZg63T0c1NRPBdxQ== X-Received: by 2002:a92:d28c:0:b0:34a:a4a5:3f93 with SMTP id p12-20020a92d28c000000b0034aa4a53f93mr2492010ilp.5.1693407061135; Wed, 30 Aug 2023 07:51:01 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Wainer dos Santos Moschetta , Beraldo Leal , Warner Losh , Thomas Huth , Laurent Vivier , Kyle Evans Subject: [PATCH v3] bsd-user: Move PRAGMA_DISABLE_PACKED_WARNING etc to qemu.h Date: Wed, 30 Aug 2023 08:47:43 -0600 Message-ID: <20230830144743.53770-1-imp@bsdimp.com> X-Mailer: git-send-email 2.41.0 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::d2f; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2f.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: 1693407089821100003 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. 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