glsl: Refactor code to check that identifier names are valid.
authorPaul Berry <stereotype441@gmail.com>
Sat, 28 Sep 2013 00:18:14 +0000 (17:18 -0700)
committerPaul Berry <stereotype441@gmail.com>
Thu, 10 Oct 2013 21:27:05 +0000 (14:27 -0700)
commit1838df97a28cf859f20d6535c00509574b200152
treedc21b66d4b87af03d91f6840caab3774ab0b1dce
parent6a157f2e3345faf23041eaefb47183a6debacb6b
glsl: Refactor code to check that identifier names are valid.

GLSL reserves identifiers beginning with "gl_" or containing "__", but
we haven't been consistent about enforcing this rule.  This patch
makes a new function to check whether identifier names are valid.  In
the process it closes a loophole where we would previously allow
function argument names to contain "__".

v2: Rename check_valid_identifier() -> validate_identifier().  Add
curly braces in validate_identifier().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ast_to_hir.cpp