Check that the return type of function definition matches its prototype.
authorEric Anholt <eric@anholt.net>
Wed, 14 Apr 2010 23:19:19 +0000 (16:19 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 14 Apr 2010 23:19:19 +0000 (16:19 -0700)
Doesn't fix any testcases, but fixes a FINISHME.

ast_to_hir.cpp

index b150ba36908b96e90d8745940530fa8b7356a2c6..251845acd9d12a673043a994a168f5624bcecdaa 100644 (file)
@@ -1864,7 +1864,14 @@ ast_function::hir(exec_list *instructions,
               iter_b.next();
            }
 
-           /* FINISHME: Compare return types. */
+           if (sig->return_type != return_type) {
+              YYLTYPE loc = this->get_location();
+
+              _mesa_glsl_error(& loc, state,
+                               "function `%s' return type doesn't match "
+                               "prototype",
+                               name);
+           }
 
            if (is_definition && (sig->definition != NULL)) {
               YYLTYPE loc = this->get_location();