[PATCH 6/6] drm: Add CONFIG_DRM_WERROR

Hamza Mahfooz hamza.mahfooz at amd.com
Wed Jan 10 20:17:40 UTC 2024


On 1/10/24 12:39, Jani Nikula wrote:
> Add kconfig to enable -Werror subsystem wide. This is useful for
> development and CI to keep the subsystem warning free, while avoiding
> issues outside of the subsystem that kernel wide CONFIG_WERROR=y might
> hit.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>

Reviewed-by: Hamza Mahfooz <hamza.mahfooz at amd.com>

> ---
>   drivers/gpu/drm/Kconfig  | 18 ++++++++++++++++++
>   drivers/gpu/drm/Makefile |  3 +++
>   2 files changed, 21 insertions(+)
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 6ec33d36f3a4..36a00cba2540 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -414,3 +414,21 @@ config DRM_LIB_RANDOM
>   config DRM_PRIVACY_SCREEN
>   	bool
>   	default n
> +
> +config DRM_WERROR
> +	bool "Compile the drm subsystem with warnings as errors"
> +	# As this may inadvertently break the build, only allow the user
> +	# to shoot oneself in the foot iff they aim really hard
> +	depends on EXPERT
> +	# We use the dependency on !COMPILE_TEST to not be enabled in
> +	# allmodconfig or allyesconfig configurations
> +	depends on !COMPILE_TEST
> +	default n
> +	help
> +	  A kernel build should not cause any compiler warnings, and this
> +	  enables the '-Werror' flag to enforce that rule in the drm subsystem.
> +
> +	  The drm subsystem enables more warnings than the kernel default, so
> +	  this config option is disabled by default.
> +
> +	  If in doubt, say N.
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 8b6be830f7c3..b7fd3e58b7af 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -32,6 +32,9 @@ subdir-ccflags-y += -Wno-sign-compare
>   endif
>   # --- end copy-paste
>   
> +# Enable -Werror in CI and development
> +subdir-ccflags-$(CONFIG_DRM_WERROR) += -Werror
> +
>   drm-y := \
>   	drm_aperture.o \
>   	drm_atomic.o \
-- 
Hamza



More information about the Intel-gfx mailing list