Front-end: Fix known crashes by early exit on error (issue #29, issue #34, issue #35).
Added -C option to request cascading errors. By default, will exit early,
to avoid all error-recovery-based crashes.
This works by simulating end-of-file in input on first error, so no
need for exception handling, or stack unwinding, or any complex error
checking/handling to get out of the stack.
diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h
index ea74d41..8dffb80 100644
--- a/gtests/TestFixture.h
+++ b/gtests/TestFixture.h
@@ -264,8 +264,7 @@
tryLoadFile(expectedOutputFname, "expected output", &expectedOutput);
const EShMessages controls = DeriveOptions(source, semantics, target);
- GlslangResult result =
- compileAndLink(testName, input, entryPointName, controls);
+ GlslangResult result = compileAndLink(testName, input, entryPointName, controls);
// Generate the hybrid output in the way of glslangValidator.
std::ostringstream stream;
@@ -290,7 +289,7 @@
glslang::TShader::ForbidInclude includer;
const bool success = shader.preprocess(
&glslang::DefaultTBuiltInResource, defaultVersion, defaultProfile,
- forceVersionProfile, isForwardCompatible, EShMsgOnlyPreprocessor,
+ forceVersionProfile, isForwardCompatible, (EShMessages)(EShMsgOnlyPreprocessor | EShMsgCascadingErrors),
&ppShader, includer);
std::string log = shader.getInfoLog();