Fixed #9137 (Tokenizer: Wrong handling of volatile pointer)
This commit is contained in:
parent
c03df8e6b4
commit
cdc602e1be
|
@ -6713,7 +6713,7 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, const Token * const tokEnd, co
|
|||
else if (std::strchr(";,", tok2->str()[0])) {
|
||||
// "type var =" => "type var; var ="
|
||||
const Token *varTok = type0->tokAt(typelen);
|
||||
while (Token::Match(varTok, "*|&|const"))
|
||||
while (Token::Match(varTok, "*|&|const|volatile"))
|
||||
varTok = varTok->next();
|
||||
if (!varTok)
|
||||
syntaxError(tok2); // invalid code
|
||||
|
|
|
@ -3645,6 +3645,10 @@ private:
|
|||
const char code4[] = "const void * const p = NULL;";
|
||||
const char res4[] = "const void * const p ; p = NULL ;";
|
||||
ASSERT_EQUALS(res4, tokenizeAndStringify(code4));
|
||||
|
||||
const char code5[] = "const void * volatile p = NULL;";
|
||||
const char res5[] = "const void * volatile p ; p = NULL ;";
|
||||
ASSERT_EQUALS(res5, tokenizeAndStringify(code5));;
|
||||
}
|
||||
|
||||
void vardecl5() {
|
||||
|
|
Loading…
Reference in New Issue