mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
glsl: raise warning when using uninitialized variables
v2: * Take into account out varyings too (Timothy Arceri) * Fix style (Timothy Arceri) * Use a new ast_expression variable, instead of an ast_expression::hir new parameter (Timothy Arceri) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94129 Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
This commit is contained in:
parent
8568d02498
commit
dcd41ca87a
1 changed files with 7 additions and 0 deletions
|
|
@ -1901,6 +1901,13 @@ ast_expression::do_hir(exec_list *instructions,
|
|||
if (var != NULL) {
|
||||
var->data.used = true;
|
||||
result = new(ctx) ir_dereference_variable(var);
|
||||
|
||||
if ((var->data.mode == ir_var_auto || var->data.mode == ir_var_shader_out)
|
||||
&& !this->is_lhs
|
||||
&& result->variable_referenced()->data.assigned != true) {
|
||||
_mesa_glsl_warning(&loc, state, "`%s' used uninitialized",
|
||||
this->primary_expression.identifier);
|
||||
}
|
||||
} else {
|
||||
_mesa_glsl_error(& loc, state, "`%s' undeclared",
|
||||
this->primary_expression.identifier);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue