Debian Codegraph @

clang/test/Sema/excess-embed-data.c

raw
1 // RUN: %clang_cc1 -std=c23 -fsyntax-only -verify=c %s
2 // RUN: %clang_cc1 -fsyntax-only -verify=cpp -x c++ -Wno-c23-extensions %s
3
4
5 struct S {
6 int arr[3];
7 };
8
9 struct S1 {
10 struct S s;
11 };
12
13 void cases(int x) {
14 int a[8] = {x, x, x, x, x, x,
15 #embed __FILE__
16 // c-warning@-1{{excess elements in array initializer}}
17 // cpp-error@-2{{excess elements in array initializer}}
18 };
19 int b[8] = {
20 #embed __FILE__
21 // c-warning@-1{{excess elements in array initializer}}
22 // cpp-error@-2{{excess elements in array initializer}}
23 };
24 int c[3000] = {x, x, x, x, x, x,
25 #embed __FILE__
26 };
27 char d[3] = {
28 #embed __FILE__
29 // c-warning@-1{{initializer-string for char array is too long}}
30 // cpp-error@-2{{initializer-string for char array is too long}}
31 };
32
33 char e[3000] = { 1,
34 #embed __FILE__
35 };
36
37 struct S s = {
38 #embed __FILE__
39 // c-warning@-1{{excess elements in struct initializer}}
40 // cpp-error@-2{{excess elements in struct initializer}}
41 , x
42 };
43
44 struct S1 s1 = {
45 #embed __FILE__
46 // c-warning@-1{{excess elements in struct initializer}}
47 // cpp-error@-2{{excess elements in struct initializer}}
48 , x
49 };
50 }