Re: [Mesa-dev] [PATCH 3/5 v2] glsl: Restrict func redeclarations (not just redefinitions) on GLSL 1.00.

2017-05-03 Thread Matt Turner
Thanks. This patch has no regressions.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/5 v2] glsl: Restrict func redeclarations (not just redefinitions) on GLSL 1.00.

2017-05-03 Thread Eric Anholt
Fixes DEQP's scoping.invalid.redeclare_function_fragment/vertex.

v2: Fix accidental rejection of prototype+decl.

Reviewed-by: Samuel Pitoiset 
---

Thanks for testing!  Here's a new version with that fixed.  Piglit
series covering this regression and more, to follow.

 src/compiler/glsl/ast_to_hir.cpp | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 4281fcef2da8..05e8afac0907 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -5712,6 +5712,16 @@ ast_function::hir(exec_list *instructions,
 */
return NULL;
 }
+ } else if (state->language_version == 100 && !is_definition) {
+/* From the GLSL 1.00 spec, section 4.2.7:
+ *
+ * "A particular variable, structure or function declaration
+ *  may occur at most once within a scope with the exception
+ *  that a single function prototype plus the corresponding
+ *  function definition are allowed."
+ */
+YYLTYPE loc = this->get_location();
+_mesa_glsl_error(, state, "function `%s' redeclared", name);
  }
   }
}
-- 
2.11.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev