Debian Codegraph @

clang/test/Parser/ms-if-exists.c

raw
1 // RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions
2 // expected-no-diagnostics
3
4 struct Type {
5 };
6
7 void test_if_exists_stmts(void) {
8 int b = 0;
9 __if_exists(Type) {
10 b++;
11 b++;
12 }
13 __if_exists(Type_not) {
14 this will not compile.
15 }
16 __if_not_exists(Type) {
17 this will not compile.
18 }
19 __if_not_exists(Type_not) {
20 b++;
21 b++;
22 }
23 }
24
25 int if_exists_creates_no_scope(void) {
26 __if_exists(Type) {
27 int x; // 'x' is declared in the parent scope.
28 }
29 __if_not_exists(Type_not) {
30 x++;
31 }
32 return x;
33 }
34
35 __if_exists(Type) {
36 int var23;
37 }
38
39 __if_exists(Type_not) {
40 this will not compile.
41 }
42
43 __if_not_exists(Type) {
44 this will not compile.
45 }
46
47 __if_not_exists(Type_not) {
48 int var244;
49 }
50
51 void test_if_exists_init_list(void) {
52
53 int array1[] = {
54 0,
55 __if_exists(Type) {2, }
56 3
57 };
58
59 int array2[] = {
60 0,
61 __if_exists(Type_not) { this will not compile }
62 3
63 };
64
65 int array3[] = {
66 0,
67 __if_not_exists(Type_not) {2, }
68 3
69 };
70
71 int array4[] = {
72 0,
73 __if_not_exists(Type) { this will not compile }
74 3
75 };
76
77 }
78
79
80 void test_nested_if_exists(void) {
81 __if_exists(Type) {
82 int x = 42;
83 __if_not_exists(Type_not) {
84 x++;
85 }
86 }
87 }