clang: enable colored diagnostic output for kernel compilation

When building kernels with KERNEL_COMPILER=clang, compiler warnings
were displayed without color despite -fdiagnostics-color=always being
set in KCFLAGS. This GCC-native flag is not reliably honored by clang
when invoked through ccache and the kernel build system with LLVM=1.

Add -fcolor-diagnostics (clang's native flag) to the clang-specific
extra_warnings to ensure colored warning output.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Igor Velkov 2026-01-28 23:49:56 +02:00 committed by Igor
parent 2c4b43bf73
commit b7bc3a770d

View File

@ -44,7 +44,7 @@ function run_kernel_make_internal() {
# Do NOT add -Wno-error=unknown-warning-option here - it breaks cc-option detection
# in kernel Makefiles (btrfs, drm, coresight) causing GCC-specific flags to be
# incorrectly added when building with clang
extra_warnings="-Wno-error=unused-command-line-argument"
extra_warnings="-fcolor-diagnostics -Wno-error=unused-command-line-argument"
else
cc_name="CROSS_COMPILE"
extra_warnings=""