Skip to contentSkip to conversation

__diag_ignore_all(), GCC < 8, extra warnings, and -Werror

DISCUSSION Jani Nikula 1 participant 1 message Jul 5, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

For a long time now, i915 has enabled a bunch of W=1 style warnings locally, and we try hard to keep i915 warning free.

One of the warnings is -Woverride-init from -Wextra. We need to bypass that in a few cases, and used to do this for the relevant files:

	CFLAGS_file.o = $(call cc-disable-warning, override-init)

Recently, we switched from the above to a more localized version in each file.c:

	__diag_push();
	__diag_ignore_all("-Woverride-init", "Allow overriding inherited members");
	...
        __diag_pop();

We now got a report that this fails the build with CONFIG_WERROR=y or W=e when using GCC version < 8. Indeed, __diag_ignore_all() requires GCC version 8 or later.

Should we now revert back to disabling -Woverride-init on a file granularity? Should we consider breaking the build for CONFIG_WERROR=y or W=e on older compilers a regression?

I'll note that with the current usage of __diag_ignore_all() elsewhere in kernel, CONFIG_WERROR=y or W=e with W=1 will never pass on older compilers. But then again, it has never passed on any compiler, so it can't be a regression.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center