diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-31 13:15:23 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-03-31 13:15:23 -0700 |
commit | e0800062daf237a9e4f893bc3db473da8f7472c0 (patch) | |
tree | 46bc90b4f7cd8e2202e4919f656552c8e30a50a4 /ast_to_hir.cpp | |
parent | a705d65ccd1e204cc0b667df2678cc6921cbd9f5 (diff) |
Reject declarations with 'in' or 'out' qualifiers
'in' and 'out' can only be used in function parameter lists or at
global scope (1.30 and later). This change enforces this.
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r-- | ast_to_hir.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index 06d7d6273c..375955d033 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -1209,9 +1209,10 @@ ast_declarator_list::hir(exec_list *instructions, if (state->current_function != NULL) { const char *mode = NULL; + const char *extra = ""; - /* FINISHME: Variables that are in or out must be declared either at - * FINISHME: global scope or in a parameter list. + /* There is no need to check for 'inout' here because the parser will + * only allow that in function parameter lists. */ if (this->type->qualifier.attribute) { mode = "attribute"; @@ -1219,13 +1220,19 @@ ast_declarator_list::hir(exec_list *instructions, mode = "uniform"; } else if (this->type->qualifier.varying) { mode = "varying"; + } else if (this->type->qualifier.in) { + mode = "in"; + extra = " or in function parameter list"; + } else if (this->type->qualifier.out) { + mode = "out"; + extra = " or in function parameter list"; } if (mode) { _mesa_glsl_error(& loc, state, "%s variable `%s' must be declared at " - "global scope", - mode, var->name); + "global scope%s", + mode, var->name, extra); } } else if (var->mode == ir_var_in) { if (state->target == vertex_shader) { |