Linux-mm Archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] kbuild: enable some -Wextra warnings by default
@ 2024-03-26 14:47 Arnd Bergmann
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
  0 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:47 UTC (permalink / raw
  To: linux-kbuild, Masahiro Yamada, Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, Bill Metzenthen, Thomas Gleixner,
	x86, Damien Le Moal, Jean Delvare, Harry Wentland, Jani Nikula,
	Sergey Shtylyov, Jakub Kicinski, Sudip Mukherjee, Andrew Jeffery,
	Manoj N. Kumar, Martin K. Petersen, Alexei Starovoitov,
	Steven Rostedt, Luis Chamberlain, Andrew Morton,
	Greg Kroah-Hartman, linux-kernel, linux-ide, amd-gfx, dri-devel,
	intel-gfx, nouveau, intel-xe, netdev, linux-renesas-soc,
	linux-arm-kernel, linux-scsi, bpf, linux-trace-kernel,
	linux-modules, linux-mm, llvm

From: Arnd Bergmann <arnd@arndb.de>

This is a follow-up on a couple of patch series I sent in the past,
enabling -Wextra (aside from stuff that is explicitly disabled),
-Wcast-function-pointer-strict and -Wrestrict.

I have tested these on 'defconfig' and 'allmodconfig' builds across
all architectures, as well as many 'randconfig' builds on x86, arm and
arm64. It would be nice to have all the Makefile.extrawarn changes in
v6.10, hopefully with the driver fixes going in before that through
the respective subsystem trees.

     Arnd

Arnd Bergmann (12):
  kbuild: make -Woverride-init warnings more consistent
  [v3] parport: mfc3: avoid empty-body warning
  kbuild: turn on -Wextra by default
  kbuild: remove redundant extra warning flags
  firmware: dmi-id: add a release callback function
  nouveau: fix function cast warning
  cxlflash: fix function pointer cast warnings
  x86: math-emu: fix function cast warnings
  kbuild: enable -Wcast-function-type-strict unconditionally
  sata: sx4: fix pdc20621_get_from_dimm() on 64-bit
  [v4] kallsyms: rework symbol lookup return codes
  kbuild: turn on -Wrestrict by default

 arch/x86/math-emu/fpu_etc.c                   |  9 +++--
 arch/x86/math-emu/fpu_trig.c                  |  6 ++--
 arch/x86/math-emu/reg_constant.c              |  7 +++-
 drivers/ata/sata_sx4.c                        |  6 ++--
 drivers/firmware/dmi-id.c                     |  7 +++-
 .../gpu/drm/amd/display/dc/dce110/Makefile    |  2 +-
 .../gpu/drm/amd/display/dc/dce112/Makefile    |  2 +-
 .../gpu/drm/amd/display/dc/dce120/Makefile    |  2 +-
 drivers/gpu/drm/amd/display/dc/dce60/Makefile |  2 +-
 drivers/gpu/drm/amd/display/dc/dce80/Makefile |  2 +-
 drivers/gpu/drm/i915/Makefile                 |  6 ++--
 .../drm/nouveau/nvkm/subdev/bios/shadowof.c   |  7 +++-
 drivers/gpu/drm/xe/Makefile                   |  4 +--
 drivers/net/ethernet/renesas/sh_eth.c         |  2 +-
 drivers/parport/parport_mfc3.c                |  3 +-
 drivers/pinctrl/aspeed/Makefile               |  2 +-
 drivers/scsi/cxlflash/lunmgt.c                |  4 +--
 drivers/scsi/cxlflash/main.c                  | 14 ++++----
 drivers/scsi/cxlflash/superpipe.c             | 34 +++++++++----------
 drivers/scsi/cxlflash/superpipe.h             | 11 +++---
 drivers/scsi/cxlflash/vlun.c                  |  7 ++--
 fs/proc/Makefile                              |  2 +-
 include/linux/filter.h                        | 14 ++++----
 include/linux/ftrace.h                        |  6 ++--
 include/linux/module.h                        | 14 ++++----
 kernel/bpf/Makefile                           |  2 +-
 kernel/bpf/core.c                             |  7 ++--
 kernel/kallsyms.c                             | 23 +++++++------
 kernel/module/kallsyms.c                      | 26 +++++++-------
 kernel/trace/ftrace.c                         | 13 +++----
 mm/Makefile                                   |  3 +-
 scripts/Makefile.extrawarn                    | 33 ++++--------------
 32 files changed, 134 insertions(+), 148 deletions(-)

-- 
2.39.2

Cc: Bill Metzenthen <billm@melbpc.org.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Cc: Damien Le Moal <dlemoal@kernel.org>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Sergey Shtylyov <s.shtylyov@omp.ru>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: "Manoj N. Kumar" <manoj@linux.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicolas Schier <nicolas@fjasle.eu>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org
Cc: linux-ide@vger.kernel.org
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Cc: netdev@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-scsi@vger.kernel.org
Cc: bpf@vger.kernel.org
Cc: linux-trace-kernel@vger.kernel.org
Cc: linux-modules@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: linux-kbuild@vger.kernel.org
Cc: llvm@lists.linux.dev


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
@ 2024-03-26 14:47 ` Arnd Bergmann
  2024-03-26 16:04   ` Hamza Mahfooz
                     ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Arnd Bergmann @ 2024-03-26 14:47 UTC (permalink / raw
  To: linux-kbuild, Masahiro Yamada, Harry Wentland, Alex Deucher,
	Christian König, Jani Nikula, Lucas De Marchi, Oded Gabbay,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Andrew Jeffery, Linus Walleij,
	Joel Stanley, Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, dri-devel, linux-kernel, netdev,
	linux-mm, llvm

From: Arnd Bergmann <arnd@arndb.de>

The -Woverride-init warn about code that may be intentional or not,
but the inintentional ones tend to be real bugs, so there is a bit of
disagreement on whether this warning option should be enabled by default
and we have multiple settings in scripts/Makefile.extrawarn as well as
individual subsystems.

Older versions of clang only supported -Wno-initializer-overrides with
the same meaning as gcc's -Woverride-init, though all supported versions
now work with both. Because of this difference, an earlier cleanup of
mine accidentally turned the clang warning off for W=1 builds and only
left it on for W=2, while it's still enabled for gcc with W=1.

There is also one driver that only turns the warning off for newer
versions of gcc but not other compilers, and some but not all the
Makefiles still use a cc-disable-warning conditional that is no
longer needed with supported compilers here.

Address all of the above by removing the special cases for clang
and always turning the warning off unconditionally where it got
in the way, using the syntax that is supported by both compilers.

Fixes: 2cd3271b7a31 ("kbuild: avoid duplicate warning options")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/amd/display/dc/dce110/Makefile |  2 +-
 drivers/gpu/drm/amd/display/dc/dce112/Makefile |  2 +-
 drivers/gpu/drm/amd/display/dc/dce120/Makefile |  2 +-
 drivers/gpu/drm/amd/display/dc/dce60/Makefile  |  2 +-
 drivers/gpu/drm/amd/display/dc/dce80/Makefile  |  2 +-
 drivers/gpu/drm/i915/Makefile                  |  6 +++---
 drivers/gpu/drm/xe/Makefile                    |  4 ++--
 drivers/net/ethernet/renesas/sh_eth.c          |  2 +-
 drivers/pinctrl/aspeed/Makefile                |  2 +-
 fs/proc/Makefile                               |  2 +-
 kernel/bpf/Makefile                            |  2 +-
 mm/Makefile                                    |  3 +--
 scripts/Makefile.extrawarn                     | 10 +++-------
 13 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce110/Makefile b/drivers/gpu/drm/amd/display/dc/dce110/Makefile
index f0777d61c2cb..c307f040e48f 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dce110/Makefile
@@ -23,7 +23,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = $(call cc-disable-warning, override-init)
+CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = -Wno-override-init
 
 DCE110 = dce110_timing_generator.o \
 dce110_compressor.o dce110_opp_regamma_v.o \
diff --git a/drivers/gpu/drm/amd/display/dc/dce112/Makefile b/drivers/gpu/drm/amd/display/dc/dce112/Makefile
index 7e92effec894..683866797709 100644
--- a/drivers/gpu/drm/amd/display/dc/dce112/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dce112/Makefile
@@ -23,7 +23,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = $(call cc-disable-warning, override-init)
+CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = -Wno-override-init
 
 DCE112 = dce112_compressor.o
 
diff --git a/drivers/gpu/drm/amd/display/dc/dce120/Makefile b/drivers/gpu/drm/amd/display/dc/dce120/Makefile
index 1e3ef68a452a..8f508e662748 100644
--- a/drivers/gpu/drm/amd/display/dc/dce120/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dce120/Makefile
@@ -24,7 +24,7 @@
 # It provides the control and status of HW CRTC block.
 
 
-CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = $(call cc-disable-warning, override-init)
+CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = -Wno-override-init
 
 DCE120 = dce120_timing_generator.o
 
diff --git a/drivers/gpu/drm/amd/display/dc/dce60/Makefile b/drivers/gpu/drm/amd/display/dc/dce60/Makefile
index fee331accc0e..eede83ad91fa 100644
--- a/drivers/gpu/drm/amd/display/dc/dce60/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dce60/Makefile
@@ -23,7 +23,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = $(call cc-disable-warning, override-init)
+CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = -Wno-override-init
 
 DCE60 = dce60_timing_generator.o dce60_hw_sequencer.o \
 	dce60_resource.o
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/Makefile b/drivers/gpu/drm/amd/display/dc/dce80/Makefile
index 7eefffbdc925..fba189d26652 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dce80/Makefile
@@ -23,7 +23,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = $(call cc-disable-warning, override-init)
+CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = -Wno-override-init
 
 DCE80 = dce80_timing_generator.o
 
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 3ef6ed41e62b..4c2f85632391 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -33,9 +33,9 @@ endif
 subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
 
 # Fine grained warnings disable
-CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init)
-CFLAGS_display/intel_display_device.o = $(call cc-disable-warning, override-init)
-CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
+CFLAGS_i915_pci.o = -Wno-override-init
+CFLAGS_display/intel_display_device.o = -Wno-override-init
+CFLAGS_display/intel_fbdev.o = -Wno-override-init
 
 # Support compiling the display code separately for both i915 and xe
 # drivers. Define I915 when building i915.
diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index 5a428ca00f10..c29a850859ad 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -172,8 +172,8 @@ subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \
 	-Ddrm_i915_gem_object=xe_bo \
 	-Ddrm_i915_private=xe_device
 
-CFLAGS_i915-display/intel_fbdev.o = $(call cc-disable-warning, override-init)
-CFLAGS_i915-display/intel_display_device.o = $(call cc-disable-warning, override-init)
+CFLAGS_i915-display/intel_fbdev.o = -Wno-override-init
+CFLAGS_i915-display/intel_display_device.o = -Wno-override-init
 
 # Rule to build SOC code shared with i915
 $(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 475e1e8c1d35..0786eb0da391 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -50,7 +50,7 @@
  * the macros available to do this only define GCC 8.
  */
 __diag_push();
-__diag_ignore(GCC, 8, "-Woverride-init",
+__diag_ignore_all("-Woverride-init",
 	      "logic to initialize all and then override some is OK");
 static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
 	SH_ETH_OFFSET_DEFAULTS,
diff --git a/drivers/pinctrl/aspeed/Makefile b/drivers/pinctrl/aspeed/Makefile
index 489ea1778353..db2a7600ae2b 100644
--- a/drivers/pinctrl/aspeed/Makefile
+++ b/drivers/pinctrl/aspeed/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 # Aspeed pinctrl support
 
-ccflags-y += $(call cc-option,-Woverride-init)
+ccflags-y += -Woverride-init
 obj-$(CONFIG_PINCTRL_ASPEED)	+= pinctrl-aspeed.o pinmux-aspeed.o
 obj-$(CONFIG_PINCTRL_ASPEED_G4)	+= pinctrl-aspeed-g4.o
 obj-$(CONFIG_PINCTRL_ASPEED_G5)	+= pinctrl-aspeed-g5.o
diff --git a/fs/proc/Makefile b/fs/proc/Makefile
index bd08616ed8ba..7b4db9c56e6a 100644
--- a/fs/proc/Makefile
+++ b/fs/proc/Makefile
@@ -5,7 +5,7 @@
 
 obj-y   += proc.o
 
-CFLAGS_task_mmu.o	+= $(call cc-option,-Wno-override-init,)
+CFLAGS_task_mmu.o	+= -Wno-override-init
 proc-y			:= nommu.o task_nommu.o
 proc-$(CONFIG_MMU)	:= task_mmu.o
 
diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
index 368c5d86b5b7..e497011261b8 100644
--- a/kernel/bpf/Makefile
+++ b/kernel/bpf/Makefile
@@ -4,7 +4,7 @@ ifneq ($(CONFIG_BPF_JIT_ALWAYS_ON),y)
 # ___bpf_prog_run() needs GCSE disabled on x86; see 3193c0836f203 for details
 cflags-nogcse-$(CONFIG_X86)$(CONFIG_CC_IS_GCC) := -fno-gcse
 endif
-CFLAGS_core.o += $(call cc-disable-warning, override-init) $(cflags-nogcse-yy)
+CFLAGS_core.o += -Wno-override-init $(cflags-nogcse-yy)
 
 obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o log.o token.o
 obj-$(CONFIG_BPF_SYSCALL) += bpf_iter.o map_iter.o task_iter.o prog_iter.o link_iter.o
diff --git a/mm/Makefile b/mm/Makefile
index e4b5b75aaec9..4abb40b911ec 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -29,8 +29,7 @@ KCOV_INSTRUMENT_mmzone.o := n
 KCOV_INSTRUMENT_vmstat.o := n
 KCOV_INSTRUMENT_failslab.o := n
 
-CFLAGS_init-mm.o += $(call cc-disable-warning, override-init)
-CFLAGS_init-mm.o += $(call cc-disable-warning, initializer-overrides)
+CFLAGS_init-mm.o += -Wno-override-init
 
 mmu-y			:= nommu.o
 mmu-$(CONFIG_MMU)	:= highmem.o memory.o mincore.o \
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 3ce5d503a6da..c5af566e911a 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -114,6 +114,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
 KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
 
+KBUILD_CFLAGS += -Wno-override-init # alias for -Wno-initializer-overrides in clang
+
 ifdef CONFIG_CC_IS_CLANG
 # Clang before clang-16 would warn on default argument promotions.
 ifneq ($(call clang-min-version, 160000),y)
@@ -151,10 +153,6 @@ KBUILD_CFLAGS += -Wtype-limits
 KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized)
 KBUILD_CFLAGS += $(call cc-option, -Wunused-macros)
 
-ifdef CONFIG_CC_IS_CLANG
-KBUILD_CFLAGS += -Winitializer-overrides
-endif
-
 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2
 
 else
@@ -164,9 +162,7 @@ KBUILD_CFLAGS += -Wno-missing-field-initializers
 KBUILD_CFLAGS += -Wno-type-limits
 KBUILD_CFLAGS += -Wno-shift-negative-value
 
-ifdef CONFIG_CC_IS_CLANG
-KBUILD_CFLAGS += -Wno-initializer-overrides
-else
+ifdef CONFIG_CC_IS_GCC
 KBUILD_CFLAGS += -Wno-maybe-uninitialized
 endif
 
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
@ 2024-03-26 16:04   ` Hamza Mahfooz
  2024-03-26 20:24   ` Jani Nikula
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Hamza Mahfooz @ 2024-03-26 16:04 UTC (permalink / raw
  To: Arnd Bergmann, linux-kbuild, Masahiro Yamada, Harry Wentland,
	Alex Deucher, Christian König, Jani Nikula, Lucas De Marchi,
	Oded Gabbay, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Andrew Jeffery, Linus Walleij,
	Joel Stanley, Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, dri-devel, linux-kernel, netdev,
	linux-mm, llvm, amd-gfx

Cc: amd-gfx@lists.freedesktop.org

On 3/26/24 10:47, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The -Woverride-init warn about code that may be intentional or not,
> but the inintentional ones tend to be real bugs, so there is a bit of
> disagreement on whether this warning option should be enabled by default
> and we have multiple settings in scripts/Makefile.extrawarn as well as
> individual subsystems.
> 
> Older versions of clang only supported -Wno-initializer-overrides with
> the same meaning as gcc's -Woverride-init, though all supported versions
> now work with both. Because of this difference, an earlier cleanup of
> mine accidentally turned the clang warning off for W=1 builds and only
> left it on for W=2, while it's still enabled for gcc with W=1.
> 
> There is also one driver that only turns the warning off for newer
> versions of gcc but not other compilers, and some but not all the
> Makefiles still use a cc-disable-warning conditional that is no
> longer needed with supported compilers here.
> 
> Address all of the above by removing the special cases for clang
> and always turning the warning off unconditionally where it got
> in the way, using the syntax that is supported by both compilers.
> 
> Fixes: 2cd3271b7a31 ("kbuild: avoid duplicate warning options")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Hamza Mahfooz <hamza.mahfooz@amd.com>

For the amdgpu changes.

> ---
>   drivers/gpu/drm/amd/display/dc/dce110/Makefile |  2 +-
>   drivers/gpu/drm/amd/display/dc/dce112/Makefile |  2 +-
>   drivers/gpu/drm/amd/display/dc/dce120/Makefile |  2 +-
>   drivers/gpu/drm/amd/display/dc/dce60/Makefile  |  2 +-
>   drivers/gpu/drm/amd/display/dc/dce80/Makefile  |  2 +-
>   drivers/gpu/drm/i915/Makefile                  |  6 +++---
>   drivers/gpu/drm/xe/Makefile                    |  4 ++--
>   drivers/net/ethernet/renesas/sh_eth.c          |  2 +-
>   drivers/pinctrl/aspeed/Makefile                |  2 +-
>   fs/proc/Makefile                               |  2 +-
>   kernel/bpf/Makefile                            |  2 +-
>   mm/Makefile                                    |  3 +--
>   scripts/Makefile.extrawarn                     | 10 +++-------
>   13 files changed, 18 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dce110/Makefile b/drivers/gpu/drm/amd/display/dc/dce110/Makefile
> index f0777d61c2cb..c307f040e48f 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce110/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dce110/Makefile
> @@ -23,7 +23,7 @@
>   # Makefile for the 'controller' sub-component of DAL.
>   # It provides the control and status of HW CRTC block.
>   
> -CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = $(call cc-disable-warning, override-init)
> +CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = -Wno-override-init
>   
>   DCE110 = dce110_timing_generator.o \
>   dce110_compressor.o dce110_opp_regamma_v.o \
> diff --git a/drivers/gpu/drm/amd/display/dc/dce112/Makefile b/drivers/gpu/drm/amd/display/dc/dce112/Makefile
> index 7e92effec894..683866797709 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce112/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dce112/Makefile
> @@ -23,7 +23,7 @@
>   # Makefile for the 'controller' sub-component of DAL.
>   # It provides the control and status of HW CRTC block.
>   
> -CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = $(call cc-disable-warning, override-init)
> +CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = -Wno-override-init
>   
>   DCE112 = dce112_compressor.o
>   
> diff --git a/drivers/gpu/drm/amd/display/dc/dce120/Makefile b/drivers/gpu/drm/amd/display/dc/dce120/Makefile
> index 1e3ef68a452a..8f508e662748 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce120/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dce120/Makefile
> @@ -24,7 +24,7 @@
>   # It provides the control and status of HW CRTC block.
>   
>   
> -CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = $(call cc-disable-warning, override-init)
> +CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = -Wno-override-init
>   
>   DCE120 = dce120_timing_generator.o
>   
> diff --git a/drivers/gpu/drm/amd/display/dc/dce60/Makefile b/drivers/gpu/drm/amd/display/dc/dce60/Makefile
> index fee331accc0e..eede83ad91fa 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce60/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dce60/Makefile
> @@ -23,7 +23,7 @@
>   # Makefile for the 'controller' sub-component of DAL.
>   # It provides the control and status of HW CRTC block.
>   
> -CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = $(call cc-disable-warning, override-init)
> +CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = -Wno-override-init
>   
>   DCE60 = dce60_timing_generator.o dce60_hw_sequencer.o \
>   	dce60_resource.o
> diff --git a/drivers/gpu/drm/amd/display/dc/dce80/Makefile b/drivers/gpu/drm/amd/display/dc/dce80/Makefile
> index 7eefffbdc925..fba189d26652 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce80/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dce80/Makefile
> @@ -23,7 +23,7 @@
>   # Makefile for the 'controller' sub-component of DAL.
>   # It provides the control and status of HW CRTC block.
>   
> -CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = $(call cc-disable-warning, override-init)
> +CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = -Wno-override-init
>   
>   DCE80 = dce80_timing_generator.o
>   
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 3ef6ed41e62b..4c2f85632391 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -33,9 +33,9 @@ endif
>   subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
>   
>   # Fine grained warnings disable
> -CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init)
> -CFLAGS_display/intel_display_device.o = $(call cc-disable-warning, override-init)
> -CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
> +CFLAGS_i915_pci.o = -Wno-override-init
> +CFLAGS_display/intel_display_device.o = -Wno-override-init
> +CFLAGS_display/intel_fbdev.o = -Wno-override-init
>   
>   # Support compiling the display code separately for both i915 and xe
>   # drivers. Define I915 when building i915.
> diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
> index 5a428ca00f10..c29a850859ad 100644
> --- a/drivers/gpu/drm/xe/Makefile
> +++ b/drivers/gpu/drm/xe/Makefile
> @@ -172,8 +172,8 @@ subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \
>   	-Ddrm_i915_gem_object=xe_bo \
>   	-Ddrm_i915_private=xe_device
>   
> -CFLAGS_i915-display/intel_fbdev.o = $(call cc-disable-warning, override-init)
> -CFLAGS_i915-display/intel_display_device.o = $(call cc-disable-warning, override-init)
> +CFLAGS_i915-display/intel_fbdev.o = -Wno-override-init
> +CFLAGS_i915-display/intel_display_device.o = -Wno-override-init
>   
>   # Rule to build SOC code shared with i915
>   $(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 475e1e8c1d35..0786eb0da391 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -50,7 +50,7 @@
>    * the macros available to do this only define GCC 8.
>    */
>   __diag_push();
> -__diag_ignore(GCC, 8, "-Woverride-init",
> +__diag_ignore_all("-Woverride-init",
>   	      "logic to initialize all and then override some is OK");
>   static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
>   	SH_ETH_OFFSET_DEFAULTS,
> diff --git a/drivers/pinctrl/aspeed/Makefile b/drivers/pinctrl/aspeed/Makefile
> index 489ea1778353..db2a7600ae2b 100644
> --- a/drivers/pinctrl/aspeed/Makefile
> +++ b/drivers/pinctrl/aspeed/Makefile
> @@ -1,7 +1,7 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>   # Aspeed pinctrl support
>   
> -ccflags-y += $(call cc-option,-Woverride-init)
> +ccflags-y += -Woverride-init
>   obj-$(CONFIG_PINCTRL_ASPEED)	+= pinctrl-aspeed.o pinmux-aspeed.o
>   obj-$(CONFIG_PINCTRL_ASPEED_G4)	+= pinctrl-aspeed-g4.o
>   obj-$(CONFIG_PINCTRL_ASPEED_G5)	+= pinctrl-aspeed-g5.o
> diff --git a/fs/proc/Makefile b/fs/proc/Makefile
> index bd08616ed8ba..7b4db9c56e6a 100644
> --- a/fs/proc/Makefile
> +++ b/fs/proc/Makefile
> @@ -5,7 +5,7 @@
>   
>   obj-y   += proc.o
>   
> -CFLAGS_task_mmu.o	+= $(call cc-option,-Wno-override-init,)
> +CFLAGS_task_mmu.o	+= -Wno-override-init
>   proc-y			:= nommu.o task_nommu.o
>   proc-$(CONFIG_MMU)	:= task_mmu.o
>   
> diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
> index 368c5d86b5b7..e497011261b8 100644
> --- a/kernel/bpf/Makefile
> +++ b/kernel/bpf/Makefile
> @@ -4,7 +4,7 @@ ifneq ($(CONFIG_BPF_JIT_ALWAYS_ON),y)
>   # ___bpf_prog_run() needs GCSE disabled on x86; see 3193c0836f203 for details
>   cflags-nogcse-$(CONFIG_X86)$(CONFIG_CC_IS_GCC) := -fno-gcse
>   endif
> -CFLAGS_core.o += $(call cc-disable-warning, override-init) $(cflags-nogcse-yy)
> +CFLAGS_core.o += -Wno-override-init $(cflags-nogcse-yy)
>   
>   obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o log.o token.o
>   obj-$(CONFIG_BPF_SYSCALL) += bpf_iter.o map_iter.o task_iter.o prog_iter.o link_iter.o
> diff --git a/mm/Makefile b/mm/Makefile
> index e4b5b75aaec9..4abb40b911ec 100644
> --- a/mm/Makefile
> +++ b/mm/Makefile
> @@ -29,8 +29,7 @@ KCOV_INSTRUMENT_mmzone.o := n
>   KCOV_INSTRUMENT_vmstat.o := n
>   KCOV_INSTRUMENT_failslab.o := n
>   
> -CFLAGS_init-mm.o += $(call cc-disable-warning, override-init)
> -CFLAGS_init-mm.o += $(call cc-disable-warning, initializer-overrides)
> +CFLAGS_init-mm.o += -Wno-override-init
>   
>   mmu-y			:= nommu.o
>   mmu-$(CONFIG_MMU)	:= highmem.o memory.o mincore.o \
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 3ce5d503a6da..c5af566e911a 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -114,6 +114,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
>   KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
>   KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
>   
> +KBUILD_CFLAGS += -Wno-override-init # alias for -Wno-initializer-overrides in clang
> +
>   ifdef CONFIG_CC_IS_CLANG
>   # Clang before clang-16 would warn on default argument promotions.
>   ifneq ($(call clang-min-version, 160000),y)
> @@ -151,10 +153,6 @@ KBUILD_CFLAGS += -Wtype-limits
>   KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized)
>   KBUILD_CFLAGS += $(call cc-option, -Wunused-macros)
>   
> -ifdef CONFIG_CC_IS_CLANG
> -KBUILD_CFLAGS += -Winitializer-overrides
> -endif
> -
>   KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2
>   
>   else
> @@ -164,9 +162,7 @@ KBUILD_CFLAGS += -Wno-missing-field-initializers
>   KBUILD_CFLAGS += -Wno-type-limits
>   KBUILD_CFLAGS += -Wno-shift-negative-value
>   
> -ifdef CONFIG_CC_IS_CLANG
> -KBUILD_CFLAGS += -Wno-initializer-overrides
> -else
> +ifdef CONFIG_CC_IS_GCC
>   KBUILD_CFLAGS += -Wno-maybe-uninitialized
>   endif
>   
-- 
Hamza



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
  2024-03-26 16:04   ` Hamza Mahfooz
@ 2024-03-26 20:24   ` Jani Nikula
  2024-03-26 20:55     ` Arnd Bergmann
  2024-03-26 23:02   ` Andrew Jeffery
  2024-03-28  9:18   ` Linus Walleij
  3 siblings, 1 reply; 10+ messages in thread
From: Jani Nikula @ 2024-03-26 20:24 UTC (permalink / raw
  To: Arnd Bergmann, linux-kbuild, Masahiro Yamada, Harry Wentland,
	Alex Deucher, Christian König, Lucas De Marchi, Oded Gabbay,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Andrew Jeffery, Linus Walleij,
	Joel Stanley, Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, dri-devel, linux-kernel, netdev,
	linux-mm, llvm

On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The -Woverride-init warn about code that may be intentional or not,
> but the inintentional ones tend to be real bugs, so there is a bit of
> disagreement on whether this warning option should be enabled by default
> and we have multiple settings in scripts/Makefile.extrawarn as well as
> individual subsystems.
>
> Older versions of clang only supported -Wno-initializer-overrides with
> the same meaning as gcc's -Woverride-init, though all supported versions
> now work with both. Because of this difference, an earlier cleanup of
> mine accidentally turned the clang warning off for W=1 builds and only
> left it on for W=2, while it's still enabled for gcc with W=1.
>
> There is also one driver that only turns the warning off for newer
> versions of gcc but not other compilers, and some but not all the
> Makefiles still use a cc-disable-warning conditional that is no
> longer needed with supported compilers here.
>
> Address all of the above by removing the special cases for clang
> and always turning the warning off unconditionally where it got
> in the way, using the syntax that is supported by both compilers.
>
> Fixes: 2cd3271b7a31 ("kbuild: avoid duplicate warning options")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/amd/display/dc/dce110/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce112/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce120/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce60/Makefile  |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce80/Makefile  |  2 +-
>  drivers/gpu/drm/i915/Makefile                  |  6 +++---
>  drivers/gpu/drm/xe/Makefile                    |  4 ++--
>  drivers/net/ethernet/renesas/sh_eth.c          |  2 +-
>  drivers/pinctrl/aspeed/Makefile                |  2 +-
>  fs/proc/Makefile                               |  2 +-
>  kernel/bpf/Makefile                            |  2 +-
>  mm/Makefile                                    |  3 +--
>  scripts/Makefile.extrawarn                     | 10 +++-------
>  13 files changed, 18 insertions(+), 23 deletions(-)
>

[snip]

> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 3ef6ed41e62b..4c2f85632391 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -33,9 +33,9 @@ endif
>  subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
>  
>  # Fine grained warnings disable
> -CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init)
> -CFLAGS_display/intel_display_device.o = $(call cc-disable-warning, override-init)
> -CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
> +CFLAGS_i915_pci.o = -Wno-override-init
> +CFLAGS_display/intel_display_device.o = -Wno-override-init
> +CFLAGS_display/intel_fbdev.o = -Wno-override-init
>  
>  # Support compiling the display code separately for both i915 and xe
>  # drivers. Define I915 when building i915.
> diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
> index 5a428ca00f10..c29a850859ad 100644
> --- a/drivers/gpu/drm/xe/Makefile
> +++ b/drivers/gpu/drm/xe/Makefile
> @@ -172,8 +172,8 @@ subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \
>  	-Ddrm_i915_gem_object=xe_bo \
>  	-Ddrm_i915_private=xe_device
>  
> -CFLAGS_i915-display/intel_fbdev.o = $(call cc-disable-warning, override-init)
> -CFLAGS_i915-display/intel_display_device.o = $(call cc-disable-warning, override-init)
> +CFLAGS_i915-display/intel_fbdev.o = -Wno-override-init
> +CFLAGS_i915-display/intel_display_device.o = -Wno-override-init

For i915 and xe parts,

Acked-by: Jani Nikula <jani.nikula@intel.com>

>  # Rule to build SOC code shared with i915
>  $(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 475e1e8c1d35..0786eb0da391 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -50,7 +50,7 @@
>   * the macros available to do this only define GCC 8.
>   */
>  __diag_push();
> -__diag_ignore(GCC, 8, "-Woverride-init",
> +__diag_ignore_all("-Woverride-init",
>  	      "logic to initialize all and then override some is OK");

This is nice because it's more localized than the per-file
disable. However, we tried to do this in i915, but this doesn't work for
GCC versions < 8, and some defconfigs enabling -Werror forced us to
revert. See commit 290d16104575 ("Revert "drm/i915: use localized
__diag_ignore_all() instead of per file"").

BR,
Jani.


-- 
Jani Nikula, Intel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 20:24   ` Jani Nikula
@ 2024-03-26 20:55     ` Arnd Bergmann
  2024-03-27  7:50       ` Jani Nikula
  0 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2024-03-26 20:55 UTC (permalink / raw
  To: Jani Nikula, Arnd Bergmann, linux-kbuild, Masahiro Yamada,
	Harry Wentland, Alex Deucher, Christian König,
	Lucas De Marchi, Oded Gabbay, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Jakub Kicinski, Paolo Abeni, Andrew Jeffery,
	Linus Walleij, Joel Stanley, Alexei Starovoitov, Daniel Borkmann,
	Andrew Morton, Nathan Chancellor
  Cc: Nicolas Schier, dri-devel, linux-kernel, Netdev, linux-mm, llvm

On Tue, Mar 26, 2024, at 21:24, Jani Nikula wrote:
> On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> index 475e1e8c1d35..0786eb0da391 100644
>> --- a/drivers/net/ethernet/renesas/sh_eth.c
>> +++ b/drivers/net/ethernet/renesas/sh_eth.c
>> @@ -50,7 +50,7 @@
>>   * the macros available to do this only define GCC 8.
>>   */
>>  __diag_push();
>> -__diag_ignore(GCC, 8, "-Woverride-init",
>> +__diag_ignore_all("-Woverride-init",
>>  	      "logic to initialize all and then override some is OK");
>
> This is nice because it's more localized than the per-file
> disable. However, we tried to do this in i915, but this doesn't work for
> GCC versions < 8, and some defconfigs enabling -Werror forced us to
> revert. See commit 290d16104575 ("Revert "drm/i915: use localized
> __diag_ignore_all() instead of per file"").

It works now.

The original __diag_ignore_all() only did it for gcc-8 and above
because that was initially needed to suppress warnings that
got added in that version, but this was always a mistake.

689b097a06ba ("compiler-gcc: Suppress -Wmissing-prototypes
warning for all supported GCC") made it work correctly.

     Arnd


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
  2024-03-26 16:04   ` Hamza Mahfooz
  2024-03-26 20:24   ` Jani Nikula
@ 2024-03-26 23:02   ` Andrew Jeffery
  2024-03-28  9:18   ` Linus Walleij
  3 siblings, 0 replies; 10+ messages in thread
From: Andrew Jeffery @ 2024-03-26 23:02 UTC (permalink / raw
  To: Arnd Bergmann, linux-kbuild, Masahiro Yamada, Harry Wentland,
	Alex Deucher, Christian König, Jani Nikula, Lucas De Marchi,
	Oded Gabbay, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Linus Walleij, Joel Stanley,
	Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor
  Cc: Nicolas Schier, Arnd Bergmann, dri-devel, linux-kernel, netdev,
	linux-mm, llvm

On Tue, 2024-03-26 at 15:47 +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The -Woverride-init warn about code that may be intentional or not,
> but the inintentional ones tend to be real bugs, so there is a bit of
> disagreement on whether this warning option should be enabled by default
> and we have multiple settings in scripts/Makefile.extrawarn as well as
> individual subsystems.
> 
> Older versions of clang only supported -Wno-initializer-overrides with
> the same meaning as gcc's -Woverride-init, though all supported versions
> now work with both. Because of this difference, an earlier cleanup of
> mine accidentally turned the clang warning off for W=1 builds and only
> left it on for W=2, while it's still enabled for gcc with W=1.
> 
> There is also one driver that only turns the warning off for newer
> versions of gcc but not other compilers, and some but not all the
> Makefiles still use a cc-disable-warning conditional that is no
> longer needed with supported compilers here.
> 
> Address all of the above by removing the special cases for clang
> and always turning the warning off unconditionally where it got
> in the way, using the syntax that is supported by both compilers.
> 
> Fixes: 2cd3271b7a31 ("kbuild: avoid duplicate warning options")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/gpu/drm/amd/display/dc/dce110/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce112/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce120/Makefile |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce60/Makefile  |  2 +-
>  drivers/gpu/drm/amd/display/dc/dce80/Makefile  |  2 +-
>  drivers/gpu/drm/i915/Makefile                  |  6 +++---
>  drivers/gpu/drm/xe/Makefile                    |  4 ++--
>  drivers/net/ethernet/renesas/sh_eth.c          |  2 +-
>  drivers/pinctrl/aspeed/Makefile                |  2 +-

For the Aspeed change:

Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au>

Thanks!


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 20:55     ` Arnd Bergmann
@ 2024-03-27  7:50       ` Jani Nikula
  2024-03-27  9:22         ` Arnd Bergmann
  0 siblings, 1 reply; 10+ messages in thread
From: Jani Nikula @ 2024-03-27  7:50 UTC (permalink / raw
  To: Arnd Bergmann, Arnd Bergmann, linux-kbuild, Masahiro Yamada,
	Harry Wentland, Alex Deucher, Christian König,
	Lucas De Marchi, Oded Gabbay, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Jakub Kicinski, Paolo Abeni, Andrew Jeffery,
	Linus Walleij, Joel Stanley, Alexei Starovoitov, Daniel Borkmann,
	Andrew Morton, Nathan Chancellor
  Cc: Nicolas Schier, dri-devel, linux-kernel, Netdev, linux-mm, llvm

On Tue, 26 Mar 2024, "Arnd Bergmann" <arnd@arndb.de> wrote:
> On Tue, Mar 26, 2024, at 21:24, Jani Nikula wrote:
>> On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>> index 475e1e8c1d35..0786eb0da391 100644
>>> --- a/drivers/net/ethernet/renesas/sh_eth.c
>>> +++ b/drivers/net/ethernet/renesas/sh_eth.c
>>> @@ -50,7 +50,7 @@
>>>   * the macros available to do this only define GCC 8.
>>>   */
>>>  __diag_push();
>>> -__diag_ignore(GCC, 8, "-Woverride-init",
>>> +__diag_ignore_all("-Woverride-init",
>>>  	      "logic to initialize all and then override some is OK");
>>
>> This is nice because it's more localized than the per-file
>> disable. However, we tried to do this in i915, but this doesn't work for
>> GCC versions < 8, and some defconfigs enabling -Werror forced us to
>> revert. See commit 290d16104575 ("Revert "drm/i915: use localized
>> __diag_ignore_all() instead of per file"").
>
> It works now.
>
> The original __diag_ignore_all() only did it for gcc-8 and above
> because that was initially needed to suppress warnings that
> got added in that version, but this was always a mistake.
>
> 689b097a06ba ("compiler-gcc: Suppress -Wmissing-prototypes
> warning for all supported GCC") made it work correctly.

Oh, nice! Then I think we'd like to go back to __diag_ignore_all() in
i915 and xe.

The diff is below. I'm fine with you squashing it to your patch, or if
you want me to turn it into a proper patch for you to pick up in your
series, that's fine too. Just let me know.

BR,
Jani.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>


diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 3ef6ed41e62b..87d6ba8d2341 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -32,11 +32,6 @@ endif
 # Enable -Werror in CI and development
 subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
 
-# Fine grained warnings disable
-CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init)
-CFLAGS_display/intel_display_device.o = $(call cc-disable-warning, override-init)
-CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
-
 # Support compiling the display code separately for both i915 and xe
 # drivers. Define I915 when building i915.
 subdir-ccflags-y += -DI915
diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c
index c02d79b50006..b8903bd0e82a 100644
--- a/drivers/gpu/drm/i915/display/intel_display_device.c
+++ b/drivers/gpu/drm/i915/display/intel_display_device.c
@@ -17,6 +17,9 @@
 #include "intel_display_reg_defs.h"
 #include "intel_fbc.h"
 
+__diag_push();
+__diag_ignore_all("-Woverride-init", "Allow field initialization overrides for display info");
+
 static const struct intel_display_device_info no_display = {};
 
 #define PIPE_A_OFFSET		0x70000
@@ -768,6 +771,8 @@ static const struct intel_display_device_info xe2_lpd_display = {
 		BIT(INTEL_FBC_C) | BIT(INTEL_FBC_D),
 };
 
+__diag_pop();
+
 /*
  * Separate detection for no display cases to keep the display id array simple.
  *
diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 99894a855ef0..43855c6c3509 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -135,6 +135,9 @@ static int intel_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma)
 	return i915_gem_fb_mmap(obj, vma);
 }
 
+__diag_push();
+__diag_ignore_all("-Woverride-init", "Allow field initialization overrides for fb ops");
+
 static const struct fb_ops intelfb_ops = {
 	.owner = THIS_MODULE,
 	__FB_DEFAULT_DEFERRED_OPS_RDWR(intel_fbdev),
@@ -146,6 +149,8 @@ static const struct fb_ops intelfb_ops = {
 	.fb_mmap = intel_fbdev_mmap,
 };
 
+__diag_pop();
+
 static int intelfb_create(struct drm_fb_helper *helper,
 			  struct drm_fb_helper_surface_size *sizes)
 {
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 1e69783ae4fd..405ca17a990b 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -38,6 +38,9 @@
 #include "i915_reg.h"
 #include "intel_pci_config.h"
 
+__diag_push();
+__diag_ignore_all("-Woverride-init", "Allow field initialization overrides for device info");
+
 #define PLATFORM(x) .platform = (x)
 #define GEN(x) \
 	.__runtime.graphics.ip.ver = (x), \
@@ -785,6 +788,8 @@ static const struct intel_device_info mtl_info = {
 
 #undef PLATFORM
 
+__diag_pop();
+
 /*
  * Make sure any device matches here are from most specific to most
  * general.  For example, since the Quanta match is based on the subsystem
diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index 3c3e67885559..2f58faf0a79a 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -172,9 +172,6 @@ subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += \
 	-Ddrm_i915_gem_object=xe_bo \
 	-Ddrm_i915_private=xe_device
 
-CFLAGS_i915-display/intel_fbdev.o = $(call cc-disable-warning, override-init)
-CFLAGS_i915-display/intel_display_device.o = $(call cc-disable-warning, override-init)
-
 # Rule to build SOC code shared with i915
 $(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE
 	$(call cmd,force_checksrc)

-- 
Jani Nikula, Intel


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-27  7:50       ` Jani Nikula
@ 2024-03-27  9:22         ` Arnd Bergmann
  2024-03-31  2:33           ` Masahiro Yamada
  0 siblings, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2024-03-27  9:22 UTC (permalink / raw
  To: Jani Nikula, Arnd Bergmann, linux-kbuild, Masahiro Yamada,
	Harry Wentland, Alex Deucher, Christian König,
	Lucas De Marchi, Oded Gabbay, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Jakub Kicinski, Paolo Abeni, Andrew Jeffery,
	Linus Walleij, Joel Stanley, Alexei Starovoitov, Daniel Borkmann,
	Andrew Morton, Nathan Chancellor
  Cc: Nicolas Schier, dri-devel, linux-kernel, Netdev, linux-mm, llvm

On Wed, Mar 27, 2024, at 08:50, Jani Nikula wrote:
> On Tue, 26 Mar 2024, "Arnd Bergmann" <arnd@arndb.de> wrote:
>> On Tue, Mar 26, 2024, at 21:24, Jani Nikula wrote:
>>> On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
>>
>> It works now.
>>
>> The original __diag_ignore_all() only did it for gcc-8 and above
>> because that was initially needed to suppress warnings that
>> got added in that version, but this was always a mistake.
>>
>> 689b097a06ba ("compiler-gcc: Suppress -Wmissing-prototypes
>> warning for all supported GCC") made it work correctly.
>
> Oh, nice! Then I think we'd like to go back to __diag_ignore_all() in
> i915 and xe.
>
> The diff is below. I'm fine with you squashing it to your patch, or if
> you want me to turn it into a proper patch for you to pick up in your
> series, that's fine too. Just let me know.

I think I'd prefer to keep my patch simpler for the moment and
get that merged through the kbuild tree, it already touches
too many places at once.

It may be better for me to just drop the drivers/gpu/ part of
my patch so you can just just take your patch through the
drm tree. I actually have a similar patch for the amdgpu driver
that I can send if you like this option better.

    Arnd


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
                     ` (2 preceding siblings ...)
  2024-03-26 23:02   ` Andrew Jeffery
@ 2024-03-28  9:18   ` Linus Walleij
  3 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2024-03-28  9:18 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: linux-kbuild, Masahiro Yamada, Harry Wentland, Alex Deucher,
	Christian König, Jani Nikula, Lucas De Marchi, Oded Gabbay,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Andrew Jeffery, Joel Stanley,
	Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor, Nicolas Schier, Arnd Bergmann, dri-devel,
	linux-kernel, netdev, linux-mm, llvm

On Tue, Mar 26, 2024 at 3:49 PM Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
>
> The -Woverride-init warn about code that may be intentional or not,
> but the inintentional ones tend to be real bugs, so there is a bit of
> disagreement on whether this warning option should be enabled by default
> and we have multiple settings in scripts/Makefile.extrawarn as well as
> individual subsystems.
>
> Older versions of clang only supported -Wno-initializer-overrides with
> the same meaning as gcc's -Woverride-init, though all supported versions
> now work with both. Because of this difference, an earlier cleanup of
> mine accidentally turned the clang warning off for W=1 builds and only
> left it on for W=2, while it's still enabled for gcc with W=1.
>
> There is also one driver that only turns the warning off for newer
> versions of gcc but not other compilers, and some but not all the
> Makefiles still use a cc-disable-warning conditional that is no
> longer needed with supported compilers here.
>
> Address all of the above by removing the special cases for clang
> and always turning the warning off unconditionally where it got
> in the way, using the syntax that is supported by both compilers.
>
> Fixes: 2cd3271b7a31 ("kbuild: avoid duplicate warning options")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Neat!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent
  2024-03-27  9:22         ` Arnd Bergmann
@ 2024-03-31  2:33           ` Masahiro Yamada
  0 siblings, 0 replies; 10+ messages in thread
From: Masahiro Yamada @ 2024-03-31  2:33 UTC (permalink / raw
  To: Arnd Bergmann
  Cc: Jani Nikula, Arnd Bergmann, linux-kbuild, Harry Wentland,
	Alex Deucher, Christian König, Lucas De Marchi, Oded Gabbay,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	Jakub Kicinski, Paolo Abeni, Andrew Jeffery, Linus Walleij,
	Joel Stanley, Alexei Starovoitov, Daniel Borkmann, Andrew Morton,
	Nathan Chancellor, Nicolas Schier, dri-devel, linux-kernel,
	Netdev, linux-mm, llvm

On Wed, Mar 27, 2024 at 6:23 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Wed, Mar 27, 2024, at 08:50, Jani Nikula wrote:
> > On Tue, 26 Mar 2024, "Arnd Bergmann" <arnd@arndb.de> wrote:
> >> On Tue, Mar 26, 2024, at 21:24, Jani Nikula wrote:
> >>> On Tue, 26 Mar 2024, Arnd Bergmann <arnd@kernel.org> wrote:
> >>
> >> It works now.
> >>
> >> The original __diag_ignore_all() only did it for gcc-8 and above
> >> because that was initially needed to suppress warnings that
> >> got added in that version, but this was always a mistake.
> >>
> >> 689b097a06ba ("compiler-gcc: Suppress -Wmissing-prototypes
> >> warning for all supported GCC") made it work correctly.
> >
> > Oh, nice! Then I think we'd like to go back to __diag_ignore_all() in
> > i915 and xe.
> >
> > The diff is below. I'm fine with you squashing it to your patch, or if
> > you want me to turn it into a proper patch for you to pick up in your
> > series, that's fine too. Just let me know.
>
> I think I'd prefer to keep my patch simpler for the moment and
> get that merged through the kbuild tree, it already touches
> too many places at once.
>
> It may be better for me to just drop the drivers/gpu/ part of
> my patch so you can just just take your patch through the
> drm tree. I actually have a similar patch for the amdgpu driver
> that I can send if you like this option better.
>
>     Arnd
>



Applied to linux-kbuild/fixes.
Thanks.

-- 
Best Regards
Masahiro Yamada


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-03-31  2:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-26 14:47 [PATCH 00/12] kbuild: enable some -Wextra warnings by default Arnd Bergmann
2024-03-26 14:47 ` [PATCH 01/12] kbuild: make -Woverride-init warnings more consistent Arnd Bergmann
2024-03-26 16:04   ` Hamza Mahfooz
2024-03-26 20:24   ` Jani Nikula
2024-03-26 20:55     ` Arnd Bergmann
2024-03-27  7:50       ` Jani Nikula
2024-03-27  9:22         ` Arnd Bergmann
2024-03-31  2:33           ` Masahiro Yamada
2024-03-26 23:02   ` Andrew Jeffery
2024-03-28  9:18   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).