https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78666
--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Attribute format suffers from a similar problem.
(I'm not looking for ways to break things, btw., but rather trying to come up
with a test to exercise my patch for bug 78673 in whose review Jeff pointed out
I wasn't handling attribute nonnull quite right. I'm looking at how other
attributes are being handled to make sure they're all consistent.)
$ cat a.c && /build/gcc-git/gcc/xgcc -B /build/gcc-git/gcc -S -Wall -Wextra a.c
#define P(f, a) __attribute__ ((format (printf, f, a)))
void P (1, 3) P (2, 3) f1 (const char*, const char *, ...);
void P (1, 3) f2 (const char*, const char *, ...);
void P (2, 3) f2 (const char*, const char *, ...);
void g (void)
{
f1 ("%i", "%s", "123");
f2 ("%i", "%s", "123");
}
a.c: In function ‘g’:
a.c:10:9: warning: format ‘%i’ expects argument of type ‘int’, but argument 3
has type ‘char *’ [-Wformat=]
f1 ("%i", "%s", "123");
~^ ~~~~~
%s
a.c:12:9: warning: format ‘%i’ expects argument of type ‘int’, but argument 3
has type ‘char *’ [-Wformat=]
f2 ("%i", "%s", "123");
~^ ~~~~~
%s