Implement ES-3.0-specific error semantics for redefining predefined macros.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@29353 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2015-01-07 18:47:57 +00:00
parent 548ec2c12c
commit 50d542e6b9
4 changed files with 31 additions and 7 deletions

View file

@ -1783,9 +1783,16 @@ void TParseContext::reservedPpErrorCheck(TSourceLoc loc, const char* identifier,
// single underscore) are also reserved, and defining such a name results in a
// compile-time error."
if (strncmp(identifier, "GL_", 3) == 0)
error(loc, "names beginning with \"GL_\" can't be defined:", op, identifier);
else if (strstr(identifier, "__") != 0)
warn(loc, "names containing consecutive underscores are reserved:", op, identifier);
error(loc, "names beginning with \"GL_\" can't be (un)defined:", op, identifier);
else if (strstr(identifier, "__") != 0) {
if (profile == EEsProfile && version >= 300 &&
(strcmp(identifier, "__LINE__") == 0 ||
strcmp(identifier, "__FILE__") == 0 ||
strcmp(identifier, "__VERSION__") == 0))
error(loc, "predefined names can't be (un)defined:", op, identifier);
else
warn(loc, "names containing consecutive underscores are reserved:", op, identifier);
}
}
//