@@ -459,8 +459,9 @@ namespace {
459459 // TODO: use ungetc() as well
460460 // UTF-16 has subsequent unget() calls
461461 fseek (file, -1 , SEEK_CUR);
462- } else
462+ } else {
463463 ungetc (ch, file);
464+ }
464465 }
465466
466467 FILE *file;
@@ -1181,8 +1182,9 @@ void simplecpp::TokenList::constFoldMulDivRem(Token *tok)
11811182 continue ;
11821183
11831184 long long result;
1184- if (tok->op == ' *' )
1185+ if (tok->op == ' *' ) {
11851186 result = (stringToLL (tok->previous ->str ()) * stringToLL (tok->next ->str ()));
1187+ }
11861188 else if (tok->op == ' /' || tok->op == ' %' ) {
11871189 const long long rhs = stringToLL (tok->next ->str ());
11881190 if (rhs == 0 )
@@ -1194,8 +1196,9 @@ void simplecpp::TokenList::constFoldMulDivRem(Token *tok)
11941196 result = (lhs / rhs);
11951197 else
11961198 result = (lhs % rhs);
1197- } else
1199+ } else {
11981200 continue ;
1201+ }
11991202
12001203 tok = tok->previous ;
12011204 tok->setstr (toString (result));
@@ -1419,8 +1422,9 @@ std::string simplecpp::TokenList::readUntil(Stream &stream, const Location &loca
14191422 ret.erase (ret.size ()-1U );
14201423 backslash = (next == ' \r ' );
14211424 update_ch = false ;
1422- } else if (next == ' \\ ' )
1425+ } else if (next == ' \\ ' ) {
14231426 update_ch = !update_ch;
1427+ }
14241428 ret += next;
14251429 } while (next == ' \\ ' );
14261430 if (update_ch)
@@ -1541,8 +1545,9 @@ namespace simplecpp {
15411545 if (this != &other) {
15421546 files = other.files ;
15431547 valueDefinedInCode_ = other.valueDefinedInCode_ ;
1544- if (other.tokenListDefine .empty ())
1548+ if (other.tokenListDefine .empty ()) {
15451549 parseDefine (other.nameTokDef );
1550+ }
15461551 else {
15471552 tokenListDefine = other.tokenListDefine ;
15481553 parseDefine (tokenListDefine.cfront ());
@@ -1611,15 +1616,17 @@ namespace simplecpp {
16111616 if (par==0 )
16121617 break ;
16131618 --par;
1614- } else if (macro2tok->op == ' )' )
1619+ } else if (macro2tok->op == ' )' ) {
16151620 ++par;
1621+ }
16161622 macro2tok = macro2tok->previous ;
16171623 }
16181624 if (macro2tok) { // macro2tok->op == '('
16191625 macro2tok = macro2tok->previous ;
16201626 expandedmacros.insert (name ());
1621- } else if (rawtok->op == ' (' )
1627+ } else if (rawtok->op == ' (' ) {
16221628 macro2tok = output2.back ();
1629+ }
16231630 if (!macro2tok || !macro2tok->name )
16241631 break ;
16251632 if (output2.cfront () != output2.cback () && macro2tok->str () == this ->name ())
@@ -1874,8 +1881,9 @@ namespace simplecpp {
18741881 tokens.back ()->macro = name ();
18751882 }
18761883
1877- if (tok->op == ' (' )
1884+ if (tok->op == ' (' ) {
18781885 ++par;
1886+ }
18791887 else if (tok->op == ' )' ) {
18801888 --par;
18811889 if (par == 0U )
@@ -2315,12 +2323,15 @@ namespace simplecpp {
23152323 const bool varargs = variadic && !args.empty () && B->str () == args[args.size ()-1U ];
23162324
23172325 if (expandArg (tokensB, B, parametertokens)) {
2318- if (tokensB.empty ())
2326+ if (tokensB.empty ()) {
23192327 strAB = A->str ();
2320- else if (varargs && A->op == ' ,' )
2328+ }
2329+ else if (varargs && A->op == ' ,' ) {
23212330 strAB = " ," ;
2322- else if (varargs && unexpectedA)
2331+ }
2332+ else if (varargs && unexpectedA) {
23232333 throw invalidHashHash::unexpectedToken (tok->location , name (), A);
2334+ }
23242335 else {
23252336 strAB = A->str () + tokensB.cfront ()->str ();
23262337 tokensB.deleteToken (tokensB.front ());
@@ -2758,8 +2769,9 @@ long long simplecpp::characterLiteralToLL(const std::string& str)
27582769 pos = 3 ;
27592770 } else if (str.size () >= 2 && (str[0 ] == ' L' || str[0 ] == ' U' ) && str[1 ] == ' \' ' ) {
27602771 pos = 2 ;
2761- } else
2772+ } else {
27622773 throw std::runtime_error (" expected a character literal" );
2774+ }
27632775
27642776 unsigned long long multivalue = 0 ;
27652777
@@ -3593,8 +3605,9 @@ void simplecpp::preprocess(simplecpp::TokenList &output, const simplecpp::TokenL
35933605 }
35943606
35953607 bool conditionIsTrue;
3596- if (ifstates.top () == AlwaysFalse || (ifstates.top () == ElseIsTrue && rawtok->str () != ELIF))
3608+ if (ifstates.top () == AlwaysFalse || (ifstates.top () == ElseIsTrue && rawtok->str () != ELIF)) {
35973609 conditionIsTrue = false ;
3610+ }
35983611 else if (rawtok->str () == IFDEF) {
35993612 conditionIsTrue = (macros.find (rawtok->next ->str ()) != macros.end () || (hasInclude && rawtok->next ->str () == HAS_INCLUDE));
36003613 maybeUsedMacros[rawtok->next ->str ()].push_back (rawtok->next ->location );
0 commit comments