@@ -1317,7 +1317,7 @@ void simplecpp::TokenList::constFoldLogicalOp(Token *tok)
1317
1317
void simplecpp::TokenList::constFoldQuestionOp (Token **tok1)
1318
1318
{
1319
1319
bool gotoTok1 = false ;
1320
- for (Token *tok = *tok1; tok && tok->op != ' )' ; tok = gotoTok1 ? *tok1 : tok->next ) {
1320
+ for (const Token *tok = *tok1; tok && tok->op != ' )' ; tok = gotoTok1 ? *tok1 : tok->next ) {
1321
1321
gotoTok1 = false ;
1322
1322
if (tok->str () != " ?" )
1323
1323
continue ;
@@ -1886,7 +1886,7 @@ namespace simplecpp {
1886
1886
}
1887
1887
}
1888
1888
1889
- Token * const output_end_1 = output->back ();
1889
+ const Token * const output_end_1 = output->back ();
1890
1890
1891
1891
// expand
1892
1892
for (const Token *tok = valueToken; tok != endToken;) {
@@ -2195,7 +2195,7 @@ namespace simplecpp {
2195
2195
const bool canBeConcatenatedStringOrChar = isStringLiteral_ (A->str ()) || isCharLiteral_ (A->str ());
2196
2196
const bool unexpectedA = (!A->name && !A->number && !A->str ().empty () && !canBeConcatenatedWithEqual && !canBeConcatenatedStringOrChar);
2197
2197
2198
- Token * const B = tok->next ->next ;
2198
+ const Token * const B = tok->next ->next ;
2199
2199
if (!B->name && !B->number && B->op && !B->isOneOf (" #=" ))
2200
2200
throw invalidHashHash::unexpectedToken (tok->location , name (), B);
2201
2201
@@ -2637,7 +2637,7 @@ static void simplifySizeof(simplecpp::TokenList &expr, const std::map<std::strin
2637
2637
if (!tok1) {
2638
2638
throw std::runtime_error (" missing sizeof argument" );
2639
2639
}
2640
- simplecpp::Token *tok2 = tok1->next ;
2640
+ const simplecpp::Token *tok2 = tok1->next ;
2641
2641
if (!tok2) {
2642
2642
throw std::runtime_error (" missing sizeof argument" );
2643
2643
}
@@ -2652,7 +2652,7 @@ static void simplifySizeof(simplecpp::TokenList &expr, const std::map<std::strin
2652
2652
}
2653
2653
2654
2654
std::string type;
2655
- for (simplecpp::Token *typeToken = tok1; typeToken != tok2; typeToken = typeToken->next ) {
2655
+ for (const simplecpp::Token *typeToken = tok1; typeToken != tok2; typeToken = typeToken->next ) {
2656
2656
if ((typeToken->str () == " unsigned" || typeToken->str () == " signed" ) && typeToken->next ->name )
2657
2657
continue ;
2658
2658
if (typeToken->str () == " *" && type.find (' *' ) != std::string::npos)
@@ -2694,7 +2694,7 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI
2694
2694
if (!tok1) {
2695
2695
throw std::runtime_error (" missing __has_include argument" );
2696
2696
}
2697
- simplecpp::Token *tok2 = tok1->next ;
2697
+ const simplecpp::Token *tok2 = tok1->next ;
2698
2698
if (!tok2) {
2699
2699
throw std::runtime_error (" missing __has_include argument" );
2700
2700
}
@@ -2712,7 +2712,7 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI
2712
2712
const bool systemheader = (tok1 && tok1->op == ' <' );
2713
2713
std::string header;
2714
2714
if (systemheader) {
2715
- simplecpp::Token *tok3 = tok1->next ;
2715
+ const simplecpp::Token *tok3 = tok1->next ;
2716
2716
if (!tok3) {
2717
2717
throw std::runtime_error (" missing __has_include closing angular bracket" );
2718
2718
}
@@ -2723,7 +2723,7 @@ static void simplifyHasInclude(simplecpp::TokenList &expr, const simplecpp::DUI
2723
2723
}
2724
2724
}
2725
2725
2726
- for (simplecpp::Token *headerToken = tok1->next ; headerToken != tok3; headerToken = headerToken->next )
2726
+ for (const simplecpp::Token *headerToken = tok1->next ; headerToken != tok3; headerToken = headerToken->next )
2727
2727
header += headerToken->str ();
2728
2728
// cppcheck-suppress selfAssignment - platform-dependent implementation
2729
2729
header = realFilename (header);
0 commit comments