Fix clang static analyzer issues, as reported by floooh.
This commit is contained in:
parent
1f654e1603
commit
b329715caf
4 changed files with 44 additions and 35 deletions
|
|
@ -817,7 +817,6 @@ int TPpContext::CPPextension(TPpToken* ppToken)
|
|||
int TPpContext::readCPPline(TPpToken* ppToken)
|
||||
{
|
||||
int token = scanToken(ppToken);
|
||||
bool isVersion = false;
|
||||
|
||||
if (token == CPP_IDENTIFIER) {
|
||||
if (ppToken->atom == defineAtom) {
|
||||
|
|
@ -864,7 +863,6 @@ int TPpContext::readCPPline(TPpToken* ppToken)
|
|||
token = CPPerror(ppToken);
|
||||
} else if (ppToken->atom == versionAtom) {
|
||||
token = CPPversion(ppToken);
|
||||
isVersion = true;
|
||||
} else if (ppToken->atom == extensionAtom) {
|
||||
token = CPPextension(ppToken);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ protected:
|
|||
// handle any non-escaped newline
|
||||
if (ch == '\r' || ch == '\n') {
|
||||
if (ch == '\r' && input->peek() == '\n')
|
||||
ch = input->get();
|
||||
input->get();
|
||||
return '\n';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,12 +116,11 @@ int TPpContext::InitScanner()
|
|||
int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
||||
{
|
||||
bool HasDecimalOrExponent = false;
|
||||
int declen, exp, ExpSign;
|
||||
int declen;
|
||||
int str_len;
|
||||
int isDouble = 0;
|
||||
|
||||
declen = 0;
|
||||
exp = 0;
|
||||
|
||||
str_len=len;
|
||||
char* str = ppToken->name;
|
||||
|
|
@ -152,34 +151,32 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
|||
HasDecimalOrExponent = true;
|
||||
if (len >= TPpToken::maxTokenLength) {
|
||||
parseContext.error(ppToken->loc, "float literal too long", "", "");
|
||||
len = 1,str_len=1;
|
||||
len = 1;
|
||||
str_len = 1;
|
||||
} else {
|
||||
ExpSign = 1;
|
||||
str[len++] = (char)ch;
|
||||
ch = getChar();
|
||||
if (ch == '+') {
|
||||
str[len++] = (char)ch;
|
||||
ch = getChar();
|
||||
} else if (ch == '-') {
|
||||
ExpSign = -1;
|
||||
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++] = (char)ch;
|
||||
ch = getChar();
|
||||
} else {
|
||||
parseContext.error(ppToken->loc, "float literal too long", "", "");
|
||||
len = 1,str_len=1;
|
||||
len = 1;
|
||||
str_len = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
parseContext.error(ppToken->loc, "bad character in float exponent", "", "");
|
||||
}
|
||||
exp *= ExpSign;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue