On Tue, 12 Apr 2011 00:36:59 -0700, Kenneth Graunke <kenn...@whitecape.org> wrote: > Lots of code (deleted in this patch) tried to make type == result->type, > but not all cases did. Don't pretend; just use result->type. > --- > src/glsl/ast_to_hir.cpp | 23 ++++------------------- > 1 files changed, 4 insertions(+), 19 deletions(-) > > Why, so it does! Good catch. Of course, "type" is silly. This patch > starts the process of cleaning up some of the pointless cases. There's > probably more that could be done - for example, the cases that call > unary_arithmetic_result_type and completely ignore the type returned > (they just use it for the error checking). But meh for now. > > IMHO the only real reason for 'type' to exist is to have a temporary > available without having to use { } around case clauses. > > If you like this patch I can rebase Eric's changes on top of it.
I'm totally willing to rebase onto this -- I've pulled in the r-bs and typo fixes already. > @@ -1685,16 +1670,16 @@ ast_expression::hir(exec_list *instructions, > foreach_list_typed (ast_node, ast, link, &this->expressions) > result = ast->hir(instructions, state); > > - type = result->type; > - > /* Any errors should have already been emitted in the loop above. > */ > error_emitted = true; > break; > } > } > + type = NULL; /* use result->type, not type. */ > + assert(result != NULL); > > - if (type->is_error() && !error_emitted) > + if (result->type->is_error() && !error_emitted) > _mesa_glsl_error(& loc, state, "type mismatch"); > > return result; I'd drop the dead assignment to type here, myself, but other than that it's Reviewed-by: Eric Anholt <e...@anholt.net>
pgpwLgYiYZDXa.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev