blob: 26038ea965dd9ca75e5ee0f21e4ea6bb508ed53b [file] [log] [blame]
John Kessenich38c507e2013-02-08 18:56:56 +00001#version 110
2
John Kessenich464f6d92013-02-06 00:14:16 +00003#define ON
4
5float sum = 0.0;
6
7void main()
8{
9
10#ifdef ON
11//yes
12sum += 1.0;
13
14 #ifdef OFF
15 //no
16 sum += 20.0;
17 #endif
18
19 #if defined(ON)
20 //yes
21 sum += 300.0;
22 #endif
23
24#endif
25
26
27#if defined(OFF)
28//no
29sum += 4000.0;
30
31#if !defined(ON)
32//no
33sum += 50000.0;
34#endif
35
36 //no
37 sum += 0.1;
38 #ifdef ON
39 //no
40 sum += 0.2;
41 #endif
42
John Kessenich85e0e022013-02-06 02:23:47 +000043 //no
44 sum += 0.01;
45 #ifdef ON
46 //no
47 sum += 0.02;
48 #else
49 //no
50 sum += 0.03;
51 #endif
52
John Kessenich464f6d92013-02-06 00:14:16 +000053//no
54 sum + 0.3;
55
56#endif
57
58
59#if !defined(OFF)
60//yes
61sum += 600000.0;
62
63 #if defined(ON) && !defined(OFF)
64 //yes
65 sum += 80000000.0;
66
67 #if defined(OFF) || defined(ON)
68 //yes
69 sum += 900000000.0;
70
71 #if defined(ON) && defined(OFF)
72 //no
73 sum += 0.7;
74 #elif !defined(OFF)
75 //yes
76 sum += 7000000.0;
77 #endif
78
79 #endif
80
81 #endif
82
83#endif
84
85// sum should be 987600301.0
86 gl_Position = vec4(sum);
87}
John Kessenich69aa9c12013-11-12 03:31:24 +000088
89#define A 1
90#define C 0
91#define E 0
92#define F 1
93#if A
94 #if C
95 #if E
96 int selected4 = 1;
97 #elif F
98 int selected4 = 2;
99 #else
100 int selected4 = 3;
101 #endif
102 #endif
103 int selected4 = 4;
104#endif
105
106#define ZA 1
107#define ZC 1
108#define ZE 0
109#define ZF 1
110#if ZA
111 #if ZC
112 #if ZE
113 int selected2 = 1;
114 #elif ZF
115 int selected2 = 2;
116 #else
117 int selected2 = 3;
118 #endif
119 #endif
120#endif
121
122#define AZA 1
123#define AZC 1
124#define AZE 0
125#define AZF 0
126#if AZA
127 #if AZC
128 #if AZE
129 int selected3 = 1;
130 #elif AZF
131 int selected3 = 2;
132 #else
133 int selected3 = 3;
134 #endif
135 #endif
136#endif
John Kessenich8e789e82013-12-05 21:51:40 +0000137
138// ERROR cases...
139
140#if 0
141int;
142#else
143int;
144#elif 1
145int;
146#endif
147
148#if 0
149int;
150#else
151int;
152#else
153int;
154#endif
155
156#if 0
157 #if 0
158 int;
159 #else
160 int;
161 #elif 1
162 int;
163 #endif
164
165 #if 0
166 int;
167 #else
168 int;
169 #else
170 int;
171 #endif
172#endif
John Kessenichfcb4ed02013-12-30 20:34:28 +0000173
174#define FUNC(a,b) a+b
175void foo985(){ FUNC( (((2))), ((3),4)); }
176// needs to be last test in file
177void foo987(){ FUNC(((); } // ERROR, EOF in argument