[PATCH] toolchain/gcc: set dialects for each version
Rosen Penev
rosenp at gmail.com
Tue Jan 25 14:20:45 PST 2022
On Tue, Jan 25, 2022 at 9:06 AM Stijn Tintel <stijn at linux-ipv6.be> wrote:
>
> GCC has an option "-std=" to set the language standard for C and C++.
> Newer GCC versions sometimes switch to newer standards by default. This
> has the potential to break the OpenWrt toolchain build whenever a distro
> introduces a new GCC version that uses a newer dialect by default.
>
> Let's set the default dialects used for each of the GCC versions we
> support, to avoid these toolchain build failures in the future.
>
> Signed-off-by: Stijn Tintel <stijn at linux-ipv6.be>
> ---
> toolchain/gcc/common.mk | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
> index bef4fa37f8..3e31a139cd 100644
> --- a/toolchain/gcc/common.mk
> +++ b/toolchain/gcc/common.mk
> @@ -29,14 +29,20 @@ PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
> PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
>
> ifeq ($(PKG_VERSION),8.4.0)
> + C_DIALECT=-std=gnu17
> + CXX_DIALECT=-std=gnu++14
> PKG_HASH:=e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4
> endif
>
> ifeq ($(PKG_VERSION),10.3.0)
> + C_DIALECT=-std=gnu17
> + CXX_DIALECT=-std=gnu++14
> PKG_HASH:=64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344
> endif
>
> ifeq ($(PKG_VERSION),11.2.0)
> + C_DIALECT=-std=gnu17
> + CXX_DIALECT=-std=gnu++17
I mentioned this on IRC. GCC8 is the first version to support
std=c++17. prereq-build says GCC6 which supports c++1z.
> PKG_HASH:=d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b
> endif
>
> @@ -86,6 +92,8 @@ GCC_CONFIGURE:= \
> CFLAGS="-O2 -fbracket-depth=512 -pipe" \
> CXXFLAGS="-O2 -fbracket-depth=512 -pipe" \
> ) \
> + CFLAGS="$(CFLAGS) $(C_DIALECT)" \
> + CXXFLAGS="$(CXXFLAGS) $(CXX_DIALECT)" \
> $(HOST_SOURCE_DIR)/configure \
> --with-bugurl=$(BUGURL) \
> --with-pkgversion="$(PKGVERSION)" \
> --
> 2.34.1
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list