From: Greg C. <chi...@co...> - 2007-08-23 14:13:43
|
On 2007-08-22 14:00Z, Keith Marshall wrote: > > Unless anyone speaks out against it, within the next 48 > hours, I'll commit, as per my working copy, and remove the existing > (broken) implementation. I applied the 'stdio.h.diff' patch from your email to fresh 4.2.1-dw2 and 4.2.1-sjlj installations here, and it seemed to cause C++ problems unless __USE_MINGW_SNPRINTF is defined explicitly. I see a related problem with the (different) patch in my earlier email. /tmp[0]$cat hello.cpp #include <iostream> #include <ostream> int main() { std::cout << "Hello" << std::endl; } /tmp[0]$/MinGW-20070814/bin/g++-dw2 -D__USE_MINGW_SNPRINTF hello.cpp /tmp[0]$./a Hello So far so good, but... /tmp[0]$/MinGW-20070814/bin/g++-dw2 hello.cpp In file included from c:\cygwin\mingw-20070814\bin\../lib/gcc/mingw32/4.2.1-dw2/include/c++/mingw32/bits/c++locale.h:49, from c:\cygwin\mingw-20070814\bin\../lib/gcc/mingw32/4.2.1-dw2/include/c++/iosfwd:45, from c:\cygwin\mingw-20070814\bin\../lib/gcc/mingw32/4.2.1-dw2/include/c++/ios:43, from c:\cygwin\mingw-20070814\bin\../lib/gcc/mingw32/4.2.1-dw2/include/c++/ostream:45, from c:\cygwin\mingw-20070814\bin\../lib/gcc/mingw32/4.2.1-dw2/include/c++/iostream:45, from hello.cpp:1: c:\cygwin\mingw-20070814\bin\../lib/gcc/mingw32/4.2.1-dw2/include/c++/cstdio:170: error: '::snprintf' has not been declared c:\cygwin\mingw-20070814\bin\../lib/gcc/mingw32/4.2.1-dw2/include/c++/cstdio:173: error: '::vsnprintf' has not been declared c:\cygwin\mingw-20070814\bin\../lib/gcc/mingw32/4.2.1-dw2/include/c++/cstdio:181: error: '__gnu_cxx::snprintf' has not been declared c:\cygwin\mingw-20070814\bin\../lib/gcc/mingw32/4.2.1-dw2/include/c++/cstdio:184: error: '__gnu_cxx::vsnprintf' has not been declared Explicitly defining __USE_MSVCRT_SNPRINTF: /tmp[1]$/MinGW-20070814/bin/g++-dw2 -D__USE_MSVCRT_SNPRINTF hello.cpp fails with the same set of diagnostics. I got similar results with that patch and sjlj--this worked: /MinGW-20070814-sjlj/bin/g++-sjlj -D__USE_MINGW_SNPRINTF hello.cpp while these failed: /MinGW-20070814-sjlj/bin/g++-sjlj -D__USE_MSVCRT_SNPRINTF hello.cpp /MinGW-20070814-sjlj/bin/g++-sjlj hello.cpp as above. A similar problem arises, only in the explicit -D__USE_MSVCRT_SNPRINTF case, with the patch in my 2007-08-20T13:34Z email. Do these various __USE_MSVCRT_SNPRINTF efforts still seem worthwhile, now that we've seen that it's harder than it looked at first? The purpose is apparently to accommodate anyone who wants C99 function snprintf() with non-C99 _snprintf() semantics: something that mingwex used to do, but msvc never did. Are we sure there's anyone who actually depends on that? I view this not as the substitution of one appropriate behavior for another, but as the correction of a known shortcoming that doesn't call for preservation of backward compatibility. |