blob: 0b166e3c4dc3d021fb81eca5f10c56c261aa475e [file] [log] [blame]
Ted Kremeneke5769412008-03-07 18:43:49 +00001//RUN: clang -fsyntax-only -verify %s
2
3#include <stdarg.h>
4
5void a(const char *a, ...) __attribute__((format(printf, 1,2))); // no-error
6void b(const char *a, ...) __attribute__((format(printf, 1,1))); // expected-error {{'format' attribute parameter 3 is out of bounds}}
7void c(const char *a, ...) __attribute__((format(printf, 0,2))); // expected-error {{'format' attribute parameter 2 is out of bounds}}
8void d(const char *a, int c) __attribute__((format(printf, 1,2))); // expected-error {{format attribute requires variadic function}}
9void e(char *str, int c, ...) __attribute__((format(printf, 2,3))); // expected-error {{format argument not a string type}}
10
11typedef const char* xpto;
12void f(xpto c, va_list list) __attribute__((format(printf, 1, 0))); // no-error
13void g(xpto c) __attribute__((format(printf, 1, 0))); // no-error
14
15void y(char *str) __attribute__((format(strftime, 1,0))); // no-error
16void z(char *str, int c, ...) __attribute__((format(strftime, 1,2))); // expected-error {{strftime format attribute requires 3rd parameter to be 0}}