public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Makefile: Ensure we build with -std=gnu11
@ 2018-06-20  3:57 Tom Rini
  2018-06-20  7:28 ` Joakim Tjernlund
  2018-06-21 18:21 ` Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: Tom Rini @ 2018-06-20  3:57 UTC (permalink / raw)
  To: u-boot

With the move to using at least gcc-6 for many targets we now have C
code that requires the GNU11 C standard to be used in all cases.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index fe7bf11970b8..399c5a5b549d 100644
--- a/Makefile
+++ b/Makefile
@@ -263,8 +263,9 @@ HOSTCXXFLAGS = -O2
 # Some Linux distributions (including RHEL7, SLES13, Debian 8) still
 # have older compilers as their default, so we make it explicit for
 # these that our host tools are GNU11 (i.e. C11 w/ GNU extensions).
+CSTD_FLAG := -std=gnu11
 ifeq ($(HOSTOS),linux)
-HOSTCFLAGS += --std=gnu11
+HOSTCFLAGS += $(CSTD_FLAG)
 endif
 
 ifeq ($(HOSTOS),cygwin)
@@ -370,7 +371,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
 
 KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
 		   -Wno-format-security \
-		   -fno-builtin -ffreestanding
+		   -fno-builtin -ffreestanding $(CSTD_FLAG)
 KBUILD_CFLAGS	+= -fshort-wchar
 KBUILD_AFLAGS   := -D__ASSEMBLY__
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] Makefile: Ensure we build with -std=gnu11
  2018-06-20  3:57 [U-Boot] [PATCH] Makefile: Ensure we build with -std=gnu11 Tom Rini
@ 2018-06-20  7:28 ` Joakim Tjernlund
  2018-06-20 11:30   ` Tom Rini
  2018-06-21 18:21 ` Tom Rini
  1 sibling, 1 reply; 4+ messages in thread
From: Joakim Tjernlund @ 2018-06-20  7:28 UTC (permalink / raw)
  To: u-boot

On Tue, 2018-06-19 at 23:57 -0400, Tom Rini wrote:
> 
> 
> With the move to using at least gcc-6 for many targets we now have C
> code that requires the GNU11 C standard to be used in all cases.

Requiring gcc-6 is a bit much I think, there are lots of cross gcc's out there
that is older. I don't think even the kernel needs gcc-6

 Jocke

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] Makefile: Ensure we build with -std=gnu11
  2018-06-20  7:28 ` Joakim Tjernlund
@ 2018-06-20 11:30   ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2018-06-20 11:30 UTC (permalink / raw)
  To: u-boot

On Wed, Jun 20, 2018 at 07:28:15AM +0000, Joakim Tjernlund wrote:

> On Tue, 2018-06-19 at 23:57 -0400, Tom Rini wrote:
> > 
> > 
> > With the move to using at least gcc-6 for many targets we now have C
> > code that requires the GNU11 C standard to be used in all cases.
> 
> Requiring gcc-6 is a bit much I think, there are lots of cross gcc's out there
> that is older. I don't think even the kernel needs gcc-6

We've required gcc-6 for ARM since v2018.01, and we were warning about
that for a while longer than that, due to toolchain issues.

That said, my commit message is clearly not clear enough.  We don't
require gcc-6 for everyone, we require support for -std=gnu11, and that
goes back a long ways.  It's just that since some platforms require
gcc-6 we've started having (and this is good, the code is cleaner!) some
C-11'isms sneak into the code.  For example, sandbox now fails to
compile on older hosts due to a for (int i = 0; ...) in cmd/iotrace.c

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180620/eda026ab/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] Makefile: Ensure we build with -std=gnu11
  2018-06-20  3:57 [U-Boot] [PATCH] Makefile: Ensure we build with -std=gnu11 Tom Rini
  2018-06-20  7:28 ` Joakim Tjernlund
@ 2018-06-21 18:21 ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2018-06-21 18:21 UTC (permalink / raw)
  To: u-boot

On Tue, Jun 19, 2018 at 11:57:31PM -0400, Tom Rini wrote:

> With the move to using at least gcc-6 for many targets we now have C
> code that requires the GNU11 C standard to be used in all cases.
> 
> Signed-off-by: Tom Rini <trini@konsulko.com>

With a much re-worded to be clearer than gcc-6 is not required but that
C11 (or rather, GNU11) is used, applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180621/b562f012/attachment.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-21 18:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-20  3:57 [U-Boot] [PATCH] Makefile: Ensure we build with -std=gnu11 Tom Rini
2018-06-20  7:28 ` Joakim Tjernlund
2018-06-20 11:30   ` Tom Rini
2018-06-21 18:21 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox