On Thu, Sep 29, 2011 at 3:23 AM, Rafaël Carré <rafael.ca...@gmail.com> wrote: > Hi, >
Don't know why is this sent in a second time , > Current CPP definitions for *printf and *scanf > (with__USE_MINGW_ANSI_STDIO >= 0) in > mingw-w64-headers/crt/_mingw_print_pop.h are too invasive. > > Example: > myfile.h:189:47: > warning: '__mingw_printf' is an unrecognized format function type [-Wformat] > > when preprocessing "void func(const char *format, ...) > __attribute__((printf(format, 1, 2))); > That's why many people recommends using attribute names with two underscores prepended and appended, like: void func(const char *format, ...) __attribute__((__printf__(__format__,1,2))); For this part, the patch may not be needed > This also breaks C++ objects using members named after the standard > functions, like: > > class A { > public: > QString &sprintf(const char *format, ...) > }; > > like seen in Qt4 > Don't know about this one, though, and the rest. Added Kai to the CC list > > Attached patch use GCC variadic macros (using the GNU extension and not > the C99 feature, to keep compatibility with previous versions of the C > standard) to fix these problems. See > http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html for more details. > > > HOWEVER > > The attached patch doesn't fix completely the C++ case, if > standard functions are redefined inside a class with a different number > of arguments. > > For example QString (of qt4) class redefines sprintf without the > "char *str" argument, because it is assumed that the first argument > points to the class instance. > > It seems that mingw32 solved that in a different way, I'm looking at > their repository to extract the patch and adapt it to mingw64 > > So I'm just opening the thread and will post another patch tomorrow. > > -- > Rafaël Carré > -- O.S. ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public