Fixed #1713 (remove Microsoft variants of inline)

This commit is contained in:
Robert Reif 2010-05-29 07:43:58 +02:00 committed by Daniel Marjamäki
parent 26a7d29760
commit 3fb0260ef1
2 changed files with 5 additions and 3 deletions

View File

@ -1693,14 +1693,14 @@ bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::s
Token::createMutualLinks(tok->tokAt(2), tok->tokAt(3)); Token::createMutualLinks(tok->tokAt(2), tok->tokAt(3));
} }
// Remove "volatile", "inline" and register // Remove "volatile", "inline" and "register"
while (Token::Match(_tokens, "volatile|inline|register")) while (Token::Match(_tokens, "volatile|inline|__inline|__forceinline|register"))
{ {
_tokens->deleteThis(); _tokens->deleteThis();
} }
for (Token *tok = _tokens; tok; tok = tok->next()) for (Token *tok = _tokens; tok; tok = tok->next())
{ {
while (Token::Match(tok->next(), "volatile|inline|register")) while (Token::Match(tok->next(), "volatile|inline|__inline|__forceinline|register"))
{ {
tok->deleteNext(); tok->deleteNext();
} }

View File

@ -5089,6 +5089,8 @@ private:
ASSERT_EQUALS("int var ;", tok("register int var ;", true)); ASSERT_EQUALS("int var ;", tok("register int var ;", true));
ASSERT_EQUALS("short var ;", tok("register short int var ;", true)); ASSERT_EQUALS("short var ;", tok("register short int var ;", true));
ASSERT_EQUALS("int foo ( ) { }", tok("inline int foo ( ) { }", true)); ASSERT_EQUALS("int foo ( ) { }", tok("inline int foo ( ) { }", true));
ASSERT_EQUALS("int foo ( ) { }", tok("__inline int foo ( ) { }", true));
ASSERT_EQUALS("int foo ( ) { }", tok("__forceinline int foo ( ) { }", true));
ASSERT_EQUALS("if ( a ) { }", tok("if ( likely ( a ) ) { }", true)); ASSERT_EQUALS("if ( a ) { }", tok("if ( likely ( a ) ) { }", true));
ASSERT_EQUALS("if ( a ) { }", tok("if ( unlikely ( a ) ) { }", true)); ASSERT_EQUALS("if ( a ) { }", tok("if ( unlikely ( a ) ) { }", true));
} }