1
0
This repository has been archived on 2024-11-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Lakka-rk322x/packages/tools/u-boot/patches/rockchip/u-boot-0013-Makefile-adopt-std-gnu11-for-HOSTCFLAGS-on-Linux.patch
2019-09-09 06:10:44 +00:00

49 lines
1.9 KiB
Diff

From 4270dca0656b872ac44dc860151bba76c257cfe2 Mon Sep 17 00:00:00 2001
From: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Date: Mon, 14 May 2018 15:22:06 +0200
Subject: [PATCH] Makefile: adopt --std=gnu11 for HOSTCFLAGS on Linux
Following the conversion of the SPDX license tags, a number of files
compiled with -pedantic now generate warnings similar to the following
for using C99-style '//' comments in ISO C90 code:
tools/gen_eth_addr.c:1:1: warning: C++ style comments are not allowed in ISO C90
// SPDX-License-Identifier: GPL-2.0+
^
The SPDX comment-style change means that these files have adopted C99,
so need to change the language-standard to --std=gnu99 or --std=gnu11
to let the compiler know this.
As we now require GCC 6 or newer for the cross-compiler, the project has
implicitly moved the project to GNU11: let older GCC versions on various
Linux distros know to treat our host tools as GNU11 as well.
References: commit 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style")
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
Makefile | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Makefile b/Makefile
index fe2a57fa58..484a1eb01d 100644
--- a/Makefile
+++ b/Makefile
@@ -260,6 +260,15 @@ HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
$(if $(CONFIG_TOOLS_DEBUG),-g)
HOSTCXXFLAGS = -O2
+# With the move to GCC 6, we have implicitly upgraded our language
+# standard to GNU11 (see https://gcc.gnu.org/gcc-5/porting_to.html).
+# 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).
+ifeq ($(HOSTOS),linux)
+HOSTCFLAGS += --std=gnu11
+endif
+
ifeq ($(HOSTOS),cygwin)
HOSTCFLAGS += -ansi
endif