Skip to contentSkip to conversation

build: add -Wno-override-init

PATCH In review Paolo Bonzini 2 participants 3 messages May 20

Subsystems (2)
lore
Share & tools
lore

Paolo Bonzini

author maintainer
#0 lore raw

PATCH 1/1 build: add -Wno-override-init

The -Woverride-init flag (also known as -Winitializer-overrides in clang, but it supports both spellings) warns about code that may be intentional or not. While the unintentional ones tend to be real bugs, overall the idea of overriding function pointers is more useful than the warning.

Cc f4c5838c ("svm: add basic GMET tests", 2026-05-12)
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)
Makefile +2 -0
index 403fd495..42ef5826 100644
@@ -76,6 +76,7 @@ wclobbered := $(call cc-option, -Wclobbered, "")
 wunused_but_set_parameter := $(call cc-option, -Wunused-but-set-parameter, "")
 wmissing_parameter_type := $(call cc-option, -Wmissing-parameter-type, "")
 wold_style_declaration := $(call cc-option, -Wold-style-declaration, "")
+wno_override_init := $(call cc-option, -Wno-override-init, "")
 
 COMMON_CFLAGS += $(fomit_frame_pointer)
 COMMON_CFLAGS += $(fno_stack_protector)
@@ -89,6 +90,7 @@ COMMON_CFLAGS += $(fno_pic)
 endif
 COMMON_CFLAGS += $(wclobbered)
 COMMON_CFLAGS += $(wunused_but_set_parameter)
+COMMON_CFLAGS += $(wno_override_init)
 
 CFLAGS += $(COMMON_CFLAGS)
 CFLAGS += $(wmissing_parameter_type)
Signature · 1 line
2.54.0
Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines · Paolo Bonzini

The -Woverride-init flag (also known as -Winitializer-overrides in clang, but it supports both spellings) warns about code that may be intentional or not. While the unintentional ones tend to be real bugs, overall the idea of overriding function pointers is more useful than the warning.

Cc f4c5838c ("svm: add basic GMET tests", 2026-05-12)

That should be "Fixes:" instead of "Cc:"

Quoted 1 line

And that "Reported-by" instead of "Reviewed-by".

Anyway, with these nits fixed:

Thanks!

Quoted 25 lines
---
  Makefile | 2 ++
  1 file changed, 2 insertions(+)
Makefile +2 -0
index 403fd495..42ef5826 100644
@@ -76,6 +76,7 @@ wclobbered := $(call cc-option, -Wclobbered, "")
  wunused_but_set_parameter := $(call cc-option, -Wunused-but-set-parameter, "")
  wmissing_parameter_type := $(call cc-option, -Wmissing-parameter-type, "")
  wold_style_declaration := $(call cc-option, -Wold-style-declaration, "")
+wno_override_init := $(call cc-option, -Wno-override-init, "")
 
  COMMON_CFLAGS += $(fomit_frame_pointer)
  COMMON_CFLAGS += $(fno_stack_protector)
@@ -89,6 +90,7 @@ COMMON_CFLAGS += $(fno_pic)
  endif
  COMMON_CFLAGS += $(wclobbered)
  COMMON_CFLAGS += $(wunused_but_set_parameter)
+COMMON_CFLAGS += $(wno_override_init)
 
  CFLAGS += $(COMMON_CFLAGS)
  CFLAGS += $(wmissing_parameter_type)
#2 lore raw
Quoted 10 lines · Thomas Huth
Quoted 6 lines · Paolo Bonzini

The -Woverride-init flag (also known as -Winitializer-overrides in clang, but it supports both spellings) warns about code that may be intentional or not.  While the unintentional ones tend to be real bugs, overall the idea of overriding function pointers is more useful than the warning.

Cc f4c5838c ("svm: add basic GMET tests", 2026-05-12)

That should be "Fixes:" instead of "Cc:"

Quoted 8 lines
Quoted 1 line

And that "Reported-by" instead of "Reviewed-by".

Anyway, with these nits fixed:

 Thanks!

I've pushed it to the repo, and together with the other fixes, the CI is finally green again:

https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/pipelines/2539893859

Thomas