From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B4C8C4363A for ; Wed, 28 Oct 2020 22:15:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E666224724 for ; Wed, 28 Oct 2020 22:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731313AbgJ1WPS (ORCPT ); Wed, 28 Oct 2020 18:15:18 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:51986 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731268AbgJ1WPG (ORCPT ); Wed, 28 Oct 2020 18:15:06 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id A654929A58; Tue, 27 Oct 2020 23:26:19 -0400 (EDT) Date: Wed, 28 Oct 2020 14:26:12 +1100 (AEDT) From: Finn Thain To: Tom Rix cc: linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, linux-pm@vger.kernel.org, linux-crypto@vger.kernel.org, qat-linux@intel.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-iio@vger.kernel.org, linux-rdma@vger.kernel.org, linux-mmc@vger.kernel.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-rtc@vger.kernel.org, linux-scsi@vger.kernel.org, linux-aspeed@lists.ozlabs.org, linux-samsung-soc@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-nfs@vger.kernel.org, tipc-discussion@lists.sourceforge.net, alsa-devel@alsa-project.org, linux-rpi-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: Re: [RFC] clang tooling cleanups In-Reply-To: <20201027164255.1573301-1-trix@redhat.com> Message-ID: References: <20201027164255.1573301-1-trix@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Tue, 27 Oct 2020, trix@redhat.com wrote: > This rfc will describe > An upcoming treewide cleanup. > How clang tooling was used to programatically do the clean up. > Solicit opinions on how to generally use clang tooling. > This tooling is very impressive. It makes possible an idea that I had a while ago, to help make code review more efficient. It works like this. Suppose a patch, p, is the difference between the new tree, n, and the old tree, o. That is, p = n - o. Now let clang-tidy be the transformation 't'. This gets you a much more readable patch submission, P = t(n) - t(o). The only difficulty is that, if I submit P intead of p then 'git am' will probably reject it. This is solved by a little tooling around git, such that, should a patch P fail to apply, the relevant files are automatically reformatted with the officially endorsed transformation t, to generate a minimal cleanup patch, such that P can be automatically applied on top. If the patch submission process required* that every patch submission was generated like P and not like p, it would immediately eliminate all clean-up patches from the workload of all reviewers, and also make the reviewers' job easier because all submissions are now formatted correctly, and also avoid time lost to round-trips, such as, "you can have a reviewed-by if you respin to fix some minor style issues". * Enforcing this, e.g. with checkpatch, is slightly more complicated, but it works the same way: generate a minimal cleanup patch for the relevant files, apply the patch-to-be-submitted, and finally confirm that the modified files are unchanged under t.