tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: HEADS UP: plan to switch many ports over to GCC 12 soon



Christoph Badura <bad%bsd.de@localhost> writes:

> For me gcc/usr.bin/host-libcpp failed to build on macOS 12.7.
>
> Stuff like:
> src/external/gpl3/gcc/dist/libcpp/include/line-map.h:1677:44: warning: deleted function definitions are a C++11 extension [-Wc++11-extensions]
> src/external/gpl3/gcc/dist/libcpp/include/cpplib.h:319:13: warning: commas at the end of enumerator lists are a C++11 extension [-Wc++11-extensions]
> src/external/gpl3/gcc/dist/libcpp/include/cpplib.h:1144:6: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
> etc.
>
> A patch similar what David Gutteridge did on r1.113 of src/tools/gcc/Makefile
> fixed that.
>
> diff --git a/external/gpl3/gcc/usr.bin/host-libcpp/Makefile b/external/gpl3/gcc/usr.bin/host-libcpp/Makefile
> index 77ea9e0b2ba..e7968c85f55 100644
> --- a/external/gpl3/gcc/usr.bin/host-libcpp/Makefile
> +++ b/external/gpl3/gcc/usr.bin/host-libcpp/Makefile
> @@ -1,5 +1,7 @@
>  #	$NetBSD: Makefile,v 1.6 2023/05/19 10:42:34 lukem Exp $
>  
> +.include <bsd.init.mk>
> +
>  BUILD_ENV= \
>  		AR=${HOST_AR:Q} \
>  		AWK=${TOOL_AWK:Q} \
> @@ -19,6 +21,12 @@ BUILD_ENV= \
>  		RANLIB=${HOST_RANLIB:Q} \
>  		YACC=${YACC:Q}
>  
> +# Force C++11 so builds succeed on hosts where this isn't the compiler
> +# default, e.g., NetBSD 8.x with GCC 5.5.
> +.if ${HAVE_GCC} > 10
> +HOST_CXXFLAGS+=		-std=c++11
> +.endif
> +
>  GMAKE_J_ARGS?=	${MAKEFLAGS:[*]:M*-j*:C/(^|.* )(-j ?[0-9][0-9]*).*/\2/W}
>  BUILD_COMMAND=	/usr/bin/env -i ${BUILD_ENV} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e
>  
> I'll commit that if there are no objections.

I'm not really comfortable with this being conditional.   If the program
is in c++11, it makes sense to just always pass that -std.   If the
default is c++11, it's a noop.  If the default is c++17, it asks that
the sources be treated as c++11 and thus would catch if anyone added a
c++17ism via an edit.



Home | Main Index | Thread Index | Old Index