glslang: Fix a few more warnings, and see it using nullptr causes anyone problems (testing c++11 portability).
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31218 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
b06127c513
commit
ca3457f1a7
11 changed files with 87 additions and 81 deletions
|
|
@ -100,15 +100,15 @@ TPpContext::MemoryPool* TPpContext::mem_CreatePool(size_t chunksize, unsigned in
|
|||
if (chunksize == 0)
|
||||
chunksize = CHUNKSIZE;
|
||||
if (align & (align - 1))
|
||||
return 0;
|
||||
return nullptr;
|
||||
if (chunksize < sizeof(MemoryPool))
|
||||
return 0;
|
||||
return nullptr;
|
||||
if (chunksize & (align - 1))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
MemoryPool *pool = (MemoryPool*)malloc(chunksize);
|
||||
if (! pool)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
pool->next = 0;
|
||||
pool->chunksize = chunksize;
|
||||
|
|
@ -143,10 +143,12 @@ void* TPpContext::mem_Alloc(MemoryPool *pool, size_t size)
|
|||
// request size is too big for the chunksize, so allocate it as
|
||||
// a single chunk of the right size
|
||||
ch = (struct chunk*)malloc(minreq);
|
||||
if (!ch) return 0;
|
||||
if (! ch)
|
||||
return nullptr;
|
||||
} else {
|
||||
ch = (struct chunk*)malloc(pool->chunksize);
|
||||
if (!ch) return 0;
|
||||
if (! ch)
|
||||
return nullptr;
|
||||
pool->free = (uintptr_t)ch + minreq;
|
||||
pool->end = (uintptr_t)ch + pool->chunksize;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,9 +206,9 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||
}
|
||||
}
|
||||
} else if (ch == 'f' || ch == 'F') {
|
||||
parseContext.profileRequires(ppToken->loc, EEsProfile, 300, 0, "floating-point suffix");
|
||||
parseContext.profileRequires(ppToken->loc, EEsProfile, 300, nullptr, "floating-point suffix");
|
||||
if ((parseContext.messages & EShMsgRelaxedErrors) == 0)
|
||||
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, 0, "floating-point suffix");
|
||||
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 120, nullptr, "floating-point suffix");
|
||||
if (! HasDecimalOrExponent)
|
||||
parseContext.error(ppToken->loc, "float literal needs a decimal point or exponent", "", "");
|
||||
if (len < TPpToken::maxTokenLength)
|
||||
|
|
@ -222,7 +222,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||
|
||||
str[len]='\0';
|
||||
|
||||
ppToken->dval = strtod(str, 0);
|
||||
ppToken->dval = strtod(str, nullptr);
|
||||
}
|
||||
|
||||
if (isDouble)
|
||||
|
|
@ -687,24 +687,24 @@ const char* TPpContext::tokenize(TPpToken* ppToken)
|
|||
int token = '\n';
|
||||
|
||||
for(;;) {
|
||||
const char* tokenString = 0;
|
||||
const char* tokenString = nullptr;
|
||||
token = scanToken(ppToken);
|
||||
ppToken->token = token;
|
||||
if (token == EOF) {
|
||||
missingEndifCheck();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
if (token == '#') {
|
||||
if (previous_token == '\n') {
|
||||
token = readCPPline(ppToken);
|
||||
if (token == EOF) {
|
||||
missingEndifCheck();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
parseContext.error(ppToken->loc, "preprocessor directive cannot be preceded by another token", "#", "");
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
previous_token = token;
|
||||
|
|
@ -723,10 +723,10 @@ const char* TPpContext::tokenize(TPpToken* ppToken)
|
|||
tokenString = ppToken->name;
|
||||
else if (token == CPP_STRCONSTANT) {
|
||||
parseContext.error(ppToken->loc, "string literals not supported", "\"\"", "");
|
||||
tokenString = 0;
|
||||
tokenString = nullptr;
|
||||
} else if (token == '\'') {
|
||||
parseContext.error(ppToken->loc, "character literals not supported", "\'", "");
|
||||
tokenString = 0;
|
||||
tokenString = nullptr;
|
||||
} else
|
||||
tokenString = GetAtomString(token);
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ TPpContext::Symbol* TPpContext::LookUpSymbol(int atom)
|
|||
{
|
||||
TSymbolMap::iterator it = symbols.find(atom);
|
||||
if (it == symbols.end())
|
||||
return 0;
|
||||
return nullptr;
|
||||
else
|
||||
return it->second;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue