Disallow non-language characters in comments for ES version 100.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24301 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-12-03 20:09:57 +00:00
parent 1abc4045ce
commit 4e734dd68b
10 changed files with 103 additions and 12 deletions

View file

@ -1396,6 +1396,10 @@ void TParseContext::reservedPpErrorCheck(TSourceLoc loc, const char* identifier,
//
void TParseContext::lineContinuationCheck(TSourceLoc loc)
{
if ((profile == EEsProfile && version >= 300) ||
(profile != EEsProfile && version >= 420))
return;
const char* message = "line continuation";
if (messages & EShMsgRelaxedErrors) {
warn(loc, "not allowed in this version", message, "");
@ -1406,6 +1410,28 @@ void TParseContext::lineContinuationCheck(TSourceLoc loc)
}
}
//
// See if this version/profile allows use the given character in a comment.
//
void TParseContext::commentCharacterCheck(TSourceLoc loc, int ch)
{
if ((profile == EEsProfile && version >= 300) ||
(profile != EEsProfile))
return;
TString message("non-language character (");
if (ch > 32 && ch <= 126)
message.push_back(ch);
message.append(") in comment");
if (messages & EShMsgRelaxedErrors) {
warn(loc, "not allowed in this version", message.c_str(), "");
} else {
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, message.c_str());
profileRequires(loc, EEsProfile, 300, 0, message.c_str());
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 0, message.c_str());
}
}
bool TParseContext::builtInName(const TString& identifier)
{
return identifier.compare(0, 3, "gl_") == 0;