diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index adcbf4efb..a9937924a 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3802,7 +3802,6 @@ bool Tokenizer::simplifyTokenList2() // Create symbol database and then remove const keywords createSymbolDatabase(); SymbolDatabase::setValueTypeInTokenList(list.front(), isCPP(), _settings->defaultSign, &_settings->library); - simplifyPointerConst(); ValueFlow::setValues(&list, _symbolDatabase, _errorLogger, _settings); @@ -3814,14 +3813,6 @@ bool Tokenizer::simplifyTokenList2() return true; } //--------------------------------------------------------------------------- -void Tokenizer::simplifyPointerConst() -{ - for (Token *tok = list.front(); tok; tok = tok->next()) { - if (Token::Match(tok, "* const %name%|*")) - tok->deleteNext(); - } -} -//--------------------------------------------------------------------------- void Tokenizer::printDebugOutput(unsigned int simplification) const { diff --git a/lib/tokenize.h b/lib/tokenize.h index 2f47f3b77..0ed769ab8 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -281,12 +281,6 @@ public: */ void simplifyCompoundAssignment(); - - /** - * Simplify "* const" to "*" - */ - void simplifyPointerConst(); - /** * Simplify the location of "static" and "const" qualifiers in * a variable declaration or definition. diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index c3d2edeca..1c005f79e 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -153,8 +153,6 @@ private: TEST_CASE(pointeralias3); TEST_CASE(pointeralias4); - TEST_CASE(reduceConstness); - // simplify "while (0)" TEST_CASE(while0); // ticket #3140 @@ -2780,10 +2778,6 @@ private: ASSERT_EQUALS(expected, tok(code)); } - void reduceConstness() { - ASSERT_EQUALS("char * p ;", tok("char * const p;")); - } - void while0() { ASSERT_EQUALS("; x = 1 ;", tok("; do { x = 1 ; } while (0);")); ASSERT_EQUALS("; return 0 ;", tok("; do { return 0; } while (0);")); diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index e4524e542..c71543646 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -1412,9 +1412,9 @@ private: "_Iterator v3;"; // The expected result.. - const char expected[] = "long * v1 ; " - "void * v2 [ 2 ] ; " - "int * * v3 ;"; + const char expected[] = "long * const v1 ; " + "void * const v2 [ 2 ] ; " + "int * const * v3 ;"; ASSERT_EQUALS(expected, tok(code)); // Check for output.. diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index dc9c50ac0..0f70f0730 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -2698,7 +2698,7 @@ private: "}"; ASSERT_EQUALS("void f ( ) {\n" "int i ; i = 1 ;\n" - "const int * constPtrToConst ; constPtrToConst = & i ;\n" + "const int * const constPtrToConst ; constPtrToConst = & i ;\n" "std :: cout << i << std :: endl ;\n" "std :: cout << & i << std :: endl ;\n" "}", tokenizeAndStringify(code, true));