smatch: relicense to GPLv2+
[smatch.git] / validation / init-char-array1.c
blob24fd8d82d7115521bd6f348828d13e13be83d866
1 /*
2 * for array of char, ("...") as the initializer is an gcc language
3 * extension. check that a parenthesized string initializer is handled
4 * correctly and that -Wparen-string warns about it's use.
5 */
6 static const char u[] = ("hello");
7 static const char v[] = {"hello"};
8 static const char v1[] = {("hello")};
9 static const char w[] = "hello";
10 static const char x[5] = "hello";
12 static void f(void)
14 char a[1/(sizeof(u) == 6)];
15 char b[1/(sizeof(v) == 6)];
16 char c[1/(sizeof(w) == 6)];
17 char d[1/(sizeof(x) == 5)];
20 * check-name: parenthesized string initializer
21 * check-command: sparse -Wparen-string $file
23 * check-error-start
24 init-char-array1.c:6:26: warning: array initialized from parenthesized string constant
25 init-char-array1.c:8:28: warning: array initialized from parenthesized string constant
26 * check-error-end