@@ -2176,10 +2176,11 @@ namespace simplecpp {
21762176
21772177 /* * Expand while the expansion result in @p temp ends with the name of a
21782178 * function-like macro whose arguments are supplied by the tokens after @p tok.
2179- * Each round consumes that macro call from the token stream, so tok always
2180- * advances. The @p gatherCall callback copies the "( ... )" tokens that follow
2181- * @p lpar into its output list and returns the matching ')', or nullptr when no
2182- * complete call is available. Returns the last consumed token. */
2179+ * Each round consumes that macro call from the token stream. The @p gatherCall
2180+ * callback copies the "( ... )" tokens that follow @p lpar into its output list
2181+ * and returns the matching ')', or nullptr when no complete call is available.
2182+ * Returns the first token that was not consumed (tok->next when no call was
2183+ * expanded). */
21832184 template <class GatherCall >
21842185 const Token *expandTrailingCalls (TokenList &output, TokenList &temp, const Location &loc, const Token *tok, const MacroMap ¯os, const std::set<TokenString> &expandedmacros, GatherCall gatherCall) const {
21852186 while (const Macro * const calledMacro = rescanMacro (temp, tok, macros, expandedmacros)) {
@@ -2195,13 +2196,13 @@ namespace simplecpp {
21952196 tok = closingPar;
21962197 }
21972198 output.takeTokens (temp);
2198- return tok;
2199+ return tok-> next ;
21992200 }
22002201
22012202 const Token *recursiveExpandToken (TokenList &output, TokenList &temp, const Location &loc, const Token *tok, const MacroMap ¯os, const std::set<TokenString> &expandedmacros, const std::vector<const Token*> ¶metertokens) const {
22022203 return expandTrailingCalls (output, temp, loc, tok, macros, expandedmacros, [&](TokenList &temp2, const Token *lpar) {
22032204 return appendTokens (temp2, loc, lpar, macros, expandedmacros, parametertokens);
2204- })-> next ;
2205+ });
22052206 }
22062207
22072208 const Token *expandToken (TokenList &output, const Location &loc, const Token *tok, const MacroMap ¯os, const std::set<TokenString> &expandedmacros, const std::vector<const Token*> ¶metertokens) const {
@@ -2345,7 +2346,7 @@ namespace simplecpp {
23452346 }
23462347 }
23472348 return nullptr ;
2348- })-> next ;
2349+ });
23492350 } else {
23502351 output.takeTokens (temp);
23512352 }
0 commit comments