• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 300 es
2#define ON1
3#define ON2
4float sum = 0.0;
5
6void main()
7{
8#if defined(ON1) && (defined(OFF) || defined(ON2))
9//yes
10    sum += 1.0;
11#endif
12
13#if !defined(ON1) || (defined(OFF) || (!defined(OFF2) && defined(ON2)))
14//yes
15    sum += 20.0;
16#endif
17
18#if defined(ON1) && (defined(OFF) || !defined(ON2))
19//no
20    sum += 0.1;
21#endif
22
23#if !defined(ON1) || (defined(OFF) || !defined(OFF2) && !defined(ON2))
24//no
25    sum += 0.2;
26#endif
27
28#if !defined(ON1) || !defined(OFF) || defined(ON2) && defined(OFF2)
29//yes
30    sum += 300.0;
31#endif
32
33#if (!defined(ON1) || !defined(OFF) || defined(ON2)) && defined(OFF2)
34//no
35    sum += 0.4;
36#endif
37
38// sum should be 321.0
39    gl_Position = vec4(sum);
40}
41
42#define ADD(a, b) a + b + ((a) + ((b)));
43
44float foo()
45{
46    return ADD(gl_Position.xyxwx, 3.0)  // ERROR, should be this line number
47    return ADD(gl_Position.y, 3.0)
48}
49
50#define BIG aonetuhanoethuanoenaoethu snaoetuhs onethausoentuas hnoethaueohnatuoeh santuoehsantouhe snathoensuta hsnoethuasntoe hsnuathoesnuathoenstuh nsoethantseuh toae ua \
51    antoeh uantheount oentahoent uahnsoethasnutoehansteuo santhu sneoathu snoethasnut oesanthoesna thusenotha nsthasunoeth ausntehsunathoensuathoesnta uhnsoetha usntoeh uanhs unosethu \
52    antoehunatoehu natoehua oentha neotuhan toehu natoehu ntahoe nutah eu natoheunathoen uasoenuasoent asntoehsan tuosnthnu aohenuath eontha untoh eunth unth anth unth nth nth nt \
53    a ntoehanu tunth nsont uhansoethausn oehsanthnt heauo eanthuo sh nahnoethansu tohe sanuthoe snathuoesntha snuothe anthusonehtasuntoeh asnuthonsa teauhntoeha onetuha nth \
54    anoethuan toentauh noethauntohe anuthoe nathu noethaun oethanuthoe nathuoe ntahu enotha unetha ntuhenaothu enotahun eotha ntoehu aoehuntha enotuh aonethau noethu anoethuna toheua \
55    ontehanutoe hnuathoena aoteha aonetuha
56
57// identical
58#define BIG aonetuhanoethuanoenaoethu snaoetuhs onethausoentuas hnoethaueohnatuoeh santuoehsantouhe snathoensuta hsnoethuasntoe hsnuathoesnuathoenstuh nsoethantseuh toae ua \
59    antoeh uantheount oentahoent uahnsoethasnutoehansteuo santhu sneoathu snoethasnut oesanthoesna thusenotha nsthasunoeth ausntehsunathoensuathoesnta uhnsoetha usntoeh uanhs unosethu \
60    antoehunatoehu natoehua oentha neotuhan toehu natoehu ntahoe nutah eu natoheunathoen uasoenuasoent asntoehsan tuosnthnu aohenuath eontha untoh eunth unth anth unth nth nth nt \
61    a ntoehanu tunth nsont uhansoethausn oehsanthnt heauo eanthuo sh nahnoethansu tohe sanuthoe snathuoesntha snuothe anthusonehtasuntoeh asnuthonsa teauhntoeha onetuha nth \
62    anoethuan toentauh noethauntohe anuthoe nathu noethaun oethanuthoe nathuoe ntahu enotha unetha ntuhenaothu enotahun eotha ntoehu aoehuntha enotuh aonethau noethu anoethuna toheua \
63    ontehanutoe hnuathoena aoteha aonetuha
64
65// ERROR, one character different
66#define BIG aonetuhanoethuanoenaoethu snaoetuhs onethausoentuas hnoethaueohnatuoeh santuoehsantouhe snathoensuta hsnoethuasntoe hsnuathoesnuathoenstuh nsoethantseuh toae ua \
67    antoeh uantheount oentahoent uahnsoethasnutoehansteuo santhu sneoathu snoethasnut oesanthoesna thusenotha nsthasunoeth ausntehsunathoensuathoesnta uhnsoetha usntoeh uanhs unosethu \
68    antoehunatoehu natoehua oentha neotuhan toehu natoehu ntahoe nutah eu natoheunathoen uasoenuasoent asntoehsan tuosnthnu aohenuath eontha untoh eunth unth anth unth nth nth nt \
69    a ntoehanu tunth nsont uhansoethasn oehsanthnt heauo eanthuo sh nahnoethansu tohe sanuthoe snathuoesntha snuothe anthusonehtasuntoeh asnuthonsa teauhntoeha onetuha nth \
70    anoethuan toentauh noethauntohe anuthoe nathu noethaun oethanuthoe nathuoe ntahu enotha unetha ntuhenaothu enotahun eotha ntoehu aoehuntha enotuh aonethau noethu anoethuna toheua \
71    ontehanutoe hnuathoena aoteha aonetuha
72
73#define BIGARGS1(aonthanotehu, bonthanotehu, conthanotehu, donthanotehu, eonthanotehu, fonthanotehu, gonthanotehu, honthanotehu, ionthanotehu, jonthanotehu, konthanotehu) jonthanotehu
74#define BIGARGS2(aonthanotehu, bonthanotehu, conthanotehu, donthanotehu, eonthanotehu, fonthanotehu, gonthanotehu, honthanotehu, ionthanotehu, jonthanotehu, konthanotehu) jonthanotehu
75#define BIGARGS3(aonthanotehu, bonthanotehu, conthanotehu, donthanotehu, eonthanotehu, fonthanotehu, gonthanotehu, honthanotehu, ionthanotehu, jonthanotehu, konthanotehu) jonthanotehu
76#define BIGARGS4(aonthanotehu, bonthanotehu, conthanotehu, donthanotehu, eonthanotehu, fonthanotehu, gonthanotehu, honthanotehu, ionthanotehu, jonthanotehu, konthanotehu) jonthanotehu
77
78
79#define foobar(a, b) a + b
80
81#if foobar(1.1, 2.2)
82#error good macro
83#else
84#error bad macro
85#endif
86
87#if foobar(1
88;
89#
90#
91#endif
92#if foobar(1,
93;
94#
95#
96#endif
97float c = foobar(1.1, 2.2
98       );
99#if foobar(1.1, 2.2
100)
101#if foobar(1.1, 2.2
102#endif
103#endif
104
105#define VAL0 0
106#define VAL1 1
107
108#if UNDEF
109#error bad 0
110#else
111#error good 0
112#endif
113
114#if VAL1 || UNDEF
115#error good 1
116#else
117#error bad 1
118#endif
119
120#if VAL1 && UNDEF // UNDEF ERROR
121#endif
122
123#if VAL0 || UNDEF // UNDEF ERROR
124#endif
125
126#if VAL0 && UNDEF
127#error bad 2
128#else
129#error good 1
130#endif
131
132#if VAL1 || (VAL1 && UNDEF)
133#error good 3
134#else
135#error bad 3
136#endif
137
138#if VAL1 && (VAL1 || UNDEF)
139#error good 4
140#else
141#error bad 4
142#endif
143
144#if VAL1 < VAL1 || VAL1 > VAL1 || UNDEF // UNDEF ERROR
145#endif
146
147#if VAL1 < VAL1 || VAL1 > VAL1 && UNDEF
148#endif
149
150#if VAL1 || UNDEF && UNDEF2
151#endif
152
153#if VAL0 || UNDEF && UNDEF2  // UNDEF ERROR
154#endif
155
156#if (VAL1 || UNDEF) && UNDEF2 // UNDEF2 ERROR
157#endif
158
159#if (VAL0 && UNDEF) || UNDEF2 // UNDEF2 ERROR
160#endif
161
162#line 3000
163#error line of this error should be 3000
164
165#define __LINE__ 30
166#define __FILE__
167#define __VERSION__
168#define GL_SOME_EXTENSION
169#undef __LINE__
170#undef __FILE__
171#undef __VERSION__
172#undef GL_SOME_EXTENSION
173
174#line 4000
175#line 200 % 0     // ERROR, div by 0
176#if __LINE__ / 0  // ERROR, div by 0
177#endif
178
179#if 7%            // ERROR incomplete expression
180
181#line 10000
182#if 0
183// ERROR, EOF