blob: 73604e20b6f7699afdb6648717e3e2aa3ef54273 [file] [log] [blame]
John Kessenich4d6570a2013-11-10 23:07:36 +00001#version 400
John Kessenich38c507e2013-02-08 18:56:56 +00002
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#endif
14
15#ifdef OFF
16//no
17sum += 20.0;
18#endif
19
20#if defined(ON)
21//yes
22sum += 300.0;
23#endif
24
25#if defined(OFF)
26//no
27sum += 4000.0;
28#endif
29
30#if !defined(ON)
31//no
32sum += 50000.0;
33#endif
34
John Kessenich52ac67e2013-05-05 23:46:22 +000035#ifndef OFF
John Kessenich464f6d92013-02-06 00:14:16 +000036//yes
37sum += 600000.0;
38#else
39//no
40sum += 0.6;
41#endif
42
43#if defined(ON) && defined(OFF)
44//no
45sum += 0.7;
46#elif !defined(OFF)
47//yes
48sum += 7000000.0;
49#endif
50
51#if defined(ON) && !defined(OFF)
52//yes
53sum += 80000000.0;
54#endif
55
56#if defined(OFF) || defined(ON)
57//yes
58sum += 900000000.0;
59#endif
60
John Kessenich52ac67e2013-05-05 23:46:22 +000061#if NEVER_DEFINED
62//no
63sum += 0.04;
64#else
65sum += 0.05;
66#endif
67
John Kessenich464f6d92013-02-06 00:14:16 +000068// sum should be 987600301.7
69 gl_Position = vec4(sum);
70}
John Kessenichceb06232013-06-03 04:15:57 +000071
72#define A 0
John Kessenich98434be2013-12-02 15:56:38 +000073# define B 0
74 # define C 0
John Kessenichceb06232013-06-03 04:15:57 +000075
76#if (A == B) || (A == C)
77#error good1
78#endif
79
80#if A == B || (A == C)
81#error good2
82#endif
83
84#if (A == B || (A == C))
85#error good3
86#endif
87
88#if (AA == BB) || (AA == CC)
89#error good4
90#endif
91
92#if AA == BB || (AA == CC)
93#error good5
94#endif
95
96#if ((AA == BB || (AA == CC)))
97#error good6
98#endif
99
100#if (A == B || (A == C)
101#error bad1
102#endif
103
104#if A == B || A == C)
105#error bad2
106#endif
107
108#if (A == B || (A == C)
109#error bad3
110#endif
111
112#if AA == BB) || (AA == CC)
113#error bad4
114#endif
115
116#if AA == BB || (AA == CC
117#error bad5
118#endif
119
120#if ((AA == BB || (AA == CC))))
121#error bad6
John Kessenich4d6570a2013-11-10 23:07:36 +0000122#endif extra tokens
John Kessenichfb7044a2013-06-13 20:16:43 +0000123
John Kessenichf78fff92013-06-13 23:56:04 +0000124int linenumber = __LINE__;
125int filenumber = __FILE__;
126int version = __VERSION__;
127
John Kessenich5f1a0b72013-07-06 19:54:21 +0000128#define PI (3.14)
129#define TWOPI (2.0 * PI)
130float twoPi = TWOPI;
131
John Kessenich4d6570a2013-11-10 23:07:36 +0000132//#define PASTE(a,b) a ## b
133//float PASTE(tod, ay) = 17;
134
135"boo" // ERROR
136int a = length("aoenatuh"); // ERROR
137
138'int'; // ERROR
139
140// ERROR: all the following are reserved
141#define GL_
142#define GL_Macro 1
143#define __M
144#define M__
145#define ABC__DE abc
146
147#if 4
148#else extra
149#elif
150// ERROR elif after else
151#endif
152
153#if blah
154 #if 0
155 #else extra
156 #ifdef M
157 #else
158 #else
159 // ERROR else after else
160 #endif extra
161 #endif
162#endif
163
164#define m1(a,a) // ERROR
165#define m2(a,b)
166
167// okay
168#define m3 (a)
169#define m3 (a)
170
171// ERROR
172#define m4(b)
173#define m4 (b)
174
175// ERROR
176#define m5 (b)
177#define m5(b)
178
179// ERROR
180#define m6(a)
181#define m6
182
183// ERROR (whitespace)
184#define m7 (a)
185#define m7 ( a)
186
187#define m80(a,b) is + exactly m3 the same
188#define m80(a,b) is + exactly m3 the same
189
190// ERROR
191#define m8(a,b) almost + exactly m3 the same
192#define m8(a,b) almost + exactly m3 thee same
193
194// ERROR
195#define m9(a,b,c) aoe
196#define m9(a,d,c) aoe
197
198#define n1 0xf
199int n = n1;
200
201#define f1 .08e-2Lf
202double f = f1;
203
John Kessenich69aa9c12013-11-12 03:31:24 +0000204#undef __VERSION__
205#undef GL_ARB_texture_rectangle
206
John Kessenich98434be2013-12-02 15:56:38 +0000207#
208 #
209 #
210##
211# #
212# 0x25
213####
214####ff
215#########ff fg 0x25
216#pragma
217#pragma(aoent)
218 # pragma
219#pragma STDGL
220#pragma optimize( on)
221#pragma optimize(off)
222#pragma debug( on)
223#pragma debug(off )
224#pragma optimize( on) anoteun
225#pragma optimize(off
226#pragma debug( on) (
227#pragma debug(off aoeua)
228#pragma optimize( on)
229#pragma optimize(off,)
230#pragma debug( on, aoeu)
231#pragma debugoff )
232#pragma aontheu natoeh uantheo uasotea noeahuonea uonethau onethuanoeth aunotehau noeth anthoeua anoethuantoeh uantoehu natoehu naoteh unotaehu noethua onetuh aou
233# \
234
235# \
236 error good continuation
237
238#flizbit
239
240#define directive error
241
242#directive directive was expanded
243
John Kessenich4d6570a2013-11-10 23:07:36 +0000244#if 1
245#else
246// ERROR, missing #endif