Ted Kremenek | 5530131 | 2010-07-16 02:11:34 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral %s |
| 2 | |
| 3 | typedef __typeof(sizeof(int)) size_t; |
| 4 | typedef struct _FILE FILE; |
| 5 | |
| 6 | int fscanf(FILE * restrict, const char * restrict, ...) ; |
| 7 | int scanf(const char * restrict, ...) ; |
| 8 | int sscanf(const char * restrict, const char * restrict, ...) ; |
| 9 | |
| 10 | void test(const char *s, int *i) { |
| 11 | scanf(s, i); // expected-warning{{ormat string is not a string literal}} |
Ted Kremenek | c618728 | 2010-07-16 18:27:56 +0000 | [diff] [blame] | 12 | 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 Kremenek | d7b31cc | 2010-07-16 18:28:03 +0000 | [diff] [blame] | 14 | scanf("%d%[asdfasdfd", i, s); // expected-warning{{no closing ‘]’ for ‘%[’ in scanf format string}} |
Ted Kremenek | 5530131 | 2010-07-16 02:11:34 +0000 | [diff] [blame] | 15 | } |