xref: /minix3/external/bsd/llvm/dist/clang/test/ASTMerge/struct.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/struct1.c
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/struct2.c
3*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc // CHECK: struct1.c:13:8: warning: type 'struct S1' has incompatible definitions in different translation units
6*f4a2713aSLionel Sambuc // CHECK: struct1.c:15:7: note: field 'field2' has type 'int' here
7*f4a2713aSLionel Sambuc // CHECK: struct2.c:12:9: note: field 'field2' has type 'float' here
8*f4a2713aSLionel Sambuc // CHECK: struct2.c:15:11: error: external variable 'x1' declared with incompatible types in different translation units ('struct S1' vs. 'struct S1')
9*f4a2713aSLionel Sambuc // CHECK: struct1.c:18:11: note: declared here with type 'struct S1'
10*f4a2713aSLionel Sambuc // CHECK: struct1.c:21:8: warning: type 'struct S2' has incompatible definitions in different translation units
11*f4a2713aSLionel Sambuc // CHECK: struct2.c:18:7: note: 'S2' is a union here
12*f4a2713aSLionel Sambuc // CHECK: struct2.c:18:30: error: external variable 'x2' declared with incompatible types in different translation units ('union S2' vs. 'struct S2')
13*f4a2713aSLionel Sambuc // CHECK: struct1.c:21:31: note: declared here with type 'struct S2'
14*f4a2713aSLionel Sambuc // CHECK: struct1.c:24:8: warning: type 'struct S3' has incompatible definitions in different translation units
15*f4a2713aSLionel Sambuc // CHECK: struct1.c:24:36: note: field 'd' has type 'double' here
16*f4a2713aSLionel Sambuc // CHECK: struct2.c:21:8: note: no corresponding field here
17*f4a2713aSLionel Sambuc // CHECK: struct2.c:21:31: error: external variable 'x3' declared with incompatible types in different translation units ('struct S3' vs. 'struct S3')
18*f4a2713aSLionel Sambuc // CHECK: struct1.c:24:41: note: declared here with type 'struct S3'
19*f4a2713aSLionel Sambuc // CHECK: struct1.c:27:8: warning: type 'struct S4' has incompatible definitions in different translation units
20*f4a2713aSLionel Sambuc // CHECK: struct2.c:24:26: note: field 'f' has type 'float' here
21*f4a2713aSLionel Sambuc // CHECK: struct1.c:27:8: note: no corresponding field here
22*f4a2713aSLionel Sambuc // CHECK: struct2.c:24:31: error: external variable 'x4' declared with incompatible types in different translation units ('struct S4' vs. 'struct S4')
23*f4a2713aSLionel Sambuc // CHECK: struct1.c:27:22: note: declared here with type 'struct S4'
24*f4a2713aSLionel Sambuc // CHECK: struct1.c:33:8: warning: type 'struct S6' has incompatible definitions in different translation units
25*f4a2713aSLionel Sambuc // CHECK: struct1.c:33:33: note: bit-field 'j' with type 'unsigned int' and length 8 here
26*f4a2713aSLionel Sambuc // CHECK: struct2.c:30:33: note: field 'j' is not a bit-field
27*f4a2713aSLionel Sambuc // CHECK: struct2.c:30:38: error: external variable 'x6' declared with incompatible types in different translation units ('struct S6' vs. 'struct S6')
28*f4a2713aSLionel Sambuc // CHECK: struct1.c:33:42: note: declared here with type 'struct S6'
29*f4a2713aSLionel Sambuc // CHECK: struct1.c:36:8: warning: type 'struct S7' has incompatible definitions in different translation units
30*f4a2713aSLionel Sambuc // CHECK: struct1.c:36:33: note: bit-field 'j' with type 'unsigned int' and length 8 here
31*f4a2713aSLionel Sambuc // CHECK: struct2.c:33:33: note: bit-field 'j' with type 'unsigned int' and length 16 here
32*f4a2713aSLionel Sambuc // CHECK: struct2.c:33:43: error: external variable 'x7' declared with incompatible types in different translation units ('struct S7' vs. 'struct S7')
33*f4a2713aSLionel Sambuc // CHECK: struct1.c:36:42: note: declared here with type 'struct S7'
34*f4a2713aSLionel Sambuc // CHECK: struct1.c:56:10: warning: type 'struct DeeperError' has incompatible definitions in different translation units
35*f4a2713aSLionel Sambuc // CHECK: struct1.c:56:35: note: field 'f' has type 'int' here
36*f4a2713aSLionel Sambuc // CHECK: struct2.c:53:37: note: field 'f' has type 'float' here
37*f4a2713aSLionel Sambuc // CHECK: struct1.c:54:8: warning: type 'struct DeepError' has incompatible definitions in different translation units
38*f4a2713aSLionel Sambuc // CHECK: struct1.c:56:41: note: field 'Deeper' has type 'struct DeeperError *' here
39*f4a2713aSLionel Sambuc // CHECK: struct2.c:53:43: note: field 'Deeper' has type 'struct DeeperError *' here
40*f4a2713aSLionel Sambuc // CHECK: struct2.c:54:3: error: external variable 'xDeep' declared with incompatible types in different translation units ('struct DeepError' vs. 'struct DeepError')
41*f4a2713aSLionel Sambuc // CHECK: struct1.c:57:3: note: declared here with type 'struct DeepError'
42*f4a2713aSLionel Sambuc // CHECK: 8 warnings and 7 errors generated
43