Re: [PATCH] kbuild: fix duplicated flags in DEBUG_CFLAGS

Mark Wielaard
2021-02-03T10:38:07Z

Hi Masahiro,

On Wed, 2021-02-03 at 16:52 +0900, Masahiro Yamada wrote:
> With commit 121c5d08d53c ("kbuild: Only add -fno-var-tracking-
> assignments
> for old GCC versions") applied, DEBUG_CFLAGS is now reset only when
> CONFIG_CC_IS_GCC=y.
>
> Fix it to reset DEBUG_CFLAGS also when using Clang.
>
> [...]
> +DEBUG_CFLAGS :=
> +
> # Workaround for GCC versions < 5.0
> # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61801
> ifdef CONFIG_CC_IS_GCC
> -DEBUG_CFLAGS := $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> +DEBUG_CFLAGS += $(call cc-ifversion, -lt, 0500, $(call cc-option, -fno-var-tracking-assignments))
> endif

Yes, this makes sense given that the original code, before commit
121c5d08d53c did always set DEBUG_CFLAGS without checking for
CONFIG_CC_IS_GCC. So it behaved like the above code does.

Reviewed-by: Mark Wielaard <mark@klomp.org>

Thanks,

Mark