This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: GDB 7.99.91 MinGW compilation error in cli-script.c
- From: Eli Zaretskii <eliz at gnu dot org>
- To: gdb-patches at sourceware dot org
- Date: Mon, 08 May 2017 18:00:02 +0300
- Subject: Re: GDB 7.99.91 MinGW compilation error in cli-script.c
- Authentication-results: sourceware.org; auth=none
- References: <20170504194442.63AAF60B72@joel.gnat.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
The error manifests itself as follows:
g++ -std=gnu++11 -O2 -gdwarf-4 -g3 -I. -I. -I./common -I./config -DLOCALEDIR="\"d:/usr/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../readline/.. -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber -I./gnulib/import -Ibuild-gnulib/import -DTUI=1 -Id:/usr/include -Id:/usr/include/guile/2.0 -Id:/usr/include -Id:/usr/Python26/include -Id:/usr/Python26/include -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-narrowing -Wno-format -c -o cli-script.o -MT cli-script.o -MMD -MP -MF .deps/cli-script.Tpo cli/cli-script.c
cli/cli-script.c: In member function 'std::__cxx11::string user_args::insert_args(const char*) const':
cli/cli-script.c:809:16: error: 'to_string' is not a member of 'std'
new_line += std::to_string (m_args.size ());
^
Makefile:1888: recipe for target `cli-script.o' failed
make[2]: *** [cli-script.o] Error 1
The reason is that std::to_string is guarded by the symbol
_GLIBCXX_HAVE_BROKEN_VSWPRINTF, which mingw.org's MinGW defines in its
os_defines.h, because msvcrt.dll's implementation of vswprintf is
incompatible with what C++11 expects. So GDB assumes here without
testing that this method is available, which is not true at least on
one platform.
How best to solve this? I worked around by providing my own
implementation based on std::ostringstream, but I'm not sure this is
TRT. An alternative would be to use some less problematic API, since
currently cli-script.c is the only user of this method, and its needs
are quite modest. And if we do provide a replacement for to_string,
should the configure script probe for it, or should we condition it
specifically on MinGW and _GLIBCXX_HAVE_BROKEN_VSWPRINTF?
Thoughts?