FTBFS if "-Werror=format-security" flag is used

Jakub Jelinek jakub at redhat.com
Fri Dec 6 19:45:07 UTC 2013


On Fri, Dec 06, 2013 at 08:02:06PM +0100, Kevin Kofler wrote:
> * translatable format strings, e.g.
>   printf(translate("processed %d items"), foo);

Translatable strings are handled just fine.
Try e.g.:

extern int my_printf (void *my_object, const char *my_format, ...)
  __attribute__ ((format (printf, 2, 3)));
extern char *my_dgettext (char *my_domain, const char *my_format)
  __attribute__ ((format_arg (2)));

void *p; char *q;
void
foo ()
{
  my_printf (p, my_dgettext (q, "abcd"));
}

e.g. <libintl.h> already uses the right attributes, so you don't
get errors for this.

	Jakub


More information about the devel mailing list