glslang: Fix over 100 warnings from MSVC warning level 4.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31202 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
2aa7f3a671
commit
93dfbe1309
35 changed files with 178 additions and 168 deletions
|
|
@ -454,8 +454,8 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo
|
|||
|
||||
return token;
|
||||
}
|
||||
Symbol* s;
|
||||
res = (s = LookUpSymbol(ppToken->atom)) ? !s->mac.undef : 0;
|
||||
Symbol* s = LookUpSymbol(ppToken->atom);
|
||||
res = s ? ! s->mac.undef : 0;
|
||||
token = scanToken(ppToken);
|
||||
if (needclose) {
|
||||
if (token != ')') {
|
||||
|
|
@ -690,8 +690,6 @@ int TPpContext::CPPerror(TPpToken* ppToken)
|
|||
int TPpContext::CPPpragma(TPpToken* ppToken)
|
||||
{
|
||||
char SrcStrName[2];
|
||||
int tokenCount = 0;
|
||||
int maxTokenCount = 10;
|
||||
const char* SrcStr;
|
||||
TVector<TString> tokens;
|
||||
|
||||
|
|
@ -711,7 +709,7 @@ int TPpContext::CPPpragma(TPpToken* ppToken)
|
|||
tokens.push_back(SrcStr);
|
||||
break;
|
||||
default:
|
||||
SrcStrName[0] = token;
|
||||
SrcStrName[0] = (char)token;
|
||||
SrcStrName[1] = '\0';
|
||||
tokens.push_back(SrcStrName);
|
||||
}
|
||||
|
|
@ -887,7 +885,7 @@ TPpContext::TokenStream* TPpContext::PrescanMacroArg(TokenStream* a, TPpToken* p
|
|||
|
||||
n = new TokenStream;
|
||||
pushInput(new tMarkerInput(this));
|
||||
pushTokenStreamInput(a, 0);
|
||||
pushTokenStreamInput(a);
|
||||
while ((token = scanToken(ppToken)) != tMarkerInput::marker) {
|
||||
if (token == CPP_IDENTIFIER && MacroExpand(ppToken->atom, ppToken, false, newLineOkay) != 0)
|
||||
continue;
|
||||
|
|
@ -916,7 +914,7 @@ int TPpContext::tMacroInput::scan(TPpToken* ppToken)
|
|||
if (mac->args[i] == ppToken->atom)
|
||||
break;
|
||||
if (i >= 0) {
|
||||
pp->pushTokenStreamInput(args[i], ppToken->atom);
|
||||
pp->pushTokenStreamInput(args[i]);
|
||||
|
||||
return pp->scanToken(ppToken);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ TPpContext::TPpContext(TParseContext& pc) :
|
|||
preamble(0), strings(0), parseContext(pc), inComment(false)
|
||||
{
|
||||
InitAtomTable();
|
||||
InitScanner(this);
|
||||
InitScanner();
|
||||
|
||||
ifdepth = 0;
|
||||
for (elsetracker = 0; elsetracker < maxIfNesting; elsetracker++)
|
||||
|
|
|
|||
|
|
@ -193,6 +193,9 @@ public:
|
|||
TSymbolMap symbols; // this has light use... just defined macros
|
||||
|
||||
protected:
|
||||
TPpContext(TPpContext&);
|
||||
TPpContext& operator=(TPpContext&);
|
||||
|
||||
char* preamble; // string to parse, all before line 1 of string 0, it is 0 if no preamble
|
||||
int preambleLength;
|
||||
char** strings; // official strings of shader, starting a string 0 line 1
|
||||
|
|
@ -342,7 +345,7 @@ protected:
|
|||
void RecordToken(TokenStream* pTok, int token, TPpToken* ppToken);
|
||||
void RewindTokenStream(TokenStream *pTok);
|
||||
int ReadToken(TokenStream* pTok, TPpToken* ppToken);
|
||||
void pushTokenStreamInput(TokenStream *ts, int name);
|
||||
void pushTokenStreamInput(TokenStream *ts);
|
||||
void UngetToken(int token, TPpToken* ppToken);
|
||||
|
||||
class tTokenInput : public tInput {
|
||||
|
|
@ -445,7 +448,7 @@ protected:
|
|||
TInputScanner* input;
|
||||
};
|
||||
|
||||
int InitScanner(TPpContext* cpp);
|
||||
int InitScanner();
|
||||
int ScanFromString(char* s);
|
||||
void missingEndifCheck();
|
||||
int lFloatConst(int len, int ch, TPpToken* ppToken);
|
||||
|
|
|
|||
|
|
@ -95,8 +95,6 @@ struct chunk {
|
|||
|
||||
TPpContext::MemoryPool* TPpContext::mem_CreatePool(size_t chunksize, unsigned int align)
|
||||
{
|
||||
MemoryPool *pool;
|
||||
|
||||
if (align == 0)
|
||||
align = ALIGN;
|
||||
if (chunksize == 0)
|
||||
|
|
@ -107,7 +105,9 @@ TPpContext::MemoryPool* TPpContext::mem_CreatePool(size_t chunksize, unsigned in
|
|||
return 0;
|
||||
if (chunksize & (align - 1))
|
||||
return 0;
|
||||
if (!(pool = (MemoryPool*)malloc(chunksize)))
|
||||
|
||||
MemoryPool *pool = (MemoryPool*)malloc(chunksize);
|
||||
if (! pool)
|
||||
return 0;
|
||||
|
||||
pool->next = 0;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
namespace glslang {
|
||||
|
||||
int TPpContext::InitScanner(TPpContext *cpp)
|
||||
int TPpContext::InitScanner()
|
||||
{
|
||||
// Add various atoms needed by the CPP line scanner:
|
||||
if (!InitCPP())
|
||||
|
|
@ -127,13 +127,13 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||
char* str = ppToken->name;
|
||||
if (ch == '.') {
|
||||
HasDecimalOrExponent = true;
|
||||
str[len++]=ch;
|
||||
str[len++] = (char)ch;
|
||||
ch = getChar();
|
||||
while (ch >= '0' && ch <= '9') {
|
||||
if (len < TPpToken::maxTokenLength) {
|
||||
declen++;
|
||||
if (len > 0 || ch != '0') {
|
||||
str[len] = ch;
|
||||
str[len] = (char)ch;
|
||||
len++;
|
||||
str_len++;
|
||||
}
|
||||
|
|
@ -155,21 +155,21 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||
len = 1,str_len=1;
|
||||
} else {
|
||||
ExpSign = 1;
|
||||
str[len++]=ch;
|
||||
str[len++] = (char)ch;
|
||||
ch = getChar();
|
||||
if (ch == '+') {
|
||||
str[len++]=ch;
|
||||
str[len++] = (char)ch;
|
||||
ch = getChar();
|
||||
} else if (ch == '-') {
|
||||
ExpSign = -1;
|
||||
str[len++]=ch;
|
||||
str[len++] = (char)ch;
|
||||
ch = getChar();
|
||||
}
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
while (ch >= '0' && ch <= '9') {
|
||||
if (len < TPpToken::maxTokenLength) {
|
||||
exp = exp*10 + ch - '0';
|
||||
str[len++]=ch;
|
||||
str[len++] = (char)ch;
|
||||
ch = getChar();
|
||||
} else {
|
||||
parseContext.error(ppToken->loc, "float literal too long", "", "");
|
||||
|
|
@ -197,8 +197,8 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||
ungetChar();
|
||||
} else {
|
||||
if (len < TPpToken::maxTokenLength) {
|
||||
str[len++] = ch;
|
||||
str[len++] = ch2;
|
||||
str[len++] = (char)ch;
|
||||
str[len++] = (char)ch2;
|
||||
isDouble = 1;
|
||||
} else {
|
||||
parseContext.error(ppToken->loc, "float literal too long", "", "");
|
||||
|
|
@ -212,7 +212,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||
if (! HasDecimalOrExponent)
|
||||
parseContext.error(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
|
||||
if (len < TPpToken::maxTokenLength)
|
||||
str[len++] = ch;
|
||||
str[len++] = (char)ch;
|
||||
else {
|
||||
parseContext.error(ppToken->loc, "float literal too long", "", "");
|
||||
len = 1,str_len=1;
|
||||
|
|
@ -238,7 +238,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
{
|
||||
char tokenText[TPpToken::maxTokenLength + 1];
|
||||
int AlreadyComplained = 0;
|
||||
int len, ch, ii;
|
||||
int len = 0;
|
||||
int ch = 0;
|
||||
int ii = 0;
|
||||
unsigned ival = 0;
|
||||
|
||||
ppToken->ival = 0;
|
||||
|
|
@ -273,7 +275,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
case 'z':
|
||||
do {
|
||||
if (len < TPpToken::maxTokenLength) {
|
||||
tokenText[len++] = ch;
|
||||
tokenText[len++] = (char)ch;
|
||||
ch = pp->getChar();
|
||||
} else {
|
||||
if (! AlreadyComplained) {
|
||||
|
|
@ -297,13 +299,13 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
|
||||
return CPP_IDENTIFIER;
|
||||
case '0':
|
||||
ppToken->name[len++] = ch;
|
||||
ppToken->name[len++] = (char)ch;
|
||||
ch = pp->getChar();
|
||||
if (ch == 'x' || ch == 'X') {
|
||||
// must be hexidecimal
|
||||
|
||||
bool isUnsigned = false;
|
||||
ppToken->name[len++] = ch;
|
||||
ppToken->name[len++] = (char)ch;
|
||||
ch = pp->getChar();
|
||||
if ((ch >= '0' && ch <= '9') ||
|
||||
(ch >= 'A' && ch <= 'F') ||
|
||||
|
|
@ -312,7 +314,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
ival = 0;
|
||||
do {
|
||||
if (ival <= 0x0fffffff) {
|
||||
ppToken->name[len++] = ch;
|
||||
ppToken->name[len++] = (char)ch;
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
ii = ch - '0';
|
||||
} else if (ch >= 'A' && ch <= 'F') {
|
||||
|
|
@ -338,7 +340,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
}
|
||||
if (ch == 'u' || ch == 'U') {
|
||||
if (len < TPpToken::maxTokenLength)
|
||||
ppToken->name[len++] = ch;
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isUnsigned = true;
|
||||
} else
|
||||
pp->ungetChar();
|
||||
|
|
@ -360,7 +362,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
// see how much octal-like stuff we can read
|
||||
while (ch >= '0' && ch <= '7') {
|
||||
if (len < TPpToken::maxTokenLength)
|
||||
ppToken->name[len++] = ch;
|
||||
ppToken->name[len++] = (char)ch;
|
||||
else if (! AlreadyComplained) {
|
||||
pp->parseContext.error(ppToken->loc, "numeric literal too long", "", "");
|
||||
AlreadyComplained = 1;
|
||||
|
|
@ -378,7 +380,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
nonOctal = true;
|
||||
do {
|
||||
if (len < TPpToken::maxTokenLength)
|
||||
ppToken->name[len++] = ch;
|
||||
ppToken->name[len++] = (char)ch;
|
||||
else if (! AlreadyComplained) {
|
||||
pp->parseContext.error(ppToken->loc, "numeric literal too long", "", "");
|
||||
AlreadyComplained = 1;
|
||||
|
|
@ -395,7 +397,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
|
||||
if (ch == 'u' || ch == 'U') {
|
||||
if (len < TPpToken::maxTokenLength)
|
||||
ppToken->name[len++] = ch;
|
||||
ppToken->name[len++] = (char)ch;
|
||||
isUnsigned = true;
|
||||
} else
|
||||
pp->ungetChar();
|
||||
|
|
@ -418,7 +420,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
|
||||
do {
|
||||
if (len < TPpToken::maxTokenLength)
|
||||
ppToken->name[len++] = ch;
|
||||
ppToken->name[len++] = (char)ch;
|
||||
else if (! AlreadyComplained) {
|
||||
pp->parseContext.error(ppToken->loc, "numeric literal too long", "", "");
|
||||
AlreadyComplained = 1;
|
||||
|
|
@ -433,7 +435,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
int uint = 0;
|
||||
if (ch == 'u' || ch == 'U') {
|
||||
if (len < TPpToken::maxTokenLength)
|
||||
ppToken->name[len++] = ch;
|
||||
ppToken->name[len++] = (char)ch;
|
||||
uint = 1;
|
||||
} else
|
||||
pp->ungetChar();
|
||||
|
|
@ -442,9 +444,9 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
ival = 0;
|
||||
for (ii = 0; ii < numericLen; ii++) {
|
||||
ch = ppToken->name[ii] - '0';
|
||||
if ((ival > 429496729) || (ival == 429496729 && ch >= 6)) {
|
||||
if ((ival > 0x19999999u) || (ival == 0x19999999u && ch >= 6)) {
|
||||
pp->parseContext.error(ppToken->loc, "numeric literal too big", "", "");
|
||||
ival = -1;
|
||||
ival = 0xFFFFFFFFu;
|
||||
break;
|
||||
} else
|
||||
ival = ival * 10 + ch;
|
||||
|
|
@ -651,7 +653,7 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
|
|||
ch = pp->getChar();
|
||||
while (ch != '"' && ch != '\n' && ch != EOF) {
|
||||
if (len < TPpToken::maxTokenLength) {
|
||||
tokenText[len] = ch;
|
||||
tokenText[len] = (char)ch;
|
||||
len++;
|
||||
ch = pp->getChar();
|
||||
} else
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
|
|||
ch = lReadByte(pTok);
|
||||
while (ch != 0) {
|
||||
if (len < TPpToken::maxTokenLength) {
|
||||
tokenText[len] = ch;
|
||||
tokenText[len] = (char)ch;
|
||||
len++;
|
||||
ch = lReadByte(pTok);
|
||||
} else {
|
||||
|
|
@ -239,7 +239,7 @@ int TPpContext::tTokenInput::scan(TPpToken* ppToken)
|
|||
return pp->ReadToken(tokens, ppToken);
|
||||
}
|
||||
|
||||
void TPpContext::pushTokenStreamInput(TokenStream* ts, int name)
|
||||
void TPpContext::pushTokenStreamInput(TokenStream* ts)
|
||||
{
|
||||
pushInput(new tTokenInput(this, ts));
|
||||
RewindTokenStream(ts);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue