mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 04:20:08 +01:00
glsl: Disallow precise redeclarations of vars from outer scopes
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
parent
5ecffe5a3a
commit
d0495c6db8
1 changed files with 9 additions and 0 deletions
|
|
@ -3187,6 +3187,15 @@ ast_declarator_list::hir(exec_list *instructions,
|
|||
_mesa_glsl_error(& loc, state,
|
||||
"undeclared variable `%s' cannot be marked "
|
||||
"precise", decl->identifier);
|
||||
} else if (state->current_function != NULL &&
|
||||
!state->symbols->name_declared_this_scope(decl->identifier)) {
|
||||
/* Note: we have to check if we're in a function, since
|
||||
* builtins are treated as having come from another scope.
|
||||
*/
|
||||
_mesa_glsl_error(& loc, state,
|
||||
"variable `%s' from an outer scope may not be "
|
||||
"redeclared `precise' in this scope",
|
||||
earlier->name);
|
||||
} else if (earlier->data.used) {
|
||||
_mesa_glsl_error(& loc, state,
|
||||
"variable `%s' may not be redeclared "
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue