@@ -858,7 +858,7 @@ void simplecpp::TokenList::readfile(Stream &stream, const std::string &filename,
858
858
back ()->setstr (currentToken);
859
859
location.adjust (currentToken);
860
860
if (currentToken.find_first_of (" \r\n " ) == std::string::npos)
861
- location.col += 2 + 2 * delim.size ();
861
+ location.col += 2 + ( 2 * delim.size () );
862
862
else
863
863
location.col += 1 + delim.size ();
864
864
@@ -1313,7 +1313,7 @@ void simplecpp::TokenList::constFoldLogicalOp(Token *tok)
1313
1313
void simplecpp::TokenList::constFoldQuestionOp (Token **tok1)
1314
1314
{
1315
1315
bool gotoTok1 = false ;
1316
- for (Token *tok = *tok1; tok && tok->op != ' )' ; tok = gotoTok1 ? *tok1 : tok->next ) {
1316
+ for (const Token *tok = *tok1; tok && tok->op != ' )' ; tok = gotoTok1 ? *tok1 : tok->next ) {
1317
1317
gotoTok1 = false ;
1318
1318
if (tok->str () != " ?" )
1319
1319
continue ;
@@ -1927,7 +1927,7 @@ namespace simplecpp {
1927
1927
}
1928
1928
}
1929
1929
1930
- Token * const output_end_1 = output->back ();
1930
+ const Token * const output_end_1 = output->back ();
1931
1931
1932
1932
const Token *valueToken2;
1933
1933
const Token *endToken2;
@@ -2232,7 +2232,7 @@ namespace simplecpp {
2232
2232
const bool canBeConcatenatedStringOrChar = isStringLiteral_ (A->str ()) || isCharLiteral_ (A->str ());
2233
2233
const bool unexpectedA = (!A->name && !A->number && !A->str ().empty () && !canBeConcatenatedWithEqual && !canBeConcatenatedStringOrChar);
2234
2234
2235
- Token * const B = tok->next ->next ;
2235
+ const Token * const B = tok->next ->next ;
2236
2236
if (!B->name && !B->number && B->op && !B->isOneOf (" #=" ))
2237
2237
throw invalidHashHash::unexpectedToken (tok->location , name (), B);
2238
2238
@@ -2510,11 +2510,11 @@ static void simplifySizeof(simplecpp::TokenList &expr, const std::map<std::strin
2510
2510
for (simplecpp::Token *tok = expr.front (); tok; tok = tok->next ) {
2511
2511
if (tok->str () != " sizeof" )
2512
2512
continue ;
2513
- simplecpp::Token *tok1 = tok->next ;
2513
+ const simplecpp::Token *tok1 = tok->next ;
2514
2514
if (!tok1) {
2515
2515
throw std::runtime_error (" missing sizeof argument" );
2516
2516
}
2517
- simplecpp::Token *tok2 = tok1->next ;
2517
+ const simplecpp::Token *tok2 = tok1->next ;
2518
2518
if (!tok2) {
2519
2519
throw std::runtime_error (" missing sizeof argument" );
2520
2520
}
@@ -2529,7 +2529,7 @@ static void simplifySizeof(simplecpp::TokenList &expr, const std::map<std::strin
2529
2529
}
2530
2530
2531
2531
std::string type;
2532
- for (simplecpp::Token *typeToken = tok1; typeToken != tok2; typeToken = typeToken->next ) {
2532
+ for (const simplecpp::Token *typeToken = tok1; typeToken != tok2; typeToken = typeToken->next ) {
2533
2533
if ((typeToken->str () == " unsigned" || typeToken->str () == " signed" ) && typeToken->next ->name )
2534
2534
continue ;
2535
2535
if (typeToken->str () == " *" && type.find (' *' ) != std::string::npos)
@@ -2580,11 +2580,11 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI
2580
2580
for (simplecpp::Token *tok = expr.front (); tok; tok = tok->next ) {
2581
2581
if (tok->str () != HAS_INCLUDE)
2582
2582
continue ;
2583
- simplecpp::Token *tok1 = tok->next ;
2583
+ const simplecpp::Token *tok1 = tok->next ;
2584
2584
if (!tok1) {
2585
2585
throw std::runtime_error (" missing __has_include argument" );
2586
2586
}
2587
- simplecpp::Token *tok2 = tok1->next ;
2587
+ const simplecpp::Token *tok2 = tok1->next ;
2588
2588
if (!tok2) {
2589
2589
throw std::runtime_error (" missing __has_include argument" );
2590
2590
}
@@ -2602,7 +2602,7 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI
2602
2602
const bool systemheader = (tok1 && tok1->op == ' <' );
2603
2603
std::string header;
2604
2604
if (systemheader) {
2605
- simplecpp::Token *tok3 = tok1->next ;
2605
+ const simplecpp::Token *tok3 = tok1->next ;
2606
2606
if (!tok3) {
2607
2607
throw std::runtime_error (" missing __has_include closing angular bracket" );
2608
2608
}
@@ -2613,7 +2613,7 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI
2613
2613
}
2614
2614
}
2615
2615
2616
- for (simplecpp::Token *headerToken = tok1->next ; headerToken != tok3; headerToken = headerToken->next )
2616
+ for (const simplecpp::Token *headerToken = tok1->next ; headerToken != tok3; headerToken = headerToken->next )
2617
2617
header += headerToken->str ();
2618
2618
} else {
2619
2619
header = tok1->str ().substr (1U , tok1->str ().size () - 2U );
0 commit comments