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 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0639BC4167B for ; Tue, 5 Dec 2023 14:16:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BAFF10E54E; Tue, 5 Dec 2023 14:16:34 +0000 (UTC) X-Greylist: delayed 458 seconds by postgrey-1.36 at gabe; Tue, 05 Dec 2023 14:16:31 UTC Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [IPv6:2001:41d0:1004:224b::bd]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F33910E54E for ; Tue, 5 Dec 2023 14:16:31 +0000 (UTC) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1701785330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I32I7v/9h3pu/d/g+fb5q0L/O3LmmLJ3r5wElMjMeL4=; b=fkq6U9+/NN1mhLPo9KKXi7tS25W3+Cfs8rFawdKDNIevr2K3D/dNZ4DFsc9yyW5Bq122p5 0qtgfofqPr1rJv/F3qnsjR985FiwXfwUo2Ds4MjNTzCLNlhji4A44qvClil8aO0njBEPn0 i1rDR/AzIUREJkGE/k44oT7dnB2uUUs= Date: Tue, 5 Dec 2023 22:08:41 +0800 MIME-Version: 1.0 To: Jani Nikula , dri-devel@lists.freedesktop.org References: <20231129181219.1237887-1-jani.nikula@intel.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sui Jingfeng In-Reply-To: <20231129181219.1237887-1-jani.nikula@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Subject: Re: [Intel-gfx] [RFC] drm: enable W=1 warnings by default across the subsystem X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pan@freedesktop.org, Karol Herbst , intel-gfx@lists.freedesktop.org, Xinhui , Abhinav Kumar , Maxime Ripard , Alex Deucher , Danilo Krummrich , Thomas Zimmermann , Dmitry Baryshkov , Marijn Suijten , =?UTF-8?Q?Christian_K=C3=B6nig?= Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Hi, I'm agree with you. On 2023/11/30 02:12, Jani Nikula wrote: > At least the i915 and amd drivers enable a bunch more compiler warnings > than the kernel defaults. > > Extend the W=1 warnings to the entire drm subsystem by default. Use the > copy-pasted warnings from scripts/Makefile.extrawarn with > s/KBUILD_CFLAGS/subdir-ccflags-y/ to make it easier to compare and keep > up with them in the future. > > This is similar to the approach currently used in i915. > > Some of the -Wextra warnings do need to be disabled, just like in > Makefile.extrawarn, but take care to not disable them for W=2 or W=3 > builds, depending on the warning. > > Cc: David Airlie > Cc: Daniel Vetter > Cc: Maarten Lankhorst > Cc: Maxime Ripard > Cc: Thomas Zimmermann > Cc: Alex Deucher > Cc: Christian König > Cc: Pan, Xinhui > Cc: Karol Herbst > Cc: Lyude Paul > Cc: Danilo Krummrich > Cc: Rob Clark > Cc: Abhinav Kumar > Cc: Dmitry Baryshkov > Cc: Sean Paul > Cc: Marijn Suijten > Signed-off-by: Jani Nikula > Acked-by: Thomas Zimmermann > Acked-by: Javier Martinez Canillas Acked-by: Sui Jingfeng > --- > > With my admittedly limited and very much x86 focused kernel config, I > get some -Wunused-but-set-variable and -Wformat-truncation= warnings, > but nothing we can't handle. > > We could fix them up front, or disable the extra warnings on a per > driver basis with a FIXME comment in their respective Makefiles. > > With the experience from i915, I think this would significantly reduce > the constant loop of warnings added by people not using W=1 and > subsequently fixed by people using W=1. > > Note: I've Cc'd the maintainers of drm, drm misc and some of the biggest > drivers. > --- > drivers/gpu/drm/Makefile | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile > index b4cb0835620a..6939e4ea13d5 100644 > --- a/drivers/gpu/drm/Makefile > +++ b/drivers/gpu/drm/Makefile > @@ -5,6 +5,33 @@ > > CFLAGS-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE > > +# Unconditionally enable W=1 warnings locally > +# --- begin copy-paste W=1 warnings from scripts/Makefile.extrawarn > +subdir-ccflags-y += -Wextra -Wunused -Wno-unused-parameter > +subdir-ccflags-y += -Wmissing-declarations > +subdir-ccflags-y += $(call cc-option, -Wrestrict) > +subdir-ccflags-y += -Wmissing-format-attribute > +subdir-ccflags-y += -Wmissing-prototypes > +subdir-ccflags-y += -Wold-style-definition > +subdir-ccflags-y += -Wmissing-include-dirs > +subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable) > +subdir-ccflags-y += $(call cc-option, -Wunused-const-variable) > +subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned) > +subdir-ccflags-y += $(call cc-option, -Wformat-overflow) > +subdir-ccflags-y += $(call cc-option, -Wformat-truncation) > +subdir-ccflags-y += $(call cc-option, -Wstringop-overflow) > +subdir-ccflags-y += $(call cc-option, -Wstringop-truncation) > +# The following turn off the warnings enabled by -Wextra > +ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),) > +subdir-ccflags-y += -Wno-missing-field-initializers > +subdir-ccflags-y += -Wno-type-limits > +subdir-ccflags-y += -Wno-shift-negative-value > +endif > +ifeq ($(findstring 3, $(KBUILD_EXTRA_WARN)),) > +subdir-ccflags-y += -Wno-sign-compare > +endif > +# --- end copy-paste > + > drm-y := \ > drm_aperture.o \ > drm_atomic.o \