Warn about "assert X,Y"
[delight/core.git] / dmd2 / cond.h
blob423da461ca55deba467bb81f701f47cfdfe0ce2a
2 // Compiler implementation of the D programming language
3 // Copyright (c) 1999-2006 by Digital Mars
4 // All Rights Reserved
5 // written by Walter Bright
6 // http://www.digitalmars.com
7 // License for redistribution is by either the Artistic License
8 // in artistic.txt, or the GNU General Public License in gnu.txt.
9 // See the included readme.txt for details.
11 #ifndef DMD_DEBCOND_H
12 #define DMD_DEBCOND_H
14 struct Expression;
15 struct Identifier;
16 struct OutBuffer;
17 struct Module;
18 struct Scope;
19 struct ScopeDsymbol;
20 #ifdef _DH
21 #include "lexer.h" // dmdhg
22 #endif
23 enum TOK;
24 #ifdef _DH
25 struct HdrGenState;
26 #endif
28 int findCondition(Array *ids, Identifier *ident);
30 struct Condition
32 Loc loc;
33 int inc; // 0: not computed yet
34 // 1: include
35 // 2: do not include
37 Condition(Loc loc);
39 virtual Condition *syntaxCopy() = 0;
40 virtual int include(Scope *sc, ScopeDsymbol *s) = 0;
41 virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs) = 0;
44 struct DVCondition : Condition
46 unsigned level;
47 Identifier *ident;
48 Module *mod;
50 DVCondition(Module *mod, unsigned level, Identifier *ident);
52 Condition *syntaxCopy();
55 struct DebugCondition : DVCondition
57 static void setGlobalLevel(unsigned level);
58 static void addGlobalIdent(char *ident);
59 static void addPredefinedGlobalIdent(char *ident);
61 DebugCondition(Module *mod, unsigned level, Identifier *ident);
63 int include(Scope *sc, ScopeDsymbol *s);
64 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
67 struct VersionCondition : DVCondition
69 static void setGlobalLevel(unsigned level);
70 static void checkPredefined(Loc loc, char *ident);
71 static void addGlobalIdent(char *ident);
72 static void addPredefinedGlobalIdent(char *ident);
74 VersionCondition(Module *mod, unsigned level, Identifier *ident);
76 int include(Scope *sc, ScopeDsymbol *s);
77 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
80 struct StaticIfCondition : Condition
82 Expression *exp;
84 StaticIfCondition(Loc loc, Expression *exp);
85 Condition *syntaxCopy();
86 int include(Scope *sc, ScopeDsymbol *s);
87 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
90 struct IftypeCondition : Condition
92 /* iftype (targ id tok tspec)
94 Type *targ;
95 Identifier *id; // can be NULL
96 enum TOK tok; // ':' or '=='
97 Type *tspec; // can be NULL
99 IftypeCondition(Loc loc, Type *targ, Identifier *id, enum TOK tok, Type *tspec);
100 Condition *syntaxCopy();
101 int include(Scope *sc, ScopeDsymbol *s);
102 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
106 #endif