diff options
author | Chia-I Wu <[email protected]> | 2011-08-04 00:39:07 +0900 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2011-08-05 12:14:24 +0900 |
commit | 547212d963c70161915c46d64e8020617199fb8d (patch) | |
tree | af49fc31fc8ec59df4099f08649cb25f0b3892f2 /src/glsl/ast_to_hir.cpp | |
parent | a48118e510fcbb57634a7869cb628123fa8c3f2e (diff) |
glsl: empty declarations should be valid
Unlike C++, empty declarations such as
float;
should be valid. The spec is not explicit about this actually.
Some apps that generate their shader sources may rely on this. This was
noted when porting one of them to Linux from Windows.
Reviewed-by: Chad Versace <[email protected]>
Note: this is a candidate for the 7.11 branch.
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index c0524bf0bcc..7da14611950 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2399,12 +2399,12 @@ ast_declarator_list::hir(exec_list *instructions, decl_type = this->type->specifier->glsl_type(& type_name, state); if (this->declarations.is_empty()) { - /* The only valid case where the declaration list can be empty is when - * the declaration is setting the default precision of a built-in type - * (e.g., 'precision highp vec4;'). - */ - if (decl_type != NULL) { + /* Warn if this empty declaration is not for declaring a structure. + */ + if (this->type->specifier->structure == NULL) { + _mesa_glsl_warning(&loc, state, "empty declaration"); + } } else { _mesa_glsl_error(& loc, state, "incomplete declaration"); } |