From: Sui Jingfeng <sui.jingfeng@linux.dev>
To: Jani Nikula <jani.nikula@intel.com>, dri-devel@lists.freedesktop.org
Cc: Pan@freedesktop.org, "Karol Herbst" <kherbst@redhat.com>,
intel-gfx@lists.freedesktop.org, Xinhui <Xinhui.Pan@amd.com>,
"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Danilo Krummrich" <dakr@redhat.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
"Marijn Suijten" <marijn.suijten@somainline.org>,
"Christian König" <christian.koenig@amd.com>
Subject: Re: [Intel-gfx] [RFC] drm: enable W=1 warnings by default across the subsystem
Date: Tue, 5 Dec 2023 22:08:41 +0800 [thread overview]
Message-ID: <e403811b-7f9b-4793-8282-0166a7d903f2@linux.dev> (raw)
In-Reply-To: <20231129181219.1237887-1-jani.nikula@intel.com>
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 <airlied@gmail.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Pan, Xinhui <Xinhui.Pan@amd.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Danilo Krummrich <dakr@redhat.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Cc: Sean Paul <sean@poorly.run>
> Cc: Marijn Suijten <marijn.suijten@somainline.org>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
> Acked-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Sui Jingfeng <sui.jingfeng@linux.dev>
> ---
>
> 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 \
prev parent reply other threads:[~2023-12-05 14:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 18:12 [Intel-gfx] [RFC] drm: enable W=1 warnings by default across the subsystem Jani Nikula
2023-11-29 20:21 ` Hamza Mahfooz
2023-11-30 8:52 ` Jani Nikula
2023-11-30 9:18 ` Maxime Ripard
2023-11-30 9:30 ` Javier Martinez Canillas
2023-11-30 9:46 ` Jani Nikula
2023-11-30 9:59 ` Javier Martinez Canillas
2023-11-30 10:06 ` Maxime Ripard
2023-11-30 10:19 ` Javier Martinez Canillas
2023-12-05 14:25 ` Dmitry Baryshkov
2023-12-01 17:59 ` Nathan Chancellor
2023-11-30 5:59 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork
2023-11-30 6:04 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-11-30 10:01 ` [Intel-gfx] [RFC] " Thomas Zimmermann
2023-12-01 6:15 ` [Intel-gfx] ✗ Fi.CI.IGT: failure for " Patchwork
2023-12-05 14:08 ` Sui Jingfeng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e403811b-7f9b-4793-8282-0166a7d903f2@linux.dev \
--to=sui.jingfeng@linux.dev \
--cc=Pan@freedesktop.org \
--cc=Xinhui.Pan@amd.com \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=dakr@redhat.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=kherbst@redhat.com \
--cc=marijn.suijten@somainline.org \
--cc=mripard@kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox