RE: Using both wchar_t and GCC __attribute__((format(...)))

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 

I haven't used this attribute before, but the following is what I feel
after giving it a try now...

> void trace(conn_t *, wchar_t *, ...)
>         __attribute__ ((format(printf, 2, 3)));
> 
> And GCC aborts with:
> 
> "error: format string argument not a string type"

Here, the error is due to the fact that gcc expects the 'string-index'
parameter of format attribute to point to 'const char *' type.

> void trace(conn_t *, wchar_t *, ...)
>         __attribute__ ((format(wprintf, 2, 3)));
> 
> But GCC tells me that:
> 
> "warning: 'wprintf' is an unrecognized format function type"

This error is because, according to gcc-4.2.0 manual it only supports
the following - printf, scanf, strftime or strfmon - for the 'archetype'
parameter offormat attribute.

So I feel we are out of luck unless gcc adds support for 'wprintf' as
archetype for format attribute.

I found a mail loop at gcc-patches mailing list where a patch is
submitted to add this support and its discussion. I am not sure if has
got approved, but you may take a look at it.

Here is the link -
http://gcc.gnu.org/ml/gcc-patches/2001-12/msg01579.html

Hope that will help you.

Regards,
Cyon

-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux