From patchwork Wed Jul 21 19:59:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 483320 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp6512516jao; Wed, 21 Jul 2021 13:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9L9jhmT02KdD+wfwtPjIYLLsogWkFjghleaTYTKdvN9yh5oei3YU0rgsI5D2ct8X3FPE0 X-Received: by 2002:a5e:840f:: with SMTP id h15mr13164637ioj.93.1626897705467; Wed, 21 Jul 2021 13:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626897705; cv=none; d=google.com; s=arc-20160816; b=0jVoMRNJoKnsgDN1OhHitQ15aIKrBvR+uDJIcuFgatpjoJknP6VIiedA1aLPRgUlox jna0FsvJJAgVwyUTqe3dS4ASYL5J6vtIpOlMQ4cbmPYmXo6gJmSj3KwXw8Fvc1BgpMoi Twutrn+XilXbX/Q/IpDMiy2RGn50jzfgtQTY+vJWMYElm5JTR1aYhQYf6DcSzkqWPVWJ 6mrLAfxtjUKlLpepCmfPK4uqR7CT1t4UvlmcMJjXrE89YPg4H5U08086PqFLBjwspUaQ FKVZSXSYTBM+YR6heGaWQk3BkDc/5PneDjJT6qLw7ErWkVfNJ68ZzT7O3Iv7Mb82x0de CgmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=tGWi1/p5kH4vSWuQiEwMVtQM3xzILn4TEfNFXETr+/s=; b=AgrrbG/mK9PZJqo9m1BXvRYdrZtRXI5eXf4G1eNQnP18Fy0+wYw2e+N1SaY6YVR+/5 NzOUtyLjtJeN4QfwohAvFcZYGvOTQE6kAPJ41Ll9ZPW84yUphYaQnmm21vxgNUYuBQXc chSXzroIAz/rqYQyF5XS4P7+Q+jyF0oaz5ODzQqYUOzRmXwcvL+Hvf/X5ISCtfAloDfk szIXxhs3b1WPu2Nw1zKdjUi9Rl9KaAxrkZF3hQqfBag+tj73sqsBOunqSzSR9sFN9SJE ++57s4Aci+cTnptirOxhs+uacWud2BAh6GSDTCQ65V+vB/mxYgL1QxzSbo0OdyeUEnIX 5r/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EK44EOpr; 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=fail (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 u12si26769175ilg.116.2021.07.21.13.01.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Jul 2021 13:01:45 -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=fail header.i=@linaro.org header.s=google header.b=EK44EOpr; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m6IPY-0002Py-SS for patch@linaro.org; Wed, 21 Jul 2021 16:01:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6INu-0002LO-DV for qemu-devel@nongnu.org; Wed, 21 Jul 2021 16:00:02 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:33598) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m6INs-0005Zf-3V for qemu-devel@nongnu.org; Wed, 21 Jul 2021 16:00:02 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d1so1664045plg.0 for ; Wed, 21 Jul 2021 12:59:59 -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=tGWi1/p5kH4vSWuQiEwMVtQM3xzILn4TEfNFXETr+/s=; b=EK44EOprzAhgmXmsvs9nJ3GKkJS/pI3r7n7/Bxu/VKC81SuFnij7GgLUENICf+tWJV kY5PyRktzfJBdLwOaFL0lM3utS+ijZ1uSTtv/GrAJokdzIHd+UFMFEEuR1JfvvxRxcyL JWziVCw5xovSTHnnATLiCgaSLqFxK7zqiBgiq2BLVX+IpOwpzIjovKjcRZsFhiGh7Em7 w9SYIG5rBY6yJrH54OlsvqUt3QuksfTk/GCeHcPOekmKrT18a3KPrcYf16sYrda8mtrS 0EWa/IQUw/dsqzXPcCPDQo1TFz7TviyuJ0MryzWoYB/eU7SxdTQ5pwLCwz12esHGRvsW 8w4A== 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=tGWi1/p5kH4vSWuQiEwMVtQM3xzILn4TEfNFXETr+/s=; b=qYpIaYAQbaRO3FinMr8iHJtXVaw7g0XY+rHiwvSU3ke7fgQ+SBP3PcKckQrZNuIKXn sa7L9AsSs5Ai/4Lcnr3JHlYh6VqEskPqg6aC9jRJ8rOp7v3KZQZTPyTtA6Rm0RcaiSjZ GESSBMQGylQblhVwgULWmQE8irTkJ81KJJC0BNVesXbq2XmlWauRNkksj/yyMrEhO4lS s+TbyyAQYTLaa0ELIxUmQzlkS9OlJUfwP+dsuiIWeafYXTE/6wJsplegSRRJVQ0jKDD3 VtVq37EvGKntINqwAx9vYr1SWnkq5u97Njwtjy7J2B9QpPVi5t9z9oyybghQnqTxjS7f YhdA== X-Gm-Message-State: AOAM533XWFnhbJ/Bjz06G7Leja1conNvHU2AgAOKemCRaUPXaaacO7BS 3KEy3vOPRIOhPyMHzxwxanPGGJeQLC6Lvw== X-Received: by 2002:a62:dd83:0:b029:2e8:e511:c32f with SMTP id w125-20020a62dd830000b02902e8e511c32fmr37914367pff.49.1626897598652; Wed, 21 Jul 2021 12:59:58 -0700 (PDT) Received: from localhost.localdomain (204-210-126-223.res.spectrum.com. [204.210.126.223]) by smtp.gmail.com with ESMTPSA id w3sm706028pjq.12.2021.07.21.12.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 12:59:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 01/27] qemu/atomic: Use macros for CONFIG_ATOMIC64 Date: Wed, 21 Jul 2021 09:59:28 -1000 Message-Id: <20210721195954.879535-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210721195954.879535-1-richard.henderson@linaro.org> References: <20210721195954.879535-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62c.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: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Cole Robinson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Clang warnings about questionable atomic usage get localized to the inline function in atomic.h. By using a macro, we get the full traceback to the original use that caused the warning. Tested-by: Cole Robinson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/qemu/atomic.h | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) -- 2.25.1 diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index 3ccf84fd46..a7654d2a33 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -457,26 +457,15 @@ /* Abstractions to access atomically (i.e. "once") i64/u64 variables */ #ifdef CONFIG_ATOMIC64 -static inline int64_t qatomic_read_i64(const int64_t *ptr) -{ - /* use __nocheck because sizeof(void *) might be < sizeof(u64) */ - return qatomic_read__nocheck(ptr); -} - -static inline uint64_t qatomic_read_u64(const uint64_t *ptr) -{ - return qatomic_read__nocheck(ptr); -} - -static inline void qatomic_set_i64(int64_t *ptr, int64_t val) -{ - qatomic_set__nocheck(ptr, val); -} - -static inline void qatomic_set_u64(uint64_t *ptr, uint64_t val) -{ - qatomic_set__nocheck(ptr, val); -} +/* Use __nocheck because sizeof(void *) might be < sizeof(u64) */ +#define qatomic_read_i64(P) \ + _Generic(*(P), int64_t: qatomic_read__nocheck(P)) +#define qatomic_read_u64(P) \ + _Generic(*(P), uint64_t: qatomic_read__nocheck(P)) +#define qatomic_set_i64(P, V) \ + _Generic(*(P), int64_t: qatomic_set__nocheck(P, V)) +#define qatomic_set_u64(P, V) \ + _Generic(*(P), uint64_t: qatomic_set__nocheck(P, V)) static inline void qatomic64_init(void) {