Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp69108iof; Wed, 8 Jun 2022 15:28:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsShTF8784bB44YNLqYDmeGHwv2GQKVM/gJwl1C/H2lj0+eElOy3Tqt1frFltdUv7P2UcC X-Received: by 2002:a17:90b:1b46:b0:1e6:83fe:1bb7 with SMTP id nv6-20020a17090b1b4600b001e683fe1bb7mr225521pjb.0.1654727289047; Wed, 08 Jun 2022 15:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654727289; cv=none; d=google.com; s=arc-20160816; b=hltNyXGmTvI9dLCexDrqt/Xur/maQs6zgFq55NwxJHwgMg/EmgRwF/H3zZVPxTdsbN fkCMAR0tBnGfGPXdGFoI6SwaFZE417WnvJI02JGM6CwWCU7UlKI6I6WZRMZnBjSuW6ue YbQPnOFyEMPBHaf/q8CGtPgaZGTSbk1YnsVNcNcfkvgHIFoH0qLA+kI97PUGyDD7CNH9 mfXdeyoRj91oTo2NStDdRW+JcbXS9+vio+Rf6aogOyrXN6caLx6PNpC3Lig3+7uNicTl Z7sB0orCnnnpHi5+4PxITjbzS/YT4SkHvYgJkeBtDl+nLrxk7/vBKqrjjTxjThACNHRM gZ5Q== 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=9ilRet/KteeJG0WVmL4enbjfFb2OgDEAZfxK9I2Kp4c=; b=YgH4MWjznG5ERj8n4Xq8RbbjXTrZuaeFf2hAPlb1cs5z06hpsuQd2LwcJaly3n26wk CLyXAOdM0cFSN373xr4LgFOsKILe90iSvBxNWSGUSeu3lYnTy9qmBZ3X+EASkZC9xGSC 0mg+nTodc0JWqa9vOItXyN03NkSbO4qNmjgTnAQm31B741jH7wml/CVWc33Q4K5oXpTM 9ItNujBLaFd5BPzCguTasU8oMTbpKHNh0fF3P+/JfwOKF7LeYCvS6T15BtEd2Sgx29tl AmowAnTLVsrFBfqdh+gRSSKddrMALx9b68BJCRfhm/Y3S7niWEKNx/bkpjrHFin2Xl0w ryFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=orw7vd9h; 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 h2-20020a636c02000000b003fe0c9f06absi6704162pgc.169.2022.06.08.15.27.32; Wed, 08 Jun 2022 15:28:09 -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=orw7vd9h; 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 S232283AbiFHVTi (ORCPT + 99 others); Wed, 8 Jun 2022 17:19:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230339AbiFHVTf (ORCPT ); Wed, 8 Jun 2022 17:19:35 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BFE213B8CA for ; Wed, 8 Jun 2022 14:19:34 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id t25so35067549lfg.7 for ; Wed, 08 Jun 2022 14:19:34 -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=9ilRet/KteeJG0WVmL4enbjfFb2OgDEAZfxK9I2Kp4c=; b=orw7vd9hf+k7zjOWPiiZOZtmqN/hWFJl5pW99wtt+Rq1Hm7YBjzEOSP3mhwJ2DORMw XSmLhs40wtsUHUvaHtig6ZRdICE1hd1M2vPBhZYOEMmpQSr/oqykZPZi/K3YfP17SfTn /7vU4RiM7cvzSs6mBGmPZtmWWr6qQA+O3yZ+z6v13v9zqyTLh7TZQcpJO4LfbhbpDp+8 nIkXxUT+AOpLOvvprZnmPzdG1JGPb7sZTLMDpGtWlxp8fxrR/eq1Unx7+ZxLofC0X7l7 02nNRjyXRadcrqWHAI5Iw99RiXaL4UjpfIxCqUJCTAhqvJCoblJg3hJgqhfxEXEvkLug odgg== 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=9ilRet/KteeJG0WVmL4enbjfFb2OgDEAZfxK9I2Kp4c=; b=g1s/PoGg3NPHx4LDjCvQpR5k7b/LaGyVMTHAch9JGwz/PPgxzNutOUTrDFr0AARBNV o2tCLljKBXnfZal6j/cQ9ppCdHGv3ARLtYLZabcZXOeQ2/t4iQSiJfdguAel4qSRVaMr 8DwDlJ1uZ7yiD98YZvw3uxI+CMPPz6oFsjPyC8WzJpibPQxUDW3sEM/OVjbCpXq0sNAq zgDuy+Sd9ZOoLPbYHwvDjat88nRi1KI4ZPBbxYnsFwi0hPID+qi2CbDQs6cTdqjm6gZ+ 8h1WA6ExHLJ97QJ0xl+eFTO4QU9furrOI8x7ZuE34Dh+YzT0vxEoiGGrEjvWnlHltxEA 0ERg== X-Gm-Message-State: AOAM533X800/Rx3YnMl9e/S3sL/T5ilrwzwTKZz6hZKsk3ivJZRVUv+k 7hKQr72DsveHaqDV1SndQzYuMfgpES0oFNrEyFwypw== X-Received: by 2002:a05:6512:2614:b0:445:777d:3530 with SMTP id bt20-20020a056512261400b00445777d3530mr70405545lfb.647.1654723172773; Wed, 08 Jun 2022 14:19:32 -0700 (PDT) MIME-Version: 1.0 References: <20220608001422.26383-1-jstitt007@gmail.com> In-Reply-To: <20220608001422.26383-1-jstitt007@gmail.com> From: Nick Desaulniers Date: Wed, 8 Jun 2022 14:19:21 -0700 Message-ID: Subject: Re: [PATCH v2] include/uapi/linux/swab.h: move explicit cast outside ternary To: Justin Stitt Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, nathan@kernel.org, trix@redhat.com 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 Tue, Jun 7, 2022 at 5:14 PM Justin Stitt 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. > > For instance, if __HAVE_BUILTIN_BSWAP16__ was not defined then __swab16 is > actually returning an `int` not a `u16` due to integer promotion as described > by Nick in this thread. This has repercussions when building with clang Also, "this thread" won't make much sense when applied if someone is looking at git log. Consider phrasing this instead as "in the lore link below" then include another link tag to Link: https://lore.kernel.org/llvm/CAKwvOdmXeRbFjkHgFXps4pLH6Q6pGWRNOqA85=h2aFnR=uaggg@mail.gmail.com/ Though, I think it's simply more concise to just include what Al said, and drop this sentence altogether. You can send me v3 privately as an RFC and I'll greenlight it before you resend to the list. -- Thanks, ~Nick Desaulniers