This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 2017-05-08 11:00, Eli Zaretskii wrote:
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?
I think the best solution would be a check at configure time. I think it's a function that can be quite handy, so it would be unfortunate if we had to avoid using it, especially if it's easy to implement ourselves for MinGW. A configure check would be more robust than checking for MinGW or _GLIBCXX_HAVE_BROKEN_VSWPRINTF specifically, in case another platform needs the replacement too, or if the define changes at some point.
Note that you'll need to check for the specific overload of the function that we use, the one that accepts a parameter of std::vector<T>::size_type (what .size() returns). In practice, I think we can consider that it will always correspond to size_t.
Thanks, Simon
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |