Mercurial > projects > ldc
comparison dmd/cond.c @ 1103:b30fe7e1dbb9
- Updated to DMD frontend 1.041.
- Removed dmd/inifile.c , it's not under a free license, replaced with libconfig based config file.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Thu, 12 Mar 2009 20:37:27 +0100 |
parents | 2137797748a8 |
children | e961851fb8be |
comparison
equal
deleted
inserted
replaced
1102:ae950bd712d3 | 1103:b30fe7e1dbb9 |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | 2 // Compiler implementation of the D programming language |
3 // Copyright (c) 1999-2006 by Digital Mars | 3 // Copyright (c) 1999-2008 by Digital Mars |
4 // All Rights Reserved | 4 // All Rights Reserved |
5 // written by Walter Bright | 5 // written by Walter Bright |
6 // http://www.digitalmars.com | 6 // http://www.digitalmars.com |
7 // License for redistribution is by either the Artistic License | 7 // License for redistribution is by either the Artistic License |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | 8 // in artistic.txt, or the GNU General Public License in gnu.txt. |
29 { | 29 { |
30 if (ids) | 30 if (ids) |
31 { | 31 { |
32 for (int i = 0; i < ids->dim; i++) | 32 for (int i = 0; i < ids->dim; i++) |
33 { | 33 { |
34 char *id = (char *)ids->data[i]; | 34 const char *id = (const char *)ids->data[i]; |
35 | 35 |
36 if (strcmp(id, ident->toChars()) == 0) | 36 if (strcmp(id, ident->toChars()) == 0) |
37 return TRUE; | 37 return TRUE; |
38 } | 38 } |
39 } | 39 } |
73 | 73 |
74 void DebugCondition::addGlobalIdent(const char *ident) | 74 void DebugCondition::addGlobalIdent(const char *ident) |
75 { | 75 { |
76 if (!global.params.debugids) | 76 if (!global.params.debugids) |
77 global.params.debugids = new Array(); | 77 global.params.debugids = new Array(); |
78 global.params.debugids->push((void*)ident); | 78 global.params.debugids->push((void *)ident); |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 DebugCondition::DebugCondition(Module *mod, unsigned level, Identifier *ident) | 82 DebugCondition::DebugCondition(Module *mod, unsigned level, Identifier *ident) |
83 : DVCondition(mod, level, ident) | 83 : DVCondition(mod, level, ident) |
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", "Posix", "OSX", "FreeBSD", |
134 "LittleEndian", "BigEndian", | 133 "LittleEndian", "BigEndian", |
135 "all", | 134 "all", |
136 "none", | 135 "none", |
136 | |
137 // LDC | |
138 "LLVM", "LDC", "LLVM64", | |
139 "PPC", "PPC64", | |
140 "darwin", | |
137 }; | 141 }; |
138 | 142 |
139 for (unsigned i = 0; i < sizeof(reserved) / sizeof(reserved[0]); i++) | 143 for (unsigned i = 0; i < sizeof(reserved) / sizeof(reserved[0]); i++) |
140 { | 144 { |
141 if (strcmp(ident, reserved[i]) == 0) | 145 if (strcmp(ident, reserved[i]) == 0) |
159 | 163 |
160 void VersionCondition::addPredefinedGlobalIdent(const char *ident) | 164 void VersionCondition::addPredefinedGlobalIdent(const char *ident) |
161 { | 165 { |
162 if (!global.params.versionids) | 166 if (!global.params.versionids) |
163 global.params.versionids = new Array(); | 167 global.params.versionids = new Array(); |
164 global.params.versionids->push((void*)ident); | 168 global.params.versionids->push((void *)ident); |
165 } | 169 } |
166 | 170 |
167 | 171 |
168 VersionCondition::VersionCondition(Module *mod, unsigned level, Identifier *ident) | 172 VersionCondition::VersionCondition(Module *mod, unsigned level, Identifier *ident) |
169 : DVCondition(mod, level, ident) | 173 : DVCondition(mod, level, ident) |