From: Greg C. <gch...@sb...> - 2009-06-05 16:32:06
|
On 2009-06-05 15:37Z, John E. / TDM wrote: > In recent upstream versions of GCC, enforcing strict C++98 or C++0x > standard-compliance and then including some of GCC's own standard > library headers causes errors like "::swprintf has not been declared" > and "::vswprintf has not been declared". This arises from the fact that > their declarations in mingwrt's stdio.h are surrounded by "#ifndef > __STRICT_ANSI__/#endif", but standard header <cwchar> references them > without such guards and other headers such as <iostream> include <cwchar>. > > Why are these functions elided when operating in strict > standards-compliance mode (if it is in fact correct to do so)? I would guess that the headers were written with C89 in mind, as described here: http://www.mail-archive.com/deb...@li.../msg385630.html OTOH, I don't have a copy of the C89 standard, so I can't say for sure whether it had these functions--this might just be a longstanding error. Otherwise... > What is > the correct fix for this bug? We could test the value of __STDC_VERSION__ in conjunction with __STRICT_ANSI__, as newlib did here: http://sourceware.org/ml/newlib/2007/msg00800.html Equivalently, to avoid a profusion of verbose and similar conditionals like this: #if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L we could define a macro (in '_mingw.h') like __STRICT_C99__ as suggested here: http://www.mail-archive.com/gcc...@gc.../msg175049.html |