drm: Add CONFIG_DRM_WERROR
authorJani Nikula <jani.nikula@intel.com>
Tue, 5 Mar 2024 09:07:36 +0000 (11:07 +0200)
committerJani Nikula <jani.nikula@intel.com>
Tue, 5 Mar 2024 16:19:54 +0000 (18:19 +0200)
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.

v2: Don't depend on COMPILE_TEST

Reviewed-by: Hamza Mahfooz <hamza.mahfooz@amd.com> # v1
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/afe5ed943414f7ec3044c1547503b9941686a867.1709629403.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/Kconfig
drivers/gpu/drm/Makefile

index ad8227d888409ecf672c38077f8a103751c076fd..16029435b750a1285d71e16fd41aedea9f0577ac 100644 (file)
@@ -415,3 +415,16 @@ config DRM_LIB_RANDOM
 config DRM_PRIVACY_SCREEN
        bool
        default n
+
+config DRM_WERROR
+       bool "Compile the drm subsystem with warnings as errors"
+       depends on EXPERT
+       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.
index ea456f057e8a1c8713d2a1f18bbddc37cc2d2740..a73c04d2d7a39c4750d9334172367f39cf8fd8d8 100644 (file)
@@ -30,6 +30,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 \