@@ -1942,26 +1942,27 @@ void Tokenizer::simplifyRoundCurlyParentheses()
19421942void Tokenizer::simplifySQL ()
19431943{
19441944 for (Token *tok = list.front (); tok; tok = tok->next ()) {
1945- if (Token::simpleMatch (tok, " __CPPCHECK_EMBEDDED_SQL_EXEC__ SQL" )) {
1946- const Token *end = findSQLBlockEnd (tok);
1947- if (end == nullptr )
1948- syntaxError (nullptr );
1945+ if (!Token::simpleMatch (tok, " __CPPCHECK_EMBEDDED_SQL_EXEC__ SQL" ))
1946+ continue ;
19491947
1950- const std::string instruction = tok-> stringifyList (end );
1951- // delete all tokens until the embedded SQL block end
1952- Token::eraseTokens (tok, end );
1948+ const Token *end = findSQLBlockEnd (tok );
1949+ if (end == nullptr )
1950+ syntaxError ( nullptr );
19531951
1954- // insert "asm ( "instruction" ) ;"
1955- tok->str (" asm" );
1956- // it can happen that 'end' is NULL when wrong code is inserted
1957- if (!tok->next ())
1958- tok->insertToken (" ;" );
1959- tok->insertToken (" )" );
1960- tok->insertToken (" \" " + instruction + " \" " );
1961- tok->insertToken (" (" );
1962- // jump to ';' and continue
1963- tok = tok->tokAt (3 );
1964- }
1952+ const std::string instruction = tok->stringifyList (end);
1953+ // delete all tokens until the embedded SQL block end
1954+ Token::eraseTokens (tok, end);
1955+
1956+ // insert "asm ( "instruction" ) ;"
1957+ tok->str (" asm" );
1958+ // it can happen that 'end' is NULL when wrong code is inserted
1959+ if (!tok->next ())
1960+ tok->insertToken (" ;" );
1961+ tok->insertToken (" )" );
1962+ tok->insertToken (" \" " + instruction + " \" " );
1963+ tok->insertToken (" (" );
1964+ // jump to ';' and continue
1965+ tok = tok->tokAt (3 );
19651966 }
19661967}
19671968
@@ -10058,7 +10059,7 @@ void Tokenizer::SimplifyNamelessRValueReferences()
1005810059 }
1005910060}
1006010061
10061- const Token *Tokenizer::findSQLBlockEnd (const Token *tokSQLStart) const
10062+ const Token *Tokenizer::findSQLBlockEnd (const Token *tokSQLStart)
1006210063{
1006310064 const Token *tokLastEnd = nullptr ;
1006410065 for (const Token *tok = tokSQLStart->tokAt (2 ); tok != nullptr ; tok = tok->next ()) {
0 commit comments