aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/init-char-array1.c
blob: 24fd8d82d7115521bd6f348828d13e13be83d866 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * for array of char, ("...") as the initializer is an gcc language
 * extension. check that a parenthesized string initializer is handled
 * correctly and that -Wparen-string warns about it's use.
 */
static const char u[] = ("hello");
static const char v[] = {"hello"};
static const char v1[] = {("hello")};
static const char w[] = "hello";
static const char x[5] = "hello";

static void f(void)
{
	char a[1/(sizeof(u) == 6)];
	char b[1/(sizeof(v) == 6)];
	char c[1/(sizeof(w) == 6)];
	char d[1/(sizeof(x) == 5)];
}
/*
 * check-name: parenthesized string initializer
 * check-command: sparse -Wparen-string $file
 *
 * check-error-start
init-char-array1.c:6:26: warning: array initialized from parenthesized string constant
init-char-array1.c:8:28: warning: array initialized from parenthesized string constant
 * check-error-end
 */