From: Ian Romanick Date: Wed, 31 Mar 2010 20:15:23 +0000 (-0700) Subject: Reject declarations with 'in' or 'out' qualifiers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e0800062daf237a9e4f893bc3db473da8f7472c0;p=mesa.git 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. --- diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index 06d7d6273cf..375955d0332 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) {