diff options
author | Eric Anholt <eric@anholt.net> | 2010-03-30 23:23:16 -1000 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-03-30 23:28:17 -1000 |
commit | ab79d4ec6e7c5639084f71f93857f39239e8b848 (patch) | |
tree | 7a33d150db2c21de4affaf5a6febbd90c25ed958 /ast_to_hir.cpp | |
parent | 794ea61006142b794ccd277af9ac044aa63d6fcb (diff) |
Test that a void function doesn't return a value.
Fixes function1.frag.
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r-- | ast_to_hir.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index 5162acea4e..fbadd40318 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -1549,9 +1549,16 @@ ast_jump_statement::hir(exec_list *instructions, ir_return *inst; if (opt_return_value) { - /* FINISHME: Make sure the enclosing function has a non-void return - * FINISHME: type. - */ + assert(state->current_function); + if (state->current_function->return_type->base_type == + GLSL_TYPE_VOID) { + YYLTYPE loc = this->get_location(); + + _mesa_glsl_error(& loc, state, + "`return` with a value, in function `%s' " + "returning void", + state->current_function->definition->label); + } ir_expression *const ret = (ir_expression *) opt_return_value->hir(instructions, state); |