Re: [PATCH 1/2] Makefile: Strip leading spaces when preprocessing generated_defconfig

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Apr 27 17:19:04 CEST 2025


Am 27. April 2025 16:50:10 MESZ schrieb Yao Zi <ziyao at disroot.org>:
>Clang's preprocessor may emit extra spaces for lines starting with '#'.
>Lines with these extra characters cannot be handled by Kconfig and will
>be ignored with warnings like,
>


Do you have an example for reprocing the issue?
Is there an understanding why Clang behaves in this way?

Best regards 

Heinrich 

>        unexpected data:  # CONFIG_OF_BOARD_FIXUP is not set
>
>Those options that is expected to be assigned explicitly with N will be
>set to the default value, messing up board configurations.
>
>Let's sed these spaces away to ensure board configurations could be
>correctly generated with Clang.
>
>Fixes: 2027e99e61a ("Makefile: Run defconfig files through the C preprocessor")
>Reported-by: Nathaniel Hourt <I at nathaniel.land>
>Signed-off-by: Yao Zi <ziyao at disroot.org>
>---
> scripts/kconfig/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
>index 079add4d5da..ba30652f01a 100644
>--- a/scripts/kconfig/Makefile
>+++ b/scripts/kconfig/Makefile
>@@ -94,6 +94,7 @@ endif
> 
> %_defconfig: $(obj)/conf
> 	$(Q)$(CPP) -nostdinc -P -I $(srctree) -undef -x assembler-with-cpp $(srctree)/arch/$(SRCARCH)/configs/$@ -o generated_defconfig
>+	$(Q)sed -i -e 's/^[[:space:]]//' generated_defconfig
> 	$(Q)$< $(silent) --defconfig=generated_defconfig $(Kconfig)
> 
> # Added for U-Boot (backward compatibility)



More information about the U-Boot mailing list