mesa: Improve static error checking of arrays sized by MESA_SHADER_TYPES.
authorPaul Berry <stereotype441@gmail.com>
Tue, 17 Dec 2013 17:54:38 +0000 (09:54 -0800)
committerPaul Berry <stereotype441@gmail.com>
Mon, 30 Dec 2013 19:21:27 +0000 (11:21 -0800)
commit99e822fa18a322f7bf0d32ce99eab534d5614469
treed2dd92b2c2f2312a9d5582534dc4b2f5073b274d
parentb30e25f29752fe3782d9ad43cb2cee46885c487d
mesa: Improve static error checking of arrays sized by MESA_SHADER_TYPES.

This patch replaces the following pattern:

    foo bar[MESA_SHADER_TYPES] = {
       ...
    };

With:

    foo bar[] = {
       ...
    };
    STATIC_ASSERT(Elements(bar) == MESA_SHADER_TYPES);

This way, when a new shader type is added in a future version of Mesa,
we will get a compile error to remind us that the array needs to be
updated.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/glsl/link_atomics.cpp
src/glsl/linker.cpp
src/mesa/program/program.h