diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-11 14:08:33 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-11 14:08:33 -0800 |
commit | 1f585180597290c7891c43dc0da3c9c06d7cebb1 (patch) | |
tree | 9628a03880afbd2fa0c1cac32c6fc7e20cb41067 /glsl_parser_extras.cpp | |
parent | 3821761e45c455374c9fdb4cd02104f420373360 (diff) |
Track generation of errors and halt compilation appropriately
Diffstat (limited to 'glsl_parser_extras.cpp')
-rw-r--r-- | glsl_parser_extras.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index d066ca3cd0..52ae79918a 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -38,13 +38,16 @@ #include "ir_print_visitor.h" void -_mesa_glsl_error(YYLTYPE *locp, void *state, const char *fmt, ...) +_mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state, + const char *fmt, ...) { char buf[1024]; int len; va_list ap; - (void) state; + if (state) + state->error = true; + len = snprintf(buf, sizeof(buf), "%u:%u(%u): error: ", locp->source, locp->first_line, locp->first_column); @@ -709,6 +712,7 @@ main(int argc, char **argv) state.scanner = NULL; make_empty_list(& state.translation_unit); state.symbols = _mesa_symbol_table_ctor(); + state.error = false; _mesa_glsl_lexer_ctor(& state, shader, shader_len); _mesa_glsl_parse(& state); @@ -721,10 +725,13 @@ main(int argc, char **argv) _mesa_ast_to_hir(&instructions, &state); printf("\n\n"); - foreach_iter(exec_list_iterator, iter, instructions) { - ir_print_visitor v; - ((ir_instruction *)iter.get())->accept(& v); + if (!state.error) { + foreach_iter(exec_list_iterator, iter, instructions) { + ir_print_visitor v; + + ((ir_instruction *)iter.get())->accept(& v); + } } _mesa_symbol_table_dtor(state.symbols); |