for (int i = 0; i < 1000; ++i) {
for (int j = 0; j < 100; ++j)
#endif
- ret = ShCompile(compiler, data, OutputMultipleStrings, EShOptNone, resources, debugOptions, 100, false, false);
+ ret = ShCompile(compiler, data, OutputMultipleStrings, EShOptNone, resources, debugOptions, 100, false, EShMsgDefault);
#ifdef MEASURE_MEMORY
GetProcessMemoryInfo(GetCurrentProcess(), &counters, sizeof(counters));
#include <stdarg.h>
TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, int v, EProfile p, EShLanguage L, TInfoSink& is,
- bool fc, bool rc) :
+ bool fc, EShMessages m) :
intermediate(interm), symbolTable(symt), infoSink(is), language(L), treeRoot(0),
recoveredFromError(false), numErrors(0), lexAfterType(false), loopNestingLevel(0),
switchNestingLevel(0), inTypeParen(false),
- version(v), profile(p), forwardCompatible(fc), relaxedChecking(rc),
+ version(v), profile(p), forwardCompatible(fc), messages(m),
contextPragma(true, false)
{
for (int type = 0; type < EbtNumTypes; ++type)
//
struct TParseContext {
TParseContext(TSymbolTable&, TIntermediate&, int version, EProfile, EShLanguage, TInfoSink&,
- bool forwardCompatible = false, bool relaxedChecking = false);
+ bool forwardCompatible = false, EShMessages messages = EShMsgDefault);
TIntermediate& intermediate; // to hold and build a parse tree
TSymbolTable& symbolTable; // symbol table that goes with the current language, version, and profile
TInfoSink& infoSink;
int version; // version, updated by #version in the shader
EProfile profile; // the declared profile in the shader (core by default)
bool forwardCompatible; // true if errors are to be given for use of deprecated features
- bool relaxedChecking; // suppress warnings and reduce error checking
+ EShMessages messages; // errors/warnings
bool futureCompatibility; // true if requesting errors for future compatibility (false by default)
TMap<TString, TBehavior> extensionBehavior; // for each extension string, what it's current enablement is
int debugOptions,
int defaultVersion, // use 100 for ES environment, 110 for desktop
bool forwardCompatible, // give errors for use of deprecated features
- bool relaxedChecking // no warnings, reduced errors
+ EShMessages messages // warnings/errors
)
{
if (!InitThread())
// they get popped again further down.
AddContextSpecificSymbols(resources, compiler->infoSink, &symbolTable, version, profile, compiler->getLanguage());
- TParseContext parseContext(symbolTable, intermediate, version, profile, compiler->getLanguage(), compiler->infoSink, forwardCompatible, relaxedChecking);
+ TParseContext parseContext(symbolTable, intermediate, version, profile, compiler->getLanguage(), compiler->infoSink, forwardCompatible, messages);
if (! goodProfile)
parseContext.error(1, "incorrect", "#version", "");
if (forwardCompatible) {
error(line, "deprecated, may be removed in future release", featureDesc, "");
recover();
- } else if (! relaxedChecking) {
+ } else if (! (messages & EShMsgSuppressWarnings)) {
infoSink.info.message(EPrefixWarning, (TString(featureDesc) + " deprecated in version " +
String(depVersion) + "; may be removed in future release").c_str(), line);
}
\r
pyylval->lex.line = line;\r
pyylval->lex.string = NewPoolTString(text);\r
- if (pc.futureCompatibility) {\r
+ if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) {\r
pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
pc.infoSink.info.message(EPrefixWarning, "using future reserved keyword", yylineno);\r
}\r
pc.profile != EEsProfile && pc.version < version) {\r
pyylval->lex.line = yylineno;\r
pyylval->lex.string = NewPoolTString(yytext);\r
- if (pc.futureCompatibility) {\r
+ if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) {\r
pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
pc.infoSink.info.message(EPrefixWarning, "future reserved word in ES 300 and keyword in GLSL", yylineno);\r
}\r
\r
pyylval->lex.line = line;\r
pyylval->lex.string = NewPoolTString(text);\r
- if (pc.futureCompatibility) {\r
+ if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) {\r
pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
pc.infoSink.info.message(EPrefixWarning, "using ES precision qualifier keyword", yylineno);\r
}\r
\r
pyylval->lex.line = line;\r
pyylval->lex.string = NewPoolTString(text);\r
- if (pc.futureCompatibility) {\r
+ if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) {\r
pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
pc.infoSink.info.message(EPrefixWarning, "using future non-square matrix type keyword", yylineno);\r
}\r
\r
pyylval->lex.line = line;\r
pyylval->lex.string = NewPoolTString(text);\r
- if (pc.futureCompatibility) {\r
+ if (pc.futureCompatibility && ! (pc.messages & EShMsgSuppressWarnings)) {\r
pc.infoSink.info.message(EPrefixWarning, pyylval->lex.string->c_str(), yylineno);\r
pc.infoSink.info.message(EPrefixWarning, "using future type keyword", yylineno);\r
}\r
{\r
TParseContext& pc = *((TParseContext *)cpp->pC);\r
\r
- if (! pc.relaxedChecking)\r
+ if (! (pc.messages & EShMsgSuppressWarnings))\r
pc.infoSink.info.message(EPrefixWarning, msg, yylineno);\r
}\r
\r
} EShOptimizationLevel;
//
+// Message choices for what errors and warnings are given.
+//
+enum EShMessages {
+ EShMsgDefault = 0, // default is to give all required errors and extra warnings
+ EShMsgRelaxedErrors = (1 << 0), // be liberal in accepting input
+ EShMsgSuppressWarnings = (1 << 1) // suppress all warnings, except those required by the specification
+};
+
+//
// Build a table for bindings. This can be used for locating
// attributes, uniforms, globals, etc., as needed.
//
const EShOptimizationLevel,
const TBuiltInResource *resources,
int debugOptions,
- int defaultVersion = 110, // use 100 for ES environment, overridden by #version in shader
- bool forwardCompatible = false, // give errors for use of deprecated features
- bool relaxedChecking = false // no warnings, reduced errors
+ int defaultVersion = 110, // use 100 for ES environment, overridden by #version in shader
+ bool forwardCompatible = false, // give errors for use of deprecated features
+ EShMessages messages = EShMsgDefault // warnings and errors
);