Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2213843iof; Tue, 7 Jun 2022 23:25:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkYPezFSpfi4Co8LlgCScfymmOSBTQd77Hgd3t3HEsikEsqsUnhftYveTg+5SQcmTSjpAA X-Received: by 2002:a63:8b42:0:b0:3fc:7de2:7764 with SMTP id j63-20020a638b42000000b003fc7de27764mr28774322pge.358.1654669512874; Tue, 07 Jun 2022 23:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654669512; cv=none; d=google.com; s=arc-20160816; b=HGEr4PvgjV433sHyr0i1WYwXnUB0tfj9P7V+eAQmR3v1+s5dQz1aNNLWqBkGBK/V38 7nj9e5dA4fGRdfBq5phiLvWs30yppMPFgDn3UQ1PJVBRmNVTm23Ou9V3o+YwWnLaa5rF RZyDAZGc8Kru6Ig1sbXR6N76rulnuQesP5pvX/+8vnC29LOo/tKpw3OH2HCJVt2GTrEh XQeFSoBPHSV5cXvOi6NkYqwh/pgrAcrSyIhS1NRzP3ym5ymm9TtoylJTpwPCG4KHv854 OzJ7qNwzlxRmqs3yljJ872XI5kQAJsEFL5fOJuD0mE5BE0wRqqTX0lwNTFLCMfUHpn5z hS0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ScQdgRZJVrXljrbkUQaq/wpUI2+VXJLk4mnIwG1z6Pk=; b=XepLGJAYTJJ/VXu+YT/C+RiuuM+jGr5TGpfOGslEMUt1FoTi2b5uwDLtC7ha440nlR AsiNq7fGg2omm2K6zHrTGH1v4s34xTriOLuoOyYH5cReXjprqYgK4PWoEx7F+IvINh3s YhLiwoptG03Jun4taNdLCacVXuhMHDi9AR0/dL3KD9AAGdfn3AOlRgAgPX33kpjTJEp2 VT8QbiqiRrjh3gsXZEyTVtXxU5zJpo8Z9wP/hTV7eTnsA8ZocvzG/KbFPRxB1jPA3/l3 YTFQqnMPPCciROLvyAabL1AdGfQY+ti/TFwmJddynqb+Me43+z/IZnXQDaL+QPhf/2aS fTCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=cKxKBVi5; 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 Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s4-20020a170902988400b00167895fb8f1si7466408plp.137.2022.06.07.23.25.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:25:12 -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=@linux-foundation.org header.s=korg header.b=cKxKBVi5; 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C99183CA2DF; Tue, 7 Jun 2022 22:48:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446575AbiFHCP7 (ORCPT + 99 others); Tue, 7 Jun 2022 22:15:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388957AbiFHBpm (ORCPT ); Tue, 7 Jun 2022 21:45:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4F3E48C596 for ; Tue, 7 Jun 2022 15:27:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3B80BB82464 for ; Tue, 7 Jun 2022 22:27:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADA80C3411C; Tue, 7 Jun 2022 22:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1654640864; bh=5S/z21z92weYsEvQ8sPPs+ir8hNQ+/Ya3+hZvDiMy5c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cKxKBVi5rytKhSUhsR1sqCXCIPzwkOTvcLJ8meC4RfrPuYgz0kOcW6FLaTsn9gAsw kjk7YBdIUHrogGL/Dmwl/6mCUF9e9kG4DwbeSFZRM3cOBE915bq7MpGq+iXo0YFhjC HxFo+7C7nQZE2NaMqwQoSBIupxQ/cbLiNi+Glvgo= Date: Tue, 7 Jun 2022 15:27:44 -0700 From: Andrew Morton To: Justin Stitt Cc: Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] include/uapi/linux/swab.h: add __u16 cast to __swab16 conditional Message-Id: <20220607152744.d7c801d092529309500ac9a6@linux-foundation.org> In-Reply-To: <20220607222006.22719-1-jstitt007@gmail.com> References: <20220607222006.22719-1-jstitt007@gmail.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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, 7 Jun 2022 15:20:06 -0700 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()` > > ... > > --- 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((__u16)(x)) ? \ > ___constant_swab16(x) : \ > __fswab16(x)) > #endif More explanation, please? Both ___constant_swab16() and __fswab16() return __u16, so why does this patch have any effect?