Re: [PATCH v2 16/20] coverage: add MC/DC measurement

From: Nathan Chancellor

Date: Thu Nov 12 2026 - 22:31:14 EST


> [ ... 63 lines skipped ... ]
> +config COVERAGE_MCDC
> + bool "Measure modified condition/decision coverage (MC/DC)"
> + depends on LLVM_COV_KERNEL
> + depends on CLANG_VERSION >= 220000 || !WERROR

I don't have a super strong opinion here but I think I would rather see
this just hard depend on Clang >= 22.1.0 rather than let these warnings
pollute the build without -Werror. Maybe something for the future if we
get too many reports.

> [ ... 49 lines skipped ... ]
> +ifdef CONFIG_COVERAGE_MCDC
> +CFLAGS_COVERAGE += -fcoverage-mcdc \
> + -Xclang -fmcdc-max-conditions=$(CONFIG_LLVM_COV_MCDC_MAX_CONDITIONS)
> +# Decisions that MC/DC leaves out are nothing to fix in the code. Disable the
> +# warnings here rather than in CFLAGS_COVERAGE, so that KCFLAGS=-Wpgo-coverage
> +# can list them. Clang only allows this since version 22.
> +KBUILD_CFLAGS += $(call cc-disable-warning, pgo-coverage)

Please make this:

KBUILD_CFLAGS += $(call cc-option,-Wno-pgo-coverage)

This might even want to be in scripts/Kconfig.toolchain as

config CC_OPT_WNO_PGO_COVERAGE
# clang-22: https://github.com/llvm/llvm-project/commit/80887c7de9d82c809555f52948af1a5d7484e28
# gcc: not supported
def_string "$(cc-option-str,-Wno-pgo-coverage)"

so that it will be easy to clean this up when we use clang-22 as a
minimum version.

--
Cheers,
Nathan