• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 static const __WCHAR_TYPE__ ok0[] = L"abc";
2 _Static_assert(sizeof(ok0) == 4 * sizeof(__WCHAR_TYPE__));
3 static const __WCHAR_TYPE__ ok1[] = (L"abc");
4 _Static_assert(sizeof(ok1) == 4 * sizeof(__WCHAR_TYPE__));
5 static const __WCHAR_TYPE__ ok2[] = { L"abc" };
6 _Static_assert(sizeof(ok2) == 4 * sizeof(__WCHAR_TYPE__));
7 
8 static const __WCHAR_TYPE__ ok3[4] = L"abc";
9 _Static_assert(sizeof(ok3) == 4 * sizeof(__WCHAR_TYPE__));
10 static const __WCHAR_TYPE__ ok4[4] = (L"abc");
11 _Static_assert(sizeof(ok4) == 4 * sizeof(__WCHAR_TYPE__));
12 static const __WCHAR_TYPE__ ok5[4] = { (L"abc") };
13 _Static_assert(sizeof(ok5) == 4 * sizeof(__WCHAR_TYPE__));
14 
15 static const __WCHAR_TYPE__ ok6[7] = L"abc";
16 _Static_assert(sizeof(ok6) == 7 * sizeof(__WCHAR_TYPE__));
17 static const __WCHAR_TYPE__ ok7[7] = (L"abc");
18 _Static_assert(sizeof(ok7) == 7 * sizeof(__WCHAR_TYPE__));
19 static const __WCHAR_TYPE__ ok8[7] = { (L"abc") };
20 _Static_assert(sizeof(ok8) == 7 * sizeof(__WCHAR_TYPE__));
21 
22 static const __WCHAR_TYPE__ *ptr[] =  { L"abc" };
23 _Static_assert(sizeof(ptr) == sizeof(void *));
24 
25 static struct s {
26 	const __WCHAR_TYPE__ str[4];
27 } str = { L"xyz" };
28 
29 static const __WCHAR_TYPE__ ko3[3] = L"abc";
30 static const __WCHAR_TYPE__ ko2[2] = L"abc";
31 
32 /*
33  * check-name: init-wstring
34  * check-command: sparse -Winit-cstring $file
35  *
36  * check-error-start
37 init-wstring.c:29:38: warning: too long initializer-string for array of char(no space for nul char)
38 init-wstring.c:30:38: warning: too long initializer-string for array of char
39  * check-error-end
40  */
41