blob: f71cd586458bfa56aac083048f7290d7e3fc2b2b [file] [log] [blame]
Chris Lattner2e64c072007-08-10 20:18:51 +00001// RUN: clang -parse-ast-check %s
2
3#include <stdio.h>
4#include <stdarg.h>
5
6void check_string_literal( FILE* fp, const char* s, char *buf, ... ) {
7
8 char * b;
9 va_list ap;
10 va_start(ap,buf);
11
12 printf(s); // expected-warning {{format string is not a string literal}}
13 vprintf(s,ap); // expected-warning {{format string is not a string liter}}
14 fprintf(fp,s); // expected-warning {{format string is not a string literal}}
15 vfprintf(fp,s,ap); // expected-warning {{format string is not a string lit}}
16 asprintf(&b,s); // expected-warning {{format string is not a string lit}}
17 vasprintf(&b,s,ap); // expected-warning {{format string is not a string lit}}
18 sprintf(buf,s); // expected-warning {{format string is not a string literal}}
19 snprintf(buf,2,s); // expected-warning {{format string is not a string lit}}
20 vsprintf(buf,s,ap); // expected-warning {{format string is not a string lit}}
21 vsnprintf(buf,2,s,ap); // expected-warning {{mat string is not a string lit}}
22}
23