зеркало из https://github.com/AvaloniaUI/angle.git
Detect and report multiple #version directives
TRAC #12072 Signed-off-by: Shannon Woods Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@206 736b8ea6-26fd-11df-bfd4-992fa37f6226
This commit is contained in:
Родитель
b41c977b3f
Коммит
dec19e2014
|
@ -304,7 +304,7 @@ int PaParseStrings(char* argv[], int strLen[], int argc, TParseContext& parseCon
|
|||
cpp->PaArgv = argv;
|
||||
cpp->PaArgc = argc;
|
||||
cpp->PaStrLen = strLen;
|
||||
cpp->notAVersionToken = 0;
|
||||
cpp->pastFirstStatement = 0;
|
||||
yylineno = 1;
|
||||
|
||||
if (*cpp->PaStrLen >= 0) {
|
||||
|
|
|
@ -78,7 +78,7 @@ struct CPPStruct_Rec {
|
|||
int mostRecentToken; // Most recent token seen by the scanner
|
||||
InputSrc *currentInput;
|
||||
int previous_token;
|
||||
int notAVersionToken; // used to make sure that #version is the first token seen in the file, if present
|
||||
int pastFirstStatement; // used to make sure that #version is the first statement seen in the file, if present
|
||||
|
||||
void *pC; // storing the parseContext of the compile object in cpp.
|
||||
|
||||
|
|
|
@ -638,7 +638,7 @@ static int CPPversion(yystypepp * yylvalpp)
|
|||
|
||||
int token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
|
||||
|
||||
if (cpp->notAVersionToken == 1)
|
||||
if (cpp->pastFirstStatement == 1)
|
||||
CPPShInfoLogMsg("#version must occur before any other statement in the program");
|
||||
|
||||
if(token=='\n'){
|
||||
|
@ -734,7 +734,7 @@ int readCPPline(yystypepp * yylvalpp)
|
|||
}else{
|
||||
CPPErrorToInfoLog("#else after a #else");
|
||||
cpp->ifdepth=0;
|
||||
cpp->notAVersionToken = 1;
|
||||
cpp->pastFirstStatement = 1;
|
||||
return 0;
|
||||
}
|
||||
} else if (yylvalpp->sc_ident == elifAtom) {
|
||||
|
@ -787,7 +787,7 @@ int readCPPline(yystypepp * yylvalpp)
|
|||
token = cpp->currentInput->scan(cpp->currentInput, yylvalpp);
|
||||
}
|
||||
|
||||
cpp->notAVersionToken = !isVersion;
|
||||
cpp->pastFirstStatement = 1;
|
||||
|
||||
return token;
|
||||
} // readCPPline
|
||||
|
|
|
@ -120,7 +120,7 @@ int InitScanner(CPPStruct *cpp)
|
|||
|
||||
cpp->currentInput = &eof_inputsrc;
|
||||
cpp->previous_token = '\n';
|
||||
cpp->notAVersionToken = 0;
|
||||
cpp->pastFirstStatement = 0;
|
||||
|
||||
return 1;
|
||||
} // InitScanner
|
||||
|
@ -712,7 +712,7 @@ int yylex_CPP(char* buf, int maxSize)
|
|||
cpp->previous_token = token;
|
||||
// expand macros
|
||||
if (token == CPP_IDENTIFIER && MacroExpand(yylvalpp.sc_ident, &yylvalpp)) {
|
||||
cpp->notAVersionToken = 1;
|
||||
cpp->pastFirstStatement = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -720,13 +720,13 @@ int yylex_CPP(char* buf, int maxSize)
|
|||
continue;
|
||||
|
||||
if (token == CPP_IDENTIFIER) {
|
||||
cpp->notAVersionToken = 1;
|
||||
cpp->pastFirstStatement = 1;
|
||||
tokenString = GetStringOfAtom(atable,yylvalpp.sc_ident);
|
||||
} else if (token == CPP_FLOATCONSTANT||token == CPP_INTCONSTANT){
|
||||
cpp->notAVersionToken = 1;
|
||||
cpp->pastFirstStatement = 1;
|
||||
tokenString = yylvalpp.symbol_name;
|
||||
} else {
|
||||
cpp->notAVersionToken = 1;
|
||||
cpp->pastFirstStatement = 1;
|
||||
tokenString = GetStringOfAtom(atable,token);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче