xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/attr-format_arg.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc int printf(const char *, ...);
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc const char* f(const char *s) __attribute__((format_arg(1)));
6*f4a2713aSLionel Sambuc 
g(const char * s)7*f4a2713aSLionel Sambuc void g(const char *s) {
8*f4a2713aSLionel Sambuc   printf("%d", 123);
9*f4a2713aSLionel Sambuc   printf("%d %d", 123); // expected-warning{{more '%' conversions than data arguments}}
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc   printf(f("%d"), 123);
12*f4a2713aSLionel Sambuc   printf(f("%d %d"), 123); // expected-warning{{more '%' conversions than data arguments}}
13*f4a2713aSLionel Sambuc }
14