Implicitly define GL_ES
TRAC #12257
Signed-off-by: Andrew Lewycky
Signed-off-by: Daniel Koch
Author: Nicolas Capens
git-svn-id: https://angleproject.googlecode.com/svn/trunk@284 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/preprocessor/cpp.c b/src/compiler/preprocessor/cpp.c
index a8e22f3..588660d 100644
--- a/src/compiler/preprocessor/cpp.c
+++ b/src/compiler/preprocessor/cpp.c
@@ -98,6 +98,12 @@
{
char buffer[64], *t;
const char *f;
+
+ SourceLoc location = {0};
+ Symbol *symbol;
+ MacroSymbol macro = {0};
+ yystypepp one = {0};
+
// Add various atoms needed by the CPP line scanner:
bindAtom = LookUpAddString(atable, "bind");
constAtom = LookUpAddString(atable, "const");
@@ -129,6 +135,15 @@
while ((isalnum(*f) || *f == '_') && t < buffer + sizeof(buffer) - 1)
*t++ = toupper(*f++);
*t = 0;
+
+ // #define GL_ES 1
+ macro.body = NewTokenStream("GL_ES", macros->pool);
+ one.sc_int = 1;
+ strcpy(one.symbol_name, "1");
+ RecordToken(macro.body, CPP_INTCONSTANT, &one);
+ symbol = AddSymbol(&location, macros, gl_esAtom, MACRO_S);
+ symbol->details.mac = macro;
+
return 1;
} // InitCPP
@@ -902,12 +917,6 @@
UngetToken(CPP_INTCONSTANT, yylvalpp);
return 1;
}
- if (atom == gl_esAtom) {
- strcpy(yylvalpp->symbol_name,"1");
- yylvalpp->sc_int = 1;
- UngetToken(CPP_INTCONSTANT, yylvalpp);
- return 1;
- }
if (!sym || sym->details.mac.undef) return 0;
if (sym->details.mac.busy) return 0; // no recursive expansions
in = malloc(sizeof(*in));