summaryrefslogtreecommitdiff
path: root/ast_to_hir.cpp
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2010-04-23 15:55:19 -0700
committerIan Romanick <ian.d.romanick@intel.com>2010-04-28 18:22:54 -0700
commitc824e35dd092a9cc0dbfd36d90fcdf1488c8942d (patch)
treedbc0f0c524df35a52ac97e5dce40c8d7280bd349 /ast_to_hir.cpp
parentab89927a91a0ea6ffdb56e5e75044472f7277f4a (diff)
Begin handling some varieties of invalid declarations
Diffstat (limited to 'ast_to_hir.cpp')
-rw-r--r--ast_to_hir.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp
index a32805b38f..e0913dd972 100644
--- a/ast_to_hir.cpp
+++ b/ast_to_hir.cpp
@@ -1476,6 +1476,7 @@ ast_declarator_list::hir(exec_list *instructions,
const struct glsl_type *decl_type;
const char *type_name = NULL;
ir_rvalue *result = NULL;
+ YYLTYPE loc = this->get_location();
/* The type specifier may contain a structure definition. Process that
* before any of the variable declarations.
@@ -1488,12 +1489,27 @@ ast_declarator_list::hir(exec_list *instructions,
*/
decl_type = this->type->specifier->glsl_type(& type_name, state);
+ if (is_empty_list(&this->declarations)) {
+ /* There are only two valid cases where the declaration list can be
+ * empty.
+ *
+ * 1. The declaration is setting the default precision of a built-in
+ * type (e.g., 'precision highp vec4;').
+ *
+ * 2. Adding 'invariant' to an existing vertex shader output.
+ */
+
+ if (this->type->qualifier.invariant) {
+ } else if (decl_type != NULL) {
+ } else {
+ _mesa_glsl_error(& loc, state, "incomplete declaration");
+ }
+ }
foreach (ptr, &this->declarations) {
struct ast_declaration *const decl = (struct ast_declaration * )ptr;
const struct glsl_type *var_type;
struct ir_variable *var;
- YYLTYPE loc = this->get_location();
/* FINISHME: Emit a warning if a variable declaration shadows a
* FINISHME: declaration at a higher scope.