Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp793346iol; Thu, 9 Jun 2022 14:13:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8L2S33dIwP7uIOXxDvUJBq+rHLNAAUol/fWWTWnsZGZCn/gjIqvEf1KJIM+f0pXrX4Olu X-Received: by 2002:a63:2c15:0:b0:3f6:6a5f:8f0a with SMTP id s21-20020a632c15000000b003f66a5f8f0amr35858154pgs.76.1654809237031; Thu, 09 Jun 2022 14:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654809237; cv=none; d=google.com; s=arc-20160816; b=bbVO8/DyrxIX5l1Oks5mmKDTxe/70riYDVKuiTa8N6ixlNCG0gatGEMrG2iEhQr18B 3Y2jx7k1Ux+PSZWAoSF7DKtqmAdgUSYuKfPbLwJzjb+7WJ0gcq3PZkqHj9ZVajpt8hc0 4oq/nrfa/vp4KAT8qDX4O03sIOoEPyBcrHjkFx56txvD/uhFPy00ae3+nUCtgEB8zqya i2EsKcpHgoipaybb8l72Acpf9kf4jYrhLMY2IIxHbwMLNe5Zpv4VhgWe9cKa/gvGAsla wUdCrnxj4I6RImn46JhqSI4NFQSXIX06sIndgPrivT9illQFS+KCsy3kRF/nRiXkt26w ncKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4LZi6uXoXAf04ylkz70R28b0LCSIQzk10rMLQpYYnxU=; b=Nx0lDLoT/y4IqZjElGOdc/WTCjiRsqFdRYye2kuvdZzGQrd0UkEihJezkknHYv22gY F34qibdkUUwk4u5xC9DSs5fheiLSsbQ2F7s2YW2ySG06MELrjqQWLzfTlQ7l0oM0s6vN ZN667DilfDzGB6oYfXs7BNPNox0mSHKIqcv2BZOt8nd3fYxCvd2DJfZWmN6bxjx9v0IB oPwEtj94AQFEwDhbksqBtclCK7alS7yRER9Zaxw8L0T3EVyWeM5tne2Dv/eZXvxUaXvB KmRZyoPtHRxDsIBjuNrdaRp+cmTzv2u0kztHbq5hEOHXR3JiI8mP4tYptaOk7Ef9V5ci OluA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IJFJOI4w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oa1-20020a17090b1bc100b001e84e3ce242si469404pjb.137.2022.06.09.14.13.43; Thu, 09 Jun 2022 14:13:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IJFJOI4w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241369AbiFIVBg (ORCPT + 99 others); Thu, 9 Jun 2022 17:01:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233456AbiFIVBd (ORCPT ); Thu, 9 Jun 2022 17:01:33 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B61571FA for ; Thu, 9 Jun 2022 14:01:31 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id c4so7815159lfj.12 for ; Thu, 09 Jun 2022 14:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4LZi6uXoXAf04ylkz70R28b0LCSIQzk10rMLQpYYnxU=; b=IJFJOI4wDiyHohXjZzSfoZMJopDi9LAFFOxMP0hxKvqlA54JQdkXkqf3Xmb42LSMjV LSyaDrjZRZlxtcuOJZsoCbYl49FsyZSGThPgsfYKxMLCLdlCZeS2J7PA2nJ1cYND43pi 5TDZQ8KNqfEKP5sccn2x9bXO5NIjR673Nyxerdn3jfanbcKH4NH2GVZ9tb2eI4nn5dSf qAEL3iY4GubJw9gMoPT4GTFTm52Nx6Hl8ceUROfKEmBZgxQw1zx2prsayhbY7KRMLb7g uRFmV3KLxGoN+eI/24X7TRkm+PUd7zMTf1BkyjuHBhbVtSSYF0oooJh2qO50y/AMF1Yu Zt9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4LZi6uXoXAf04ylkz70R28b0LCSIQzk10rMLQpYYnxU=; b=Ijd8ZTVjuilU54c0jzrL6wcKy+2BxcYjeR6j4BOdzJqiukqt9XKpIv0glUN3li1Uq+ DzssdX8nsbgppJ9X1ZEQC9SFqGLv/7IWK+lxAaNpqMQy6CO8AGKH23T0+W0kt+HG1Tvh 5bP7mD4yKTV/rLD1rViYl1XhgL56ugdggC3F2rZT0d25Q77sCkxEx7lrXnLx9VIx3Hlg eCDuA+QN6HZ2Mr1doLWefkQt3u4UTssApBsubxdkFR4r0KUnYQhLP/xj2aj3+M0CVIFw M4QSzTxVYalsk/1FGyBCERXFoMwM/Vc9KH4yXytuVdempmiTlz9N1zyhlFpmCH6HRBew 5wwQ== X-Gm-Message-State: AOAM531keBtya1DsH3fTRWk4C6zxzHjYByi/hTzmAJz+f2V56wdBI2yJ TSfKh+hHS1e/rZMDobPbJSXqz6xpk6BkYZ0sU4HQo3rROZ4ySQ== X-Received: by 2002:a05:6512:ad6:b0:479:5599:d834 with SMTP id n22-20020a0565120ad600b004795599d834mr11546955lfu.103.1654808489773; Thu, 09 Jun 2022 14:01:29 -0700 (PDT) MIME-Version: 1.0 References: <20220609172933.D8187C34114@smtp.kernel.org> In-Reply-To: From: Nick Desaulniers Date: Thu, 9 Jun 2022 14:01:17 -0700 Message-ID: Subject: Re: + include-uapi-linux-swabh-move-explicit-cast-outside-ternary.patch added to mm-nonmm-unstable branch To: Alexey Dobriyan Cc: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, nathan@kernel.org, jstitt007@gmail.com, akpm@linux-foundation.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 9, 2022 at 1:42 PM Alexey Dobriyan wrote: > > On Thu, Jun 09, 2022 at 10:29:33AM -0700, Andrew Morton wrote: > > A cast inside __builtin_constant_p doesn't do anything since it should > > evaluate as constant at compile time irrespective of this cast. Instead, > > I moved this cast outside the ternary to ensure the return type is as > > expected. > > > --- a/include/uapi/linux/swab.h~include-uapi-linux-swabh-move-explicit-cast-outside-ternary > > +++ a/include/uapi/linux/swab.h > > @@ -102,7 +102,7 @@ static inline __attribute_const__ __u32 > > #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) > > #else > > #define __swab16(x) \ > > - (__builtin_constant_p((__u16)(x)) ? \ > > + (__u16)(__builtin_constant_p(x) ? \ > > This cast is necessary. > > > ___constant_swab16(x) : \ > > __fswab16(x)) > > #endif > > @@ -115,7 +115,7 @@ static inline __attribute_const__ __u32 > > #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) > > #else > > #define __swab32(x) \ > > - (__builtin_constant_p((__u32)(x)) ? \ > > + (__u32)(__builtin_constant_p(x) ? \ > > ___constant_swab32(x) : \ > > __fswab32(x)) > > #endif > > @@ -128,7 +128,7 @@ static inline __attribute_const__ __u32 > > #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x)) > > #else > > #define __swab64(x) \ > > - (__builtin_constant_p((__u64)(x)) ? \ > > + (__u64)(__builtin_constant_p(x) ? \ > > ___constant_swab64(x) : \ > > __fswab64(x)) > > These two aren't? typeof(c ? u32 : u32) is u32. Correct. Neither are the casts on the return values of the calls to __builtin_bswap* in the cases where __HAVE_BUILTIN_BSWAP*__ are defined. If you want to send a patch on top of Justin's/on top of mm-nonmm-unstable, I'll ack it. Or Andrew, you can drop v3 and Justin can send a v4 with Alexey's suggestions? -- Thanks, ~Nick Desaulniers