All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: "Sui Jingfeng" <sui.jingfeng@linux.dev>,
	"Karol Herbst" <kherbst@redhat.com>,
	"Hamza Mahfooz" <hamza.mahfooz@amd.com>,
	"Marijn Suijten" <marijn.suijten@somainline.org>,
	"Javier Martinez Canillas" <javierm@redhat.com>,
	"Danilo Krummrich" <dakr@redhat.com>,
	Pan@freedesktop.org, jani.nikula@intel.com,
	intel-gfx@lists.freedesktop.org,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Sean Paul" <sean@poorly.run>, Xinhui <Xinhui.Pan@amd.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
	"Christian König" <christian.koenig@amd.com>
Subject: [PATCH 5/6] drm: enable (most) W=1 warnings by default across the subsystem
Date: Wed, 10 Jan 2024 19:39:15 +0200	[thread overview]
Message-ID: <1291306bedfd6297d4bf0fca5daa5bac46dde1ad.1704908087.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1704908087.git.jani.nikula@intel.com>

At least the i915 and amd drivers enable a bunch more compiler warnings
than the kernel defaults.

Extend most of 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.

There are too many -Wformat-truncation warnings to cleanly fix up front;
leave that warning disabled for now.

v2:
- Drop -Wformat-truncation (too many warnings)
- Drop -Wstringop-overflow (enabled by default upstream)

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>
Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
Acked-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/Makefile | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 104b42df2e95..8b6be830f7c3 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)
+# FIXME: fix -Wformat-truncation warnings and uncomment
+#subdir-ccflags-y += $(call cc-option, -Wformat-truncation)
+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 \
-- 
2.39.2


WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: "Sui Jingfeng" <sui.jingfeng@linux.dev>,
	"Karol Herbst" <kherbst@redhat.com>,
	"Hamza Mahfooz" <hamza.mahfooz@amd.com>,
	"Marijn Suijten" <marijn.suijten@somainline.org>,
	"David Airlie" <airlied@gmail.com>,
	"Javier Martinez Canillas" <javierm@redhat.com>,
	"Danilo Krummrich" <dakr@redhat.com>,
	Pan@freedesktop.org, "Daniel Vetter" <daniel@ffwll.ch>,
	jani.nikula@intel.com, intel-gfx@lists.freedesktop.org,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	Xinhui <Xinhui.Pan@amd.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
	"Christian König" <christian.koenig@amd.com>
Subject: [PATCH 5/6] drm: enable (most) W=1 warnings by default across the subsystem
Date: Wed, 10 Jan 2024 19:39:15 +0200	[thread overview]
Message-ID: <1291306bedfd6297d4bf0fca5daa5bac46dde1ad.1704908087.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1704908087.git.jani.nikula@intel.com>

At least the i915 and amd drivers enable a bunch more compiler warnings
than the kernel defaults.

Extend most of 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.

There are too many -Wformat-truncation warnings to cleanly fix up front;
leave that warning disabled for now.

v2:
- Drop -Wformat-truncation (too many warnings)
- Drop -Wstringop-overflow (enabled by default upstream)

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>
Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
Acked-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/Makefile | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 104b42df2e95..8b6be830f7c3 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)
+# FIXME: fix -Wformat-truncation warnings and uncomment
+#subdir-ccflags-y += $(call cc-option, -Wformat-truncation)
+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 \
-- 
2.39.2


  parent reply	other threads:[~2024-01-10 17:39 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-10 17:39 [PATCH 0/6] drm: enable W=1 warnings by default across the subsystem Jani Nikula
2024-01-10 17:39 ` [PATCH 1/6] drm/nouveau/acr/ga102: remove unused but set variable Jani Nikula
2024-01-10 17:39   ` Jani Nikula
2024-01-31 12:50   ` Jani Nikula
2024-01-31 12:50     ` Jani Nikula
2024-01-31 19:01   ` Danilo Krummrich
2024-01-31 19:01     ` Danilo Krummrich
2024-02-01  9:41     ` Jani Nikula
2024-02-01  9:41       ` Jani Nikula
2024-01-10 17:39 ` [PATCH 2/6] drm/nouveau/svm: remove unused but set variables Jani Nikula
2024-01-10 17:39   ` Jani Nikula
2024-01-31 12:51   ` Jani Nikula
2024-01-31 12:51     ` Jani Nikula
2024-01-31 19:10   ` Danilo Krummrich
2024-01-31 19:10     ` Danilo Krummrich
2024-02-01  9:42     ` Jani Nikula
2024-02-01  9:42       ` Jani Nikula
2024-01-10 17:39 ` [PATCH 3/6] drm/amdgpu: prefer snprintf over sprintf Jani Nikula
2024-01-12  4:09   ` kernel test robot
2024-01-12  4:09     ` kernel test robot
2024-01-12  9:07     ` Jani Nikula
2024-01-12  9:07       ` Jani Nikula
2024-01-12 14:57   ` Alex Deucher
2024-01-31 12:48     ` Jani Nikula
2024-01-31 12:48       ` Jani Nikula
2024-01-10 17:39 ` [PATCH 4/6] drm/imx: " Jani Nikula
2024-01-10 17:39   ` Jani Nikula
2024-01-12 10:49   ` kernel test robot
2024-01-12 10:49     ` kernel test robot
2024-01-12 14:20   ` Philipp Zabel
2024-01-31 12:49     ` Jani Nikula
2024-01-10 17:39 ` Jani Nikula [this message]
2024-01-10 17:39   ` [PATCH 5/6] drm: enable (most) W=1 warnings by default across the subsystem Jani Nikula
2024-01-10 20:15   ` Hamza Mahfooz
2024-01-10 20:15     ` Hamza Mahfooz
2024-01-11  9:43     ` Jani Nikula
2024-01-11  9:43       ` Jani Nikula
2024-01-10 17:39 ` [PATCH 6/6] drm: Add CONFIG_DRM_WERROR Jani Nikula
2024-01-10 20:17   ` Hamza Mahfooz
2024-01-10 18:52 ` ✗ Fi.CI.CHECKPATCH: warning for drm: enable W=1 warnings by default across the subsystem (rev2) Patchwork
2024-01-10 18:52 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-01-10 19:03 ` ✓ Fi.CI.BAT: success " Patchwork
2024-01-10 23:00 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-04-04 15:16 ` [PATCH 0/6] drm: enable W=1 warnings by default across the subsystem Aishwarya TCV
2024-04-05  9:57   ` Jani Nikula
2024-04-05 10:28     ` Aishwarya TCV

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=1291306bedfd6297d4bf0fca5daa5bac46dde1ad.1704908087.git.jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --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=hamza.mahfooz@amd.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=kherbst@redhat.com \
    --cc=marijn.suijten@somainline.org \
    --cc=mripard@kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=sean@poorly.run \
    --cc=sui.jingfeng@linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.