From: Matt Turner <matts...@gmail.com> Reviewed-by: Kenneth Graunke <kenn...@whitecape.org> (cherry picked from commit fcaa48d9cc8937e0ceb59dfd22ef5b6e6fd1a273)
Conflicts (resolved by Carl Worth <cwo...@cworth.org>): src/glsl/ast_to_hir.cpp CC: mesa-sta...@lists.freedesktop.org --- src/glsl/ast_to_hir.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index c5197d5..87420c6 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -3516,7 +3516,24 @@ ast_jump_statement::hir(exec_list *instructions, ret_type->name, state->current_function->function_name(), state->current_function->return_type->name); - } + + } else if (state->current_function->return_type->base_type == + GLSL_TYPE_VOID) { + YYLTYPE loc = this->get_location(); + + /* The ARB_shading_language_420pack, GLSL ES 3.0, and GLSL 4.20 + * specs add a clarification: + * + * "A void function can only use return without a return argument, even if + * the return argument has void type. Return statements only accept values: + * + * void func1() { } + * void func2() { return func1(); } // illegal return statement" + */ + _mesa_glsl_error(& loc, state, + "void functions can only use `return' without a " + "return argument"); + } inst = new(ctx) ir_return(ret); } else { -- 1.8.3.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev