On Thu, Sep 29, 2011 at 4:08 AM, Rafaël Carré <fun...@videolan.org> wrote:
> Hi,
>
> 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 is not needed

>
> This also breaks C++ objects using members named after the standard
> functions, like:
>
> class A {
> public:
>        QString    &sprintf(const char *format, ...)
> };

Don't know about this one though.

>
> like seen in Qt4
>
>
> 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, apparently by
> using adding different prototypes with 
> __attribute__((alias("__mingw_printf")))
>
> So I'm just opening the thread and will post another patch tomorrow.
>
> --
> Rafaël Carré

--
O.S.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to