Check that function definition parameter qualifiers match proto qualifiers.
authorEric Anholt <eric@anholt.net>
Wed, 14 Apr 2010 23:16:20 +0000 (16:16 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 14 Apr 2010 23:18:19 +0000 (16:18 -0700)
Fixes function9.frag.

ast_to_hir.cpp

index 4e1c819..b150ba3 100644 (file)
@@ -1841,6 +1841,29 @@ ast_function::hir(exec_list *instructions,
          * definition.
          */
         if (parameter_lists_match(& hir_parameters, & sig->parameters)) {
+           exec_list_iterator iter_a = hir_parameters.iterator();
+           exec_list_iterator iter_b = sig->parameters.iterator();
+
+           /* check that the qualifiers match. */
+           while (iter_a.has_next()) {
+              ir_variable *a = (ir_variable *)iter_a.get();
+              ir_variable *b = (ir_variable *)iter_b.get();
+
+              if (a->read_only != b->read_only ||
+                  a->interpolation != b->interpolation ||
+                  a->centroid != b->centroid) {
+                 YYLTYPE loc = this->get_location();
+
+                 _mesa_glsl_error(& loc, state,
+                                  "function `%s' parameter `%s' qualifiers "
+                                  "don't match prototype",
+                                  name, a->name);
+              }
+
+              iter_a.next();
+              iter_b.next();
+           }
+
            /* FINISHME: Compare return types. */
 
            if (is_definition && (sig->definition != NULL)) {