On 10/31/2012 20:01, Jonathan Wakely wrote:
> On 31 October 2012 11:23, JonY wrote:
>> On 10/31/2012 19:12, Jonathan Wakely wrote:
>>>
>>> It looks like the workaround is in mingw not in GCC, so is it a
>>> problem that it won't be possible to use GCC 4.8 with existing mingw
>>> versions, or are users required to use a brand new mingw to use a new
>>> GCC?  Should that be documented in
>>> http://gcc.gnu.org/gcc-4.8/changes.html ?
>>>
>>
>> They are required to use the latest mingw-w64, the problem was that the
>> vfswprintf that libstdc++ expects isn't the same as the one MS provides,
>> so I've wrote a redirector to use the vsnwprintf, more precisely, the
>> mingw C99 compliant __mingw_vsnwprintf.
>>
>> std::to_wstring and std::to_string work according to some simple tests.
> 
> Excellent, the testsuite should automatically start running the
> relevant tests and we should be able to close
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52015
> 

Yes, the correct way would be to check if the prototype given matches
the ISO version. MS version has 1 less argument. The workaround is only
active when C++11 is used though to maintain compatibility to older code.

The actual guard in the mingw-w64:

#if defined(__cplusplus) && (__cplusplus >= 201103L) &&
!defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)
...Redirect to ISO C99 compliant adapter with 4 args...
#else
...Use MS Version with 3 args...
#endif

So the tests and checks would just need to use -std=c++11 or gnu++11.

>> I guess the current comment about require mingw-w64 trunk at least r5437
>> is OK for the changes page. It should probably note that this change is
>> mingw-w64 specific, with w64 as the vendor key.
> 
> i.e. *-w64-mingw* ?  Or is *-w64-mingw32 more accurate?  (I don't
> really know how the mingw target triplets work, sorry!)
> 

In practice, *-w64-mingw32 is used more commonly when specifying
triplet, though for flexibility, checking should use *-w64-mingw*.

> I'll put something in the changes page later.
> 
> Thanks for fixing this.
> 

Thanks to Paolo for pushing it in too.


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to