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, URIBL_BLOCKED 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 AC1CFC43465 for ; Sun, 20 Sep 2020 14:53:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68A5821789 for ; Sun, 20 Sep 2020 14:53:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726315AbgITOx6 (ORCPT ); Sun, 20 Sep 2020 10:53:58 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:46032 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbgITOx6 (ORCPT ); Sun, 20 Sep 2020 10:53:58 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kK0it-00FU26-QI; Sun, 20 Sep 2020 16:53:51 +0200 Date: Sun, 20 Sep 2020 16:53:51 +0200 From: Andrew Lunn To: Masahiro Yamada Cc: netdev , David Miller , Jakub Kicinski , Michal Marek , Linux Kbuild mailing list , clang-built-linux Subject: Re: [PATCH RFC/RFT 0/2] W=1 by default for Ethernet PHY subsystem Message-ID: <20200920145351.GB3689762@lunn.ch> References: <20200919190258.3673246-1-andrew@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org On Sun, Sep 20, 2020 at 12:42:51PM +0900, Masahiro Yamada wrote: > On Sun, Sep 20, 2020 at 4:03 AM Andrew Lunn wrote: > > > > There is a movement to make the code base compile clean with W=1. Some > > subsystems are already clean. In order to keep them clean, we need > > developers to build new code with W=1 by default in these subsystems. > > > > This patchset refactors the core Makefile warning code to allow the > > additional warnings W=1 adds available to any Makefile. The Ethernet > > PHY subsystem Makefiles then make use of this to make W=1 the default > > for this subsystem. > > > > RFT since i've only tested with x86 and arm with a modern gcc. Is the > > code really clean for older compilers? For clang? > > > I appreciate your efforts for keeping your subsystems > clean for W=1 builds, and I hope this work will be > extended towards upper directory level, > drivers/net/phy -> drivers/net -> drivers/. It definitely is. drivers/net: https://www.spinics.net/lists/netdev/msg683687.html drivers/spi https://www.spinics.net/lists/linux-spi/msg23280.html drivers/mfd https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2211644.html etc. > So, another idea might be hard-coding extra warnings > like drivers/gpu/drm/i915/Makefile. > > For example, your subsystem already achieved > -Wmissing-declarations free. > > You can add > > subdir-ccflags-y += -Wmissing-declarations > > to drivers/net/phy/Makefile. > > Once you fix all net drivers, you can move it to > the parent, drivers/net/Makefile. > > Then, drivers/Makefile next, and if it reaches > the top directory level, we can move it to W=0. Do you think this will scale? Lets just assume we do this at driver/ level. We have 141 subdirectories in driver/ . So we will end up with 141 subdir-ccflags-y += lines which we need to maintain. Given the current cleanup effort, many are going to be identical to todays W=1. How do we maintain those 141 lines when it is time to add a new flag to W=1? How often are new W=1 flags added? My patch exported KBUILD_CFLAGS_WARN1. How about instead we export KBUILD_CFLAGS_WARN1_20200920. A subsystem can then sign up to being W=1 clean as for the 20200920 definition of W=1. If you want to add a new warning KBUILD_CFLAGS_WARN1_20201031 := KBUILD_CFLAGS_WARN1_20200920 + "-Wghosts" W=1 will always use the latest. You then build with W=1, maybe by throwing it at 0-day, find which subsystems are still clean, and update their subdir-ccflags-y += line with the new timestamp? This should help with scaling, in that a subsystem is not dealing with a list of warnings, just a symbol that represents the warnings from a particular date? Or maybe others have better ideas? Andrew