From: Antony Pavlov <antonynpavlov@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Trent Piepho <trent.piepho@igorinstitute.com>,
Oleksij Rempel <o.rempel@pengutronix.de>,
Ahmad Fatoum <a.fatoum@pengutronix.de>,
Barebox List <barebox@lists.infradead.org>
Subject: Re: Makefile.lib: cmd_dtc: warning: missing whitespace after the macro name
Date: Mon, 12 Sep 2022 12:07:34 +0300 [thread overview]
Message-ID: <20220912120734.3fa82231ca6d16ba604ee262@gmail.com> (raw)
In-Reply-To: <20220912080152.GE24324@pengutronix.de>
On Mon, 12 Sep 2022 10:01:52 +0200
Sascha Hauer <s.hauer@pengutronix.de> wrote:
Hi Sascha!
> On Wed, Sep 07, 2022 at 11:21:18AM +0300, Antony Pavlov wrote:
> > Hi Everyone!
> >
> > During MIPS ath79_defconfig build I have a 'missing whitespace after the macro name' warning:
> >
> > AS [P] arch/mips/dts/ar9331_tl_mr3020.dtb.pbl.o
> > DTC arch/mips/dts/ar9344-tl-wdr4300-v1.7.dtb
> > <stdin>:1:9: warning: missing whitespace after the macro name
> > XZKERN arch/mips/dts/ar9344-tl-wdr4300-v1.7.dtb.z
> >
> > E.g. see https://gitlab.com/frantony/barebox/-/jobs/2969826747#L47
> >
> > The reason is the scripts/Makefile.lib generates a C macro with the point symbol in the macro name because the arch/mips/dts/ar9344-tl-wdr4300-v1.7.dts file name contains the point symbol before '.dts', as a result we have:
> >
> > #define ar9344_tl_wdr4300_v1.7_dts 1
> >
> > e.g.
> >
> > barebox$ grep -RHn -o "define ar9344_tl_wdr4300_v1.* 1" . 2>/dev/null
> > ./arch/mips/dts/.ar9344-tl-wdr4300-v1.7.dtb.cmd:1:define ar9344_tl_wdr4300_v1.7_dts 1
> >
> > cmd_dtc in scripts/Makefile.lib substitutes the '-' symbols with the '_' symbols but do nothing with other unwanted C preprocessor macro name symbols.
> >
> > It looks like the linux kernel has no problems with extra point symbols in dts file names, there are several files with extra dot in dts:
> >
> > barebox$ find dts/ -iname '*.*.dts' | wc -l
> > 33
> >
> > So we have to fix Makefile.lib.
> >
> > This simple patch fixes the warning problem:
> >
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index 16308497b84..2f79656c1e9 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -363,7 +363,7 @@ $(obj)/%.dtb.z: $(obj)/%.dtb FORCE
> > dts-frags = $(subst $(quote),,$(CONFIG_EXTERNAL_DTS_FRAGMENTS))
> > quiet_cmd_dtc = DTC $@
> > # For compatibility between make 4.2 and 4.3
> > -cmd_dtc = /usr/bin/env echo -e '$(pound)define $(subst -,_,$(*F))_dts 1\n'$(foreach f,$< $(dts-frags),'$(pound)include "$(f)"\n') | \
> > +cmd_dtc = /usr/bin/env echo -e '$(pound)define $(subst -,_,$(subst .,_,$(*F)))_dts 1\n'$(foreach f,$< $(dts-frags),'$(pound)include "$(f)"\n') | \
> > $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) - ; \
> > $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \
> > -i $(srctree)/arch/$(SRCARCH)/dts $(DTC_FLAGS) \
> >
> > I suppose that this simple patch may lead to some undesirable side effects.
>
> One side effect is that this gets even less readable.
Yes, you are right :)
> Another one would be that two dts filenames which only differ in the
> usage of '.' and '_' would result in the same define, but I think that
> case is negligible as this define is unused in barebox itself. It could
^^^^^^^^^^^^^^^^^^^^^^^^
> be used by external dts fragments passed in via CONFIG_EXTERNAL_DTS_FRAGMENTS.
>
> Other than that, what side effects are you afraid of?
I have an idea that someone relies on these *_dts macros.
Now I see (as you have noted above) that there is no macro users in mainline source tree:
$ git grep -w .*_dts
common/Kconfig: #ifdef foo_board_dts
scripts/Makefile.lib:cmd_dtc = /usr/bin/env echo -e '$(pound)define $(subst -,_,$(*F))_dts 1\n'$(foreach f,$< $(dts-frags),'$(pound)include "$(f)"\n') | \
--
Best regards,
Antony Pavlov
next prev parent reply other threads:[~2022-09-12 9:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-07 8:21 Antony Pavlov
2022-09-12 8:01 ` Sascha Hauer
2022-09-12 9:07 ` Antony Pavlov [this message]
2022-09-19 9:14 ` Sascha Hauer
2022-09-22 16:24 ` Antony Pavlov
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=20220912120734.3fa82231ca6d16ba604ee262@gmail.com \
--to=antonynpavlov@gmail.com \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=o.rempel@pengutronix.de \
--cc=s.hauer@pengutronix.de \
--cc=trent.piepho@igorinstitute.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