Mesa (master): ir_reader: Track the current function and report it in error messages.

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Sep 4 09:21:00 UTC 2010


Module: Mesa
Branch: master
Commit: a71b46a8ad344a86de2b13fe0c283ac2036c5f76
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a71b46a8ad344a86de2b13fe0c283ac2036c5f76

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Sep  4 01:05:51 2010 -0700

ir_reader: Track the current function and report it in error messages.

---

 src/glsl/ir_reader.cpp |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index e57e03c..41bfc8a 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -94,6 +94,10 @@ ir_read_error(_mesa_glsl_parse_state *state, s_expression *expr,
 
    state->error = true;
 
+   if (state->current_function != NULL)
+      state->info_log = talloc_asprintf_append(state->info_log,
+			   "In function %s:\n",
+			   state->current_function->function_name());
    state->info_log = talloc_strdup_append(state->info_log, "error: ");
 
    va_start(ap, fmt);
@@ -310,7 +314,9 @@ read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list,
 	 ir_read_error(st, list, "function %s redefined", f->name);
 	 return;
       }
+      st->current_function = sig;
       read_instructions(st, &sig->body, body_list, NULL);
+      st->current_function = NULL;
       sig->is_defined = true;
    }
 




More information about the mesa-commit mailing list