Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2212001iof; Tue, 7 Jun 2022 23:21:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEvqqsfZgd4JRosNaN8sc76XJ9vzG3Qe5Exqm7TDbOl3nBr/yIYT+/GkS0IuPzUkmiltiq X-Received: by 2002:a65:6c06:0:b0:3f5:f29d:e030 with SMTP id y6-20020a656c06000000b003f5f29de030mr28212316pgu.22.1654669280948; Tue, 07 Jun 2022 23:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654669280; cv=none; d=google.com; s=arc-20160816; b=Te/Lgv4jDwkXDsMKQBIYzPq5qF2Q7GMsG97z5Kb+6eFuIH2a48diD3KTg8lf6O2j4A ei25tv9mGrsoWBV3W+4/DMpLjWxUvc2zYwgBvu66Hg6k46A0lG4vkGH3YuwsaRt1XfFZ zB+RGOGOWVzdIk7w5KcwuPvpL5svXZF9SfeXvVn0hcZBlRgqHjoty7iz0pp9ORiLeEpM JUFAiF2N8thfAyAu80530K5dqriC35qSvFSwGUbiBbWMr6Vr62pF3UnpwF4/pgRJH+7P v/5MpX5UGA24SlH+98P0MEFYSnVtmCuPFx1o5yPtPb3QsdRiH3Oywlln5U8Qke3zOYVO qxJA== 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=kJadlcijpEraHCzXfyi7dHvp0N+x8osaIwQlxh9G2bY=; b=hKlSlDj7ui6yqazxnyN1MYy+LCRY4tR8A5ybpBNxHHakZMlPRrd99O/I7G7Qnq5L1k YdkAu1YdSfUb1QUQhSVh0p4nr3e5r7UcwBCSOWfDuHmvRI+c6sVGDW/z6GbPlVp8zt83 Lj14Pmfx6957x7ietbI0LP5oQYk+K/wcEbVeCc/W2uQkHLN/xZgbFNIHYMzutVvs1ueS 3sSXTRnhHxP2LcufoASN6sHeMIa5OZ6CsV2SXj/2F5owo4/sbQ+93aaTB5sJs0jCYEK/ hOyfhIZ4UFOLrhBhxML9s8ciQIgU14sdUl7LJYuclnZL4/OQX0PD7AB4t+k+yhexvfu3 HGJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Z0ia+eLj; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j20-20020a170902f25400b00163ed137ad8si22383974plc.181.2022.06.07.23.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:21:20 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Z0ia+eLj; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2AE832C653F; Tue, 7 Jun 2022 22:42:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442261AbiFHB76 (ORCPT + 99 others); Tue, 7 Jun 2022 21:59:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835760AbiFGX4w (ORCPT ); Tue, 7 Jun 2022 19:56:52 -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 7DFC61F61D for ; Tue, 7 Jun 2022 16:20:31 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id u26so29866192lfd.8 for ; Tue, 07 Jun 2022 16:20: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=kJadlcijpEraHCzXfyi7dHvp0N+x8osaIwQlxh9G2bY=; b=Z0ia+eLjj6yYhXvzoGPJY2ac0xIAPYnyriaetuCT3yoo9N/HOqP4XHzBGfMavxNlGQ JLjlyCYB5YLQc1PwQqza+kuCemyXvU+6AdZYjKQaoHP7z2E8K8oFFC5L4Q6cnM5JlFId EYJy6ZGMqU9k/lpBl+tq3yRhcdXnfg4GGxbc6IvuGEofwwTGWi2q0fFdCX4SSnO1btc4 LWirHSmpgUAOz3v+bCyo21FfstCG4S0rRaZ/7ZgdLn6nFlBpKLo+JOkIWk87m90vdBE5 1Wzkx4tFR26DuHShOoFlyOVaLcTGbfSc22D80wD2jfOVwvttkNKZ0ES6XCvZwi7/1i3F ZvOw== 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=kJadlcijpEraHCzXfyi7dHvp0N+x8osaIwQlxh9G2bY=; b=DNXJeZ27rn0cZSdDpCvibIWEWDknd4elrfVf3+pfUfSbx+VXy7di1vm24VDiGl8gE/ Zvt/VMnxcU2URF0QbUd82Clfhf1+62Cws6mR/oT5dOCPhyMWg3dPQoSmrguvm2Uy/x1n UVPbT5jqKL86dtc2Y79PTWM2dTlAWItDIVn5t2JztITWT48kJg6Ouigh6C48++GR3ejG FAFiNVjh59qOt5sPh6E/A0cSCDQDG3MWO0ci6yOUVe8brpnEem9bbT4D86T+qP4wYBc9 dE48nn+lyi4AnERE+oFlUV/ON5BgHLkwyaLk/3K+0awZ+4AvDdWaWs2yknb0lLuxIRFl D8bQ== X-Gm-Message-State: AOAM533n2LjGFPFBqDqs87D6Eqj7kCdvKNtmioHry/rDuubs9F5nyJzQ 0itWZ0jYcxDMCvNwitnzjGnz8D6/ulgqcR8Y5ZweKw== X-Received: by 2002:a05:6512:3f94:b0:478:7abe:de4a with SMTP id x20-20020a0565123f9400b004787abede4amr54322287lfa.401.1654644029597; Tue, 07 Jun 2022 16:20:29 -0700 (PDT) MIME-Version: 1.0 References: <20220607222006.22719-1-jstitt007@gmail.com> In-Reply-To: <20220607222006.22719-1-jstitt007@gmail.com> From: Nick Desaulniers Date: Tue, 7 Jun 2022 16:20:17 -0700 Message-ID: Subject: Re: [PATCH] include/uapi/linux/swab.h: add __u16 cast to __swab16 conditional To: Justin Stitt , Andrew Morton Cc: Nathan Chancellor , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Tue, Jun 7, 2022 at 3:20 PM Justin Stitt wrote: > > if __HAVE_BUILTIN_BSWAP16__ is defined then __swab16 utilizes a __u16 cast. > This same cast should be used if __HAVE_BUILTIN_BSWAP16__ is not defined as > well. This should fix loads (at least a few) clang -Wformat warnings > specifically with `ntohs()` > > Link: https://github.com/ClangBuiltLinux/linux/issues/378 > Signed-off-by: Justin Stitt I wonder why there's a cast inside the __builtin_constant_p parameter list? Can't imagine that changing anything. I wonder if this should be: diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h index 7272f85d6d6a..0723a9cce747 100644 --- a/include/uapi/linux/swab.h +++ b/include/uapi/linux/swab.h @@ -102,7 +102,7 @@ static inline __attribute_const__ __u32 __fswahb32(__u32 val) #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) #else #define __swab16(x) \ - (__builtin_constant_p((__u16)(x)) ? \ + (__u16)(__builtin_constant_p(x) ? \ ___constant_swab16(x) : \ __fswab16(x)) #endif @@ -115,7 +115,7 @@ static inline __attribute_const__ __u32 __fswahb32(__u32 val) #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 __fswahb32(__u32 val) #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)) #endif -- Thanks, ~Nick Desaulniers