Of course there are C++ programs in the toolchain as well....
Unfortunately the use of HOST_CXXFLAGS doesn't work, at least not for
gdb:
(here the output is from Clang-16 on FreeBSD-14)
In file included from /more/work/woods/m-NetBSD-current/tools/gdb/../../external/gpl3/gdb/dist/gdb/gdb.c:19:
In file included from /more/work/woods/m-NetBSD-current/tools/gdb/../../external/gpl3/gdb/dist/gdb/defs.h:65:
/more/work/woods/m-NetBSD-current/tools/gdb/../../external/gpl3/gdb/dist/gdb/../gdbsupport/enum-flags.h:85:52: error: integer value -1 is outside the valid range of values [0, 15] for the enumeration type 'ui_out_flag' [-Wenum-constexpr-conversion]
integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
^
1 error generated.
That's because GDB's configure script seems to ignore CXXFLAGS (and
possibly also CFLAGS). It also sets up its own -W flags, so to make
this work CFLAGS would have to be appended to the command-line options,
not prepended as is typically done. I don't know how to do that cleanly
and simply for something like tools/gdb.
Presumably this error is fixed in a newer GDB, but....
Index: bsd.host.mk
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/share/mk/bsd.host.mk,v
retrieving revision 1.5
diff -u -u -r1.5 bsd.host.mk
--- bsd.host.mk 9 Aug 2020 21:13:38 -0000 1.5
+++ bsd.host.mk 8 Sep 2024 23:27:44 -0000
@@ -6,7 +6,7 @@
.if ${MKTOOLSDEBUG:Uno} == "yes"
HOST_DBG?= -g
.else
-HOST_DBG?= -O
+HOST_DBG?= -O2
.endif
.if ${MKDTRACE:Uno} != "no"
@@ -16,18 +16,18 @@
# Helpers for cross-compiling
HOST_CC?= cc
-HOST_CFLAGS?= ${HOST_DBG}
+HOST_CFLAGS?= ${HOST_DBG} -std=gnu99 -Wno-everything
HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_DTRACE_OPTS} ${HOST_CPPFLAGS} -c
HOST_COMPILE.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_DTRACE_OPTS} ${HOST_CPPFLAGS} -c
HOST_LINK.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS}
.if defined(HOSTPROG_CXX)
HOST_LINK.c?= ${HOST_LINK.cc}
.else
-HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS}
+HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDSTATIC} ${HOST_LDFLAGS}
.endif
HOST_CXX?= c++
-HOST_CXXFLAGS?= ${HOST_DBG}
+HOST_CXXFLAGS?= ${HOST_DBG} -std=gnu++14 -Wno-everything
HOST_CPP?= cpp
HOST_CPPFLAGS?=
--
Greg A. Woods <gwoods%acm.org@localhost>
Kelowna, BC +1 250 762-7675 RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost> Avoncote Farms <woods%avoncote.ca@localhost>
Attachment:
pgp87CvN4yjHo.pgp
Description: OpenPGP Digital Signature