From patchwork Wed Oct 26 02:10:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 618767 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp113543pvb; Tue, 25 Oct 2022 19:20:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM661iWpxsOj8CZFm1B3SQHy0Zl9gwHUtSFKEu3kbStyIYKIJz+9eryXMUaUofygVV7EM0I3 X-Received: by 2002:a05:620a:348:b0:6ec:a429:cc88 with SMTP id t8-20020a05620a034800b006eca429cc88mr28995509qkm.648.1666750820022; Tue, 25 Oct 2022 19:20:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666750820; cv=none; d=google.com; s=arc-20160816; b=u4cjLzlyL62Gi5MlvD1o314DonJx3/TvlW4m/d/N4UIZIjDYeGW3KapCA6XoEpBcnQ SGFVFZ44GRi5g2vqPPF00fI3NPxNalcPP1Dadj1DqVGgs1ubLIUeQ8PfNLR8smmKWQQW 3zeGXwmYUxnXQfCz6QUNtcmSKsueVVgtrOLrC3a3tX3GLdRkm5Cly6o4iDGbmO2bE+7h UzvI3cZei4x6aK+cAjLKpkMxppK987GzhOF1yEEkEJosa/4fT3vRDTzGDk+RfCAIK048 UCB5O/nrrd9CdqyRLJGaXNfshjQxov+qCp438+Blnv+lz6uLqZs0MP0IHXE56kVHz3b0 KXUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L+bQ8y2aE1cH3TKB7oyilRPItnm1DTZkui5P8deFPJQ=; b=b6cQiK7OYWv/K7D6HN98cf51B3rzBDEUOa7uw5lg0OvbdNPFc4Ayup+qUTn1f7gd/y qMSQVaGwwgsDhyUt9xH3dggAVeF+JJi2eOfsuhC640vtrM7no6h7lvek/XkUz6sWVk24 DBoBnI37ZUkV/FV0TNxbDSFOYkymHXW5+7KTsEgiGtAzGLgBFMdEgHvJkrfPN4ALO+zv NMx8wTILL7Nkg8xLR7lOvKkQaAwRy26n7m3hyjvI29EEorVw6RKBJQuIEq66qdcpQgwN 7SxVHiEKtxzVtU7aGzLH6kA4l8XrPxf6yzKTr04Wp/1AP2YpMueo+1aGtxPDSenWVDJk +SQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="C0QZ/r6z"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u16-20020a05620a0c5000b006eeb315a59bsi2891737qki.351.2022.10.25.19.20.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 25 Oct 2022 19:20:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="C0QZ/r6z"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1onVtX-0004rF-4z; Tue, 25 Oct 2022 22:11:51 -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 1onVtU-0004qV-Es for qemu-devel@nongnu.org; Tue, 25 Oct 2022 22:11:48 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1onVtP-000186-89 for qemu-devel@nongnu.org; Tue, 25 Oct 2022 22:11:44 -0400 Received: by mail-pg1-x531.google.com with SMTP id b5so13437405pgb.6 for ; Tue, 25 Oct 2022 19:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=L+bQ8y2aE1cH3TKB7oyilRPItnm1DTZkui5P8deFPJQ=; b=C0QZ/r6zYkP/x74z2KIotNtqD88L5FBbh8BUgbNw+Eo4rH7bEs+BzXOkUGDYcrJu4o 8ahh3DdXr+M6zgWzinstMTyGMp4cIFQqXNr5mPGChzLEht8apIWiOY9fAdmOadkCjxvJ kKOqCu/WJ5qIYYhZ1xb2vxs+cmQHlZCmGVuJNsJrPlm5Ditx9+hBhlGbhucEEXUyX296 /55OxDNgcjTitjYwgIUDbswZ6kvDkBNnf/4QfE0Iy/BHZjtNS7urRAlDitmWZeL9x9fG PXuFaa/omYfAZiWCUuoqK/rak35UXK6AC8Vzm/SIpcE/Pwi/prc0V1AnNTAJWSVddH+8 8RfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=L+bQ8y2aE1cH3TKB7oyilRPItnm1DTZkui5P8deFPJQ=; b=lLB2T3mjVOYwk3fy7rPIVohwx8qv/9Sz3IC1nkSKPPVoKRmSOW/J2ZrghOsXIdWHDl b8ITXeHDTYGURz8aQsEsxi98EMLJ71rYdsh5IFXbUUfV/2aZalJAxy9YHpk57Rpgk/Bc bspgOZoI06KDkRLpCIycmvMAZs+xJT8MAF92lY48fDcUH7WGWTHllq3HvcgZYR2d7uBi O8owrXSNKoFHCHoAlYAZuT89sYbeBFi1ClBL9raAjIGJLLKfiokXu5u64EKD4tfSWzE3 GArvE37c92uQv/lzJ4KRASKvDV0dynQclTDlrVh7RvoYRSCaA883IZmxg5+sZGJbmOec 4yGQ== X-Gm-Message-State: ACrzQf3F9jkXAkolvACbp1aGMZuvFuR8e6PtpINxyGu0ir9AsYJno6nT iaf8DIfJwFl1NnhTwy8NBCoah1tvXfkkuiPk X-Received: by 2002:a63:86c3:0:b0:46f:33df:46b0 with SMTP id x186-20020a6386c3000000b0046f33df46b0mr4055007pgd.564.1666750301899; Tue, 25 Oct 2022 19:11:41 -0700 (PDT) Received: from stoup.hotspotlogin.services ([103.100.225.182]) by smtp.gmail.com with ESMTPSA id o29-20020a635d5d000000b0043c9da02729sm1897833pgm.6.2022.10.25.19.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 19:11:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: stefanha@redhat.com, Paolo Bonzini , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= Subject: [PULL 06/47] include/qemu/atomic: Use qemu_build_assert Date: Wed, 26 Oct 2022 12:10:35 +1000 Message-Id: <20221026021116.1988449-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221026021116.1988449-1-richard.henderson@linaro.org> References: <20221026021116.1988449-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Change from QEMU_BUILD_BUG_ON, which requires ifdefs to avoid problematic code, to qemu_build_assert, which can use C ifs. Acked-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/qemu/atomic.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index 7e8fc8e7cd..874134fd19 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -133,7 +133,7 @@ #define qatomic_read(ptr) \ ({ \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ + qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \ qatomic_read__nocheck(ptr); \ }) @@ -141,7 +141,7 @@ __atomic_store_n(ptr, i, __ATOMIC_RELAXED) #define qatomic_set(ptr, i) do { \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ + qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \ qatomic_set__nocheck(ptr, i); \ } while(0) @@ -159,27 +159,27 @@ #define qatomic_rcu_read(ptr) \ ({ \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ + qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \ typeof_strip_qual(*ptr) _val; \ qatomic_rcu_read__nocheck(ptr, &_val); \ _val; \ }) #define qatomic_rcu_set(ptr, i) do { \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ + qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \ __atomic_store_n(ptr, i, __ATOMIC_RELEASE); \ } while(0) #define qatomic_load_acquire(ptr) \ ({ \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ + qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \ typeof_strip_qual(*ptr) _val; \ __atomic_load(ptr, &_val, __ATOMIC_ACQUIRE); \ _val; \ }) #define qatomic_store_release(ptr, i) do { \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ + qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \ __atomic_store_n(ptr, i, __ATOMIC_RELEASE); \ } while(0) @@ -191,7 +191,7 @@ }) #define qatomic_xchg(ptr, i) ({ \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ + qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \ qatomic_xchg__nocheck(ptr, i); \ }) @@ -204,7 +204,7 @@ }) #define qatomic_cmpxchg(ptr, old, new) ({ \ - QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ + qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \ qatomic_cmpxchg__nocheck(ptr, old, new); \ })