glsl: Make a local variable to avoid restating this array lookup.
[mesa.git] / src / glsl / ir_function_detect_recursion.cpp
index 44a1cd0b950be726ad741e9690f6482ecff7abf5..4b39f9724e70a1432f15945920e1110d6c3f2ce0 100644 (file)
 #include "glsl_parser_extras.h"
 #include "linker.h"
 #include "program/hash_table.h"
+#include "program.h"
 
 struct call_node : public exec_node {
    class function *func;
@@ -172,6 +173,7 @@ public:
    has_recursion_visitor()
       : current(NULL)
    {
+      progress = false;
       this->mem_ctx = ralloc_context(NULL);
       this->function_hash = hash_table_ctor(0, hash_table_pointer_hash,
                                            hash_table_pointer_compare);
@@ -216,7 +218,7 @@ public:
       if (this->current == NULL)
         return visit_continue;
 
-      function *const target = this->get_function(call->get_callee());
+      function *const target = this->get_function(call->callee);
 
       /* Create a link from the caller to the callee.
        */
@@ -288,6 +290,8 @@ emit_errors_unlinked(const void *key, void *data, void *closure)
    function *f = (function *) data;
    YYLTYPE loc;
 
+   (void) key;
+
    char *proto = prototype_string(f->sig->return_type,
                                  f->sig->function_name(),
                                  &f->sig->parameters);
@@ -307,13 +311,13 @@ emit_errors_linked(const void *key, void *data, void *closure)
       (struct gl_shader_program *) closure;
    function *f = (function *) data;
 
+   (void) key;
+
    char *proto = prototype_string(f->sig->return_type,
                                  f->sig->function_name(),
                                  &f->sig->parameters);
 
-   linker_error_printf(prog,
-                      "function `%s' has static recursion.\n",
-                      proto);
+   linker_error(prog, "function `%s' has static recursion.\n", proto);
    ralloc_free(proto);
    prog->LinkStatus = false;
 }