From: Yao Zi <ziyao@disroot.org>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>,
Rick Chen <rick@andestech.com>, Leo <ycliang@andestech.com>,
Tom Rini <trini@konsulko.com>,
Mayuresh Chitale <mchitale@ventanamicro.com>,
Anton Blanchard <antonb@tenstorrent.com>,
Simon Glass <sjg@chromium.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Jerome Forissier <jerome.forissier@linaro.org>,
Evgeny Bachinin <EABachinin@salutedevices.com>,
Christian Marangi <ansuelsmth@gmail.com>,
Andrew Davis <afd@ti.com>, Nishanth Menon <nm@ti.com>
Cc: u-boot@lists.denx.de, Nathaniel Hourt <I@nathaniel.land>
Subject: Re: [PATCH 1/2] Makefile: Strip leading spaces when preprocessing generated_defconfig
Date: Sun, 27 Apr 2025 15:46:56 +0000 [thread overview]
Message-ID: <aA5RcIbI7uhsGmu8@pie.lan> (raw)
In-Reply-To: <1526A781-5592-43DE-94F2-221DAA484192@gmx.de>
On Sun, Apr 27, 2025 at 05:19:04PM +0200, Heinrich Schuchardt wrote:
> Am 27. April 2025 16:50:10 MESZ schrieb Yao Zi <ziyao@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?
Sure,
clang-19 -E -nostdinc -P -I . -undef -x assembler-with-cpp \
configs/starfive_visionfive2_defconfig
or a smaller example for demonstrating the behaviour,
cat << EOF | clang -E -P -x assembler-with-cpp -
# comment line
normal line
EOF
and you could see the strange indentation. For reproducing the exact
Kconfig warnings,
make ARCH=riscv \
CC='clang-19 --target=riscv64-unknown-linux-musl' \
starfive_visionfive2_defconfig
(Clang is called clang-19 on my machine)
> Is there an understanding why Clang behaves in this way?
Sadly I have no idea. I guess it may serve for improving
human-readability of the preprocessed output.
This piece of Makefile (processing defconfigs with C preprocessor) is
U-Boot specific and doesn't exist in Linux kernel, thus it's unlikely
to have someone noted the bahaviour difference of preprocessors before.
Honestly saying sedding the output isn't a clean solution, but I cannot
come up with a better way. It'll be nice to have a flag to control the
format of output, but I didn't find one.
Am looking forward to further suggestions and documentation on this.
> Best regards
>
> Heinrich
Thanks,
Yao Zi
> > 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@nathaniel.land>
> >Signed-off-by: Yao Zi <ziyao@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)
>
next prev parent reply other threads:[~2025-04-27 15:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-27 14:50 [PATCH 0/2] Clang compatibility improvements for RISC-V Yao Zi
2025-04-27 14:50 ` [PATCH 1/2] Makefile: Strip leading spaces when preprocessing generated_defconfig Yao Zi
2025-04-27 15:19 ` Heinrich Schuchardt
2025-04-27 15:46 ` Yao Zi [this message]
2025-04-27 16:16 ` Tom Rini
2025-04-28 3:57 ` Yao Zi
2025-04-28 14:49 ` Tom Rini
2025-04-29 12:31 ` Yao Zi
2025-04-29 19:14 ` Tom Rini
2025-04-27 14:50 ` [PATCH 2/2] riscv: Access gd with inline assembly when building with LTO or Clang Yao Zi
2025-05-12 9:36 ` Leo Liang
2025-05-05 23:35 ` (subset) [PATCH 0/2] Clang compatibility improvements for RISC-V Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aA5RcIbI7uhsGmu8@pie.lan \
--to=ziyao@disroot.org \
--cc=EABachinin@salutedevices.com \
--cc=I@nathaniel.land \
--cc=afd@ti.com \
--cc=ansuelsmth@gmail.com \
--cc=antonb@tenstorrent.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jerome.forissier@linaro.org \
--cc=mchitale@ventanamicro.com \
--cc=nm@ti.com \
--cc=rick@andestech.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
--cc=ycliang@andestech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox