Mercurial > projects > ldc
comparison dmd2/cond.c @ 1452:638d16625da2
LDC 2 compiles again.
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Sat, 30 May 2009 17:23:32 +0100 |
parents | f04dde6e882c |
children | 54b3c1394d62 |
comparison
equal
deleted
inserted
replaced
1423:42bd767ec5a4 | 1452:638d16625da2 |
---|---|
125 | 125 |
126 void VersionCondition::checkPredefined(Loc loc, const char *ident) | 126 void VersionCondition::checkPredefined(Loc loc, const char *ident) |
127 { | 127 { |
128 static const char* reserved[] = | 128 static const char* reserved[] = |
129 { | 129 { |
130 "DigitalMars", "LLVM", "LDC", "LLVM64", | 130 "DigitalMars", "X86", "X86_64", |
131 "X86", "X86_64", "PPC", "PPC64", | |
132 "Windows", "Win32", "Win64", | 131 "Windows", "Win32", "Win64", |
133 "linux", "darwin", "Posix", | 132 "linux", |
133 #if DMDV2 | |
134 /* Although Posix is predefined by D1, disallowing its | |
135 * redefinition breaks makefiles and older builds. | |
136 */ | |
137 "Posix", | |
138 "D_NET", | |
139 #endif | |
140 "OSX", "FreeBSD", | |
141 "Solaris", | |
134 "LittleEndian", "BigEndian", | 142 "LittleEndian", "BigEndian", |
135 "all", | 143 "all", |
136 "none", | 144 "none", |
145 | |
146 // LDC | |
147 "LLVM", "LDC", "LLVM64", | |
148 "PPC", "PPC64", | |
149 "darwin","solaris","freebsd" | |
137 }; | 150 }; |
138 | 151 |
139 for (unsigned i = 0; i < sizeof(reserved) / sizeof(reserved[0]); i++) | 152 for (unsigned i = 0; i < sizeof(reserved) / sizeof(reserved[0]); i++) |
140 { | 153 { |
141 if (strcmp(ident, reserved[i]) == 0) | 154 if (strcmp(ident, reserved[i]) == 0) |
292 { | 305 { |
293 error(loc, "iftype conditional cannot be at global scope"); | 306 error(loc, "iftype conditional cannot be at global scope"); |
294 inc = 2; | 307 inc = 2; |
295 return 0; | 308 return 0; |
296 } | 309 } |
297 unsigned errors = global.errors; | 310 Type *t = targ->trySemantic(loc, sc); |
298 global.gag++; // suppress printing of error messages | 311 if (t) |
299 targ = targ->semantic(loc, sc); | 312 targ = t; |
300 global.gag--; | 313 else |
301 if (errors != global.errors) // if any errors happened | 314 inc = 2; // condition is false |
302 { inc = 2; // then condition is false | 315 |
303 global.errors = errors; | 316 if (!t) |
317 { | |
304 } | 318 } |
305 else if (id && tspec) | 319 else if (id && tspec) |
306 { | 320 { |
307 /* Evaluate to TRUE if targ matches tspec. | 321 /* Evaluate to TRUE if targ matches tspec. |
308 * If TRUE, declare id as an alias for the specialized type. | 322 * If TRUE, declare id as an alias for the specialized type. |