[PATCH] tools: Stop re-defining -std= when building tools

Tom Rini trini at konsulko.com
Mon Oct 11 14:44:09 CEST 2021


On Mon, Oct 11, 2021 at 11:21:49AM +0800, Bin Meng wrote:
> On Mon, Oct 11, 2021 at 3:23 AM Tom Rini <trini at konsulko.com> wrote:
> >
> > While we intentionally set -std=gnu11 for building host tools, and have
> > for quite some time, we never dropped -std=gnu99 from tools/Makefile.
> > This resulted in passing -std=gnu11 ... -std=gnu99 when building, and
> > gnu99 would win.  This in turn would result now in warnings such as:
> > tools/mkeficapsule.c:25:15: warning: redefinition of typedef 'u32' is a C11 feature [-Wtypedef-redefinition]
> > typedef __u32 u32;
> >               ^
> >
> > Signed-off-by: Tom Rini <trini at konsulko.com>
> > ---
> >  tools/Makefile | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/tools/Makefile b/tools/Makefile
> > index 999fd4653166..b45219e2c30c 100644
> > --- a/tools/Makefile
> > +++ b/tools/Makefile
> > @@ -295,8 +295,7 @@ HOST_EXTRACFLAGS += -include $(srctree)/include/compiler.h \
> >                 -I$(srctree)/tools \
> >                 -DUSE_HOSTCC \
> >                 -D__KERNEL_STRICT_NAMES \
> > -               -D_GNU_SOURCE \
> > -               -std=gnu99
> > +               -D_GNU_SOURCE
> 
> It looks like std=gnu11 is only added for Linux host.
> 
> KBUILD_HOSTCFLAGS += $(CSTD_FLAG)
> 
> Should we still keep it for other hosts?

Good question.  Looking at the Linux kernel, we're of course vastly
diverged again at this point, but it always passes -std=gnu89 (because
hey, we demand a newer minimum than the kernel) unless it's a tool/test
that spells out something else.  Given that Azure builds macOS and
cygwin for us, I'll see what happens when we tell everyone to use
-std=gnu11 and report back.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20211011/02fa10b4/attachment.sig>


More information about the U-Boot mailing list