blob: f5718868776ca8102787bc68685dc36e090f9fd6 [file] [log] [blame]
Ted Kremenek55301312010-07-16 02:11:34 +00001// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral %s
2
3typedef __typeof(sizeof(int)) size_t;
4typedef struct _FILE FILE;
5
6int fscanf(FILE * restrict, const char * restrict, ...) ;
7int scanf(const char * restrict, ...) ;
8int sscanf(const char * restrict, const char * restrict, ...) ;
9
10void test(const char *s, int *i) {
11 scanf(s, i); // expected-warning{{ormat string is not a string literal}}
Ted Kremenekc6187282010-07-16 18:27:56 +000012 scanf("%0d", i); // expected-warning{{zero field width in scanf format string is unused}}
13 scanf("%00d", i); // expected-warning{{zero field width in scanf format string is unused}}
Ted Kremenekd7b31cc2010-07-16 18:28:03 +000014 scanf("%d%[asdfasdfd", i, s); // expected-warning{{no closing ‘]’ for ‘%[’ in scanf format string}}
Ted Kremenek55301312010-07-16 02:11:34 +000015}