Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: make -Woverride-init warnings more consistent

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>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

authored by

Arnd Bergmann and committed by
Masahiro Yamada
c40845e3 1102f9f8

+18 -23
+1 -1
drivers/gpu/drm/amd/display/dc/dce110/Makefile
··· 23 23 # Makefile for the 'controller' sub-component of DAL. 24 24 # It provides the control and status of HW CRTC block. 25 25 26 - CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = $(call cc-disable-warning, override-init) 26 + CFLAGS_$(AMDDALPATH)/dc/dce110/dce110_resource.o = -Wno-override-init 27 27 28 28 DCE110 = dce110_timing_generator.o \ 29 29 dce110_compressor.o dce110_opp_regamma_v.o \
+1 -1
drivers/gpu/drm/amd/display/dc/dce112/Makefile
··· 23 23 # Makefile for the 'controller' sub-component of DAL. 24 24 # It provides the control and status of HW CRTC block. 25 25 26 - CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = $(call cc-disable-warning, override-init) 26 + CFLAGS_$(AMDDALPATH)/dc/dce112/dce112_resource.o = -Wno-override-init 27 27 28 28 DCE112 = dce112_compressor.o 29 29
+1 -1
drivers/gpu/drm/amd/display/dc/dce120/Makefile
··· 24 24 # It provides the control and status of HW CRTC block. 25 25 26 26 27 - CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = $(call cc-disable-warning, override-init) 27 + CFLAGS_$(AMDDALPATH)/dc/dce120/dce120_resource.o = -Wno-override-init 28 28 29 29 DCE120 = dce120_timing_generator.o 30 30
+1 -1
drivers/gpu/drm/amd/display/dc/dce60/Makefile
··· 23 23 # Makefile for the 'controller' sub-component of DAL. 24 24 # It provides the control and status of HW CRTC block. 25 25 26 - CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = $(call cc-disable-warning, override-init) 26 + CFLAGS_$(AMDDALPATH)/dc/dce60/dce60_resource.o = -Wno-override-init 27 27 28 28 DCE60 = dce60_timing_generator.o dce60_hw_sequencer.o \ 29 29 dce60_resource.o
+1 -1
drivers/gpu/drm/amd/display/dc/dce80/Makefile
··· 23 23 # Makefile for the 'controller' sub-component of DAL. 24 24 # It provides the control and status of HW CRTC block. 25 25 26 - CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = $(call cc-disable-warning, override-init) 26 + CFLAGS_$(AMDDALPATH)/dc/dce80/dce80_resource.o = -Wno-override-init 27 27 28 28 DCE80 = dce80_timing_generator.o 29 29
+3 -3
drivers/gpu/drm/i915/Makefile
··· 33 33 subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror 34 34 35 35 # Fine grained warnings disable 36 - CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init) 37 - CFLAGS_display/intel_display_device.o = $(call cc-disable-warning, override-init) 38 - CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init) 36 + CFLAGS_i915_pci.o = -Wno-override-init 37 + CFLAGS_display/intel_display_device.o = -Wno-override-init 38 + CFLAGS_display/intel_fbdev.o = -Wno-override-init 39 39 40 40 # Support compiling the display code separately for both i915 and xe 41 41 # drivers. Define I915 when building i915.
+2 -2
drivers/gpu/drm/xe/Makefile
··· 172 172 -Ddrm_i915_gem_object=xe_bo \ 173 173 -Ddrm_i915_private=xe_device 174 174 175 - CFLAGS_i915-display/intel_fbdev.o = $(call cc-disable-warning, override-init) 176 - CFLAGS_i915-display/intel_display_device.o = $(call cc-disable-warning, override-init) 175 + CFLAGS_i915-display/intel_fbdev.o = -Wno-override-init 176 + CFLAGS_i915-display/intel_display_device.o = -Wno-override-init 177 177 178 178 # Rule to build SOC code shared with i915 179 179 $(obj)/i915-soc/%.o: $(srctree)/drivers/gpu/drm/i915/soc/%.c FORCE
+1 -1
drivers/net/ethernet/renesas/sh_eth.c
··· 50 50 * the macros available to do this only define GCC 8. 51 51 */ 52 52 __diag_push(); 53 - __diag_ignore(GCC, 8, "-Woverride-init", 53 + __diag_ignore_all("-Woverride-init", 54 54 "logic to initialize all and then override some is OK"); 55 55 static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = { 56 56 SH_ETH_OFFSET_DEFAULTS,
+1 -1
drivers/pinctrl/aspeed/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 # Aspeed pinctrl support 3 3 4 - ccflags-y += $(call cc-option,-Woverride-init) 4 + ccflags-y += -Woverride-init 5 5 obj-$(CONFIG_PINCTRL_ASPEED) += pinctrl-aspeed.o pinmux-aspeed.o 6 6 obj-$(CONFIG_PINCTRL_ASPEED_G4) += pinctrl-aspeed-g4.o 7 7 obj-$(CONFIG_PINCTRL_ASPEED_G5) += pinctrl-aspeed-g5.o
+1 -1
fs/proc/Makefile
··· 5 5 6 6 obj-y += proc.o 7 7 8 - CFLAGS_task_mmu.o += $(call cc-option,-Wno-override-init,) 8 + CFLAGS_task_mmu.o += -Wno-override-init 9 9 proc-y := nommu.o task_nommu.o 10 10 proc-$(CONFIG_MMU) := task_mmu.o 11 11
+1 -1
kernel/bpf/Makefile
··· 4 4 # ___bpf_prog_run() needs GCSE disabled on x86; see 3193c0836f203 for details 5 5 cflags-nogcse-$(CONFIG_X86)$(CONFIG_CC_IS_GCC) := -fno-gcse 6 6 endif 7 - CFLAGS_core.o += $(call cc-disable-warning, override-init) $(cflags-nogcse-yy) 7 + CFLAGS_core.o += -Wno-override-init $(cflags-nogcse-yy) 8 8 9 9 obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o inode.o helpers.o tnum.o log.o token.o 10 10 obj-$(CONFIG_BPF_SYSCALL) += bpf_iter.o map_iter.o task_iter.o prog_iter.o link_iter.o
+1 -2
mm/Makefile
··· 29 29 KCOV_INSTRUMENT_vmstat.o := n 30 30 KCOV_INSTRUMENT_failslab.o := n 31 31 32 - CFLAGS_init-mm.o += $(call cc-disable-warning, override-init) 33 - CFLAGS_init-mm.o += $(call cc-disable-warning, initializer-overrides) 32 + CFLAGS_init-mm.o += -Wno-override-init 34 33 35 34 mmu-y := nommu.o 36 35 mmu-$(CONFIG_MMU) := highmem.o memory.o mincore.o \
+3 -7
scripts/Makefile.extrawarn
··· 114 114 KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) 115 115 KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) 116 116 117 + KBUILD_CFLAGS += -Wno-override-init # alias for -Wno-initializer-overrides in clang 118 + 117 119 ifdef CONFIG_CC_IS_CLANG 118 120 # Clang before clang-16 would warn on default argument promotions. 119 121 ifneq ($(call clang-min-version, 160000),y) ··· 153 151 KBUILD_CFLAGS += $(call cc-option, -Wmaybe-uninitialized) 154 152 KBUILD_CFLAGS += $(call cc-option, -Wunused-macros) 155 153 156 - ifdef CONFIG_CC_IS_CLANG 157 - KBUILD_CFLAGS += -Winitializer-overrides 158 - endif 159 - 160 154 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN2 161 155 162 156 else ··· 162 164 KBUILD_CFLAGS += -Wno-type-limits 163 165 KBUILD_CFLAGS += -Wno-shift-negative-value 164 166 165 - ifdef CONFIG_CC_IS_CLANG 166 - KBUILD_CFLAGS += -Wno-initializer-overrides 167 - else 167 + ifdef CONFIG_CC_IS_GCC 168 168 KBUILD_CFLAGS += -Wno-maybe-uninitialized 169 169 endif 170 170