@@ -865,7 +865,7 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
865865 back ()->setstr (currentToken);
866866 location.adjust (currentToken);
867867 if (currentToken.find_first_of (" \r\n " ) == std::string::npos)
868- location.col += 2 + 2 * delim.size ();
868+ location.col += 2 + ( 2 * delim.size () );
869869 else
870870 location.col += 1 + delim.size ();
871871
@@ -1320,7 +1320,7 @@ void simplecpp::TokenList::constFoldLogicalOp(Token *tok)
13201320void simplecpp::TokenList::constFoldQuestionOp (Token **tok1)
13211321{
13221322 bool gotoTok1 = false ;
1323- for (Token *tok = *tok1; tok && tok->op != ' )' ; tok = gotoTok1 ? *tok1 : tok->next ) {
1323+ for (const Token *tok = *tok1; tok && tok->op != ' )' ; tok = gotoTok1 ? *tok1 : tok->next ) {
13241324 gotoTok1 = false ;
13251325 if (tok->str () != " ?" )
13261326 continue ;
@@ -1934,7 +1934,7 @@ namespace simplecpp {
19341934 }
19351935 }
19361936
1937- Token * const output_end_1 = output->back ();
1937+ const Token * const output_end_1 = output->back ();
19381938
19391939 const Token *valueToken2;
19401940 const Token *endToken2;
@@ -2239,7 +2239,7 @@ namespace simplecpp {
22392239 const bool canBeConcatenatedStringOrChar = isStringLiteral_ (A->str ()) || isCharLiteral_ (A->str ());
22402240 const bool unexpectedA = (!A->name && !A->number && !A->str ().empty () && !canBeConcatenatedWithEqual && !canBeConcatenatedStringOrChar);
22412241
2242- Token * const B = tok->next ->next ;
2242+ const Token * const B = tok->next ->next ;
22432243 if (!B->name && !B->number && B->op && !B->isOneOf (" #=" ))
22442244 throw invalidHashHash::unexpectedToken (tok->location , name (), B);
22452245
@@ -2512,11 +2512,11 @@ static void simplifySizeof(simplecpp::TokenList &expr, const std::map<std::strin
25122512 for (simplecpp::Token *tok = expr.front (); tok; tok = tok->next ) {
25132513 if (tok->str () != " sizeof" )
25142514 continue ;
2515- simplecpp::Token *tok1 = tok->next ;
2515+ const simplecpp::Token *tok1 = tok->next ;
25162516 if (!tok1) {
25172517 throw std::runtime_error (" missing sizeof argument" );
25182518 }
2519- simplecpp::Token *tok2 = tok1->next ;
2519+ const simplecpp::Token *tok2 = tok1->next ;
25202520 if (!tok2) {
25212521 throw std::runtime_error (" missing sizeof argument" );
25222522 }
@@ -2531,7 +2531,7 @@ static void simplifySizeof(simplecpp::TokenList &expr, const std::map<std::strin
25312531 }
25322532
25332533 std::string type;
2534- for (simplecpp::Token *typeToken = tok1; typeToken != tok2; typeToken = typeToken->next ) {
2534+ for (const simplecpp::Token *typeToken = tok1; typeToken != tok2; typeToken = typeToken->next ) {
25352535 if ((typeToken->str () == " unsigned" || typeToken->str () == " signed" ) && typeToken->next ->name )
25362536 continue ;
25372537 if (typeToken->str () == " *" && type.find (' *' ) != std::string::npos)
@@ -2582,11 +2582,11 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI
25822582 for (simplecpp::Token *tok = expr.front (); tok; tok = tok->next ) {
25832583 if (tok->str () != HAS_INCLUDE)
25842584 continue ;
2585- simplecpp::Token *tok1 = tok->next ;
2585+ const simplecpp::Token *tok1 = tok->next ;
25862586 if (!tok1) {
25872587 throw std::runtime_error (" missing __has_include argument" );
25882588 }
2589- simplecpp::Token *tok2 = tok1->next ;
2589+ const simplecpp::Token *tok2 = tok1->next ;
25902590 if (!tok2) {
25912591 throw std::runtime_error (" missing __has_include argument" );
25922592 }
@@ -2604,7 +2604,7 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI
26042604 const bool systemheader = (tok1 && tok1->op == ' <' );
26052605 std::string header;
26062606 if (systemheader) {
2607- simplecpp::Token *tok3 = tok1->next ;
2607+ const simplecpp::Token *tok3 = tok1->next ;
26082608 if (!tok3) {
26092609 throw std::runtime_error (" missing __has_include closing angular bracket" );
26102610 }
@@ -2615,7 +2615,7 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI
26152615 }
26162616 }
26172617
2618- for (simplecpp::Token *headerToken = tok1->next ; headerToken != tok3; headerToken = headerToken->next )
2618+ for (const simplecpp::Token *headerToken = tok1->next ; headerToken != tok3; headerToken = headerToken->next )
26192619 header += headerToken->str ();
26202620 } else {
26212621 header = tok1->str ().substr (1U , tok1->str ().size () - 2U );
0 commit comments