[Mesa-dev] [PATCH] glsl: empty declarations should be valid

Eric Anholt eric at anholt.net
Thu Aug 4 13:29:02 PDT 2011


On Thu,  4 Aug 2011 12:59:35 +0900, Chia-I Wu <olvaffe at gmail.com> wrote:
> From: Chia-I Wu <olv at lunarg.com>
> 
> 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.

Ew.  Looking the GLSL 1.20 spec, I see:

statement:
        declaration_statement

declaration_statement:
        declaration

declaration:
        init_declarator_list SEMICOLON

init_declarator_list:
        single_declaration

single_declaration:
        fully_specified_type
        fully_specified_type IDENTIFIER

so it looks like that is actually valid code.  That's awful.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110804/2f6fe03d/attachment.pgp>


More information about the mesa-dev mailing list