John Kessenich | 4d6570a | 2013-11-10 23:07:36 +0000 | [diff] [blame] | 1 | #version 400 |
John Kessenich | 38c507e | 2013-02-08 18:56:56 +0000 | [diff] [blame] | 2 | |
John Kessenich | 464f6d9 | 2013-02-06 00:14:16 +0000 | [diff] [blame] | 3 | #define ON |
| 4 | |
| 5 | float sum = 0.0; |
| 6 | |
| 7 | void main() |
| 8 | { |
| 9 | |
| 10 | #ifdef ON |
| 11 | //yes |
| 12 | sum += 1.0; |
| 13 | #endif |
| 14 | |
| 15 | #ifdef OFF |
| 16 | //no |
| 17 | sum += 20.0; |
| 18 | #endif |
| 19 | |
| 20 | #if defined(ON) |
| 21 | //yes |
| 22 | sum += 300.0; |
| 23 | #endif |
| 24 | |
| 25 | #if defined(OFF) |
| 26 | //no |
| 27 | sum += 4000.0; |
| 28 | #endif |
| 29 | |
| 30 | #if !defined(ON) |
| 31 | //no |
| 32 | sum += 50000.0; |
| 33 | #endif |
| 34 | |
John Kessenich | 52ac67e | 2013-05-05 23:46:22 +0000 | [diff] [blame] | 35 | #ifndef OFF |
John Kessenich | 464f6d9 | 2013-02-06 00:14:16 +0000 | [diff] [blame] | 36 | //yes |
| 37 | sum += 600000.0; |
| 38 | #else |
| 39 | //no |
| 40 | sum += 0.6; |
| 41 | #endif |
| 42 | |
| 43 | #if defined(ON) && defined(OFF) |
| 44 | //no |
| 45 | sum += 0.7; |
| 46 | #elif !defined(OFF) |
| 47 | //yes |
| 48 | sum += 7000000.0; |
| 49 | #endif |
| 50 | |
| 51 | #if defined(ON) && !defined(OFF) |
| 52 | //yes |
| 53 | sum += 80000000.0; |
| 54 | #endif |
| 55 | |
| 56 | #if defined(OFF) || defined(ON) |
| 57 | //yes |
| 58 | sum += 900000000.0; |
| 59 | #endif |
| 60 | |
John Kessenich | 52ac67e | 2013-05-05 23:46:22 +0000 | [diff] [blame] | 61 | #if NEVER_DEFINED |
| 62 | //no |
| 63 | sum += 0.04; |
| 64 | #else |
| 65 | sum += 0.05; |
| 66 | #endif |
| 67 | |
John Kessenich | 464f6d9 | 2013-02-06 00:14:16 +0000 | [diff] [blame] | 68 | // sum should be 987600301.7 |
| 69 | gl_Position = vec4(sum); |
| 70 | } |
John Kessenich | ceb0623 | 2013-06-03 04:15:57 +0000 | [diff] [blame] | 71 | |
| 72 | #define A 0 |
John Kessenich | 98434be | 2013-12-02 15:56:38 +0000 | [diff] [blame^] | 73 | # define B 0 |
| 74 | # define C 0 |
John Kessenich | ceb0623 | 2013-06-03 04:15:57 +0000 | [diff] [blame] | 75 | |
| 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 Kessenich | 4d6570a | 2013-11-10 23:07:36 +0000 | [diff] [blame] | 122 | #endif extra tokens |
John Kessenich | fb7044a | 2013-06-13 20:16:43 +0000 | [diff] [blame] | 123 | |
John Kessenich | f78fff9 | 2013-06-13 23:56:04 +0000 | [diff] [blame] | 124 | int linenumber = __LINE__; |
| 125 | int filenumber = __FILE__; |
| 126 | int version = __VERSION__; |
| 127 | |
John Kessenich | 5f1a0b7 | 2013-07-06 19:54:21 +0000 | [diff] [blame] | 128 | #define PI (3.14) |
| 129 | #define TWOPI (2.0 * PI) |
| 130 | float twoPi = TWOPI; |
| 131 | |
John Kessenich | 4d6570a | 2013-11-10 23:07:36 +0000 | [diff] [blame] | 132 | //#define PASTE(a,b) a ## b |
| 133 | //float PASTE(tod, ay) = 17; |
| 134 | |
| 135 | "boo" // ERROR |
| 136 | int 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 |
| 199 | int n = n1; |
| 200 | |
| 201 | #define f1 .08e-2Lf |
| 202 | double f = f1; |
| 203 | |
John Kessenich | 69aa9c1 | 2013-11-12 03:31:24 +0000 | [diff] [blame] | 204 | #undef __VERSION__ |
| 205 | #undef GL_ARB_texture_rectangle |
| 206 | |
John Kessenich | 98434be | 2013-12-02 15:56:38 +0000 | [diff] [blame^] | 207 | # |
| 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 Kessenich | 4d6570a | 2013-11-10 23:07:36 +0000 | [diff] [blame] | 244 | #if 1 |
| 245 | #else |
| 246 | // ERROR, missing #endif |