Rafaël Carré | 29 Sep 02:23 2011
Picon

[PATCH] better *printf *scanf definitions

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)));

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

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

(Continue reading)

Ozkan Sezer | 1 Oct 06:59 2011
Picon

Re: [PATCH] better *printf *scanf definitions

On Thu, Sep 29, 2011 at 3:23 AM, Rafaël Carré
<rafael.carre@...> 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 {
(Continue reading)

Ozkan Sezer | 3 Oct 09:55 2011
Picon

Re: [PATCH] better *printf *scanf definitions

Kai:  I think this needs your attention.

On Sat, Oct 1, 2011 at 7:59 AM, Ozkan Sezer <sezeroz@...> wrote:
> On Thu, Sep 29, 2011 at 3:23 AM, Rafaël Carré
<rafael.carre@...> 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)));
>
(Continue reading)

Kai Tietz | 3 Oct 16:53 2011

Re: [PATCH] better *printf *scanf definitions

2011/10/3 Ozkan Sezer <sezeroz@...>:
> Kai:  I think this needs your attention.
>
> On Sat, Oct 1, 2011 at 7:59 AM, Ozkan Sezer <sezeroz@...> wrote:
>> On Thu, Sep 29, 2011 at 3:23 AM, Rafaël Carré <rafael.carre@...m> 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)));
>>
(Continue reading)


Gmane