replace 'constexpr' with 'const'

This commit is contained in:
Daniel Marjamäki 2018-11-03 19:22:51 +01:00
parent fb76ef1db1
commit f8b0584f6a
4 changed files with 6 additions and 6 deletions

View File

@ -9103,8 +9103,9 @@ void Tokenizer::simplifyKeyword()
}
else if (cpp11) {
while (tok->str() == "constexpr") {
tok->deleteThis();
if (tok->str() == "constexpr") {
tok->originalName(tok->str());
tok->str("const");
}
// final:

View File

@ -680,7 +680,7 @@ static void compilePrecedence2(Token *&tok, AST_state& state)
if (Token::simpleMatch(squareBracket->link(), "] (")) {
Token* const roundBracket = squareBracket->link()->next();
Token* curlyBracket = roundBracket->link()->next();
if (curlyBracket && curlyBracket->str() == "mutable")
if (Token::Match(curlyBracket, "mutable|const"))
curlyBracket = curlyBracket->next();
if (curlyBracket && curlyBracket->originalName() == "->") {
while (Token::Match(curlyBracket, "%name%|.|::|&|*"))

View File

@ -3273,7 +3273,7 @@ private:
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("int foo ( ) { }", tok("constexpr int foo() { }", true));
ASSERT_EQUALS("const int foo ( ) { }", tok("constexpr int foo() { }", true));
ASSERT_EQUALS("void f ( ) { int final [ 10 ] ; }", tok("void f() { int final[10]; }", true));
ASSERT_EQUALS("int * p ;", tok("int * __restrict p;", "test.c"));
ASSERT_EQUALS("int * * p ;", tok("int * __restrict__ * p;", "test.c"));

View File

@ -1864,8 +1864,7 @@ private:
void simplifyTypedef81() { // ticket #2603 segmentation fault
ASSERT_THROW(checkSimplifyTypedef("typedef\n"), InternalError);
checkSimplifyTypedef("typedef constexpr\n");
ASSERT_EQUALS("", errout.str());
ASSERT_THROW(checkSimplifyTypedef("typedef constexpr\n"), InternalError);
}
void simplifyTypedef82() { // ticket #2403