Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Checks: >
-modernize-avoid-c-arrays,
-modernize-loop-convert,
-modernize-pass-by-value,
-modernize-return-braced-init-list,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-readability-avoid-nested-conditional-operator,
Expand Down
10 changes: 5 additions & 5 deletions simplecpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1699,19 +1699,19 @@ namespace simplecpp {
: Error(loc, format(macroName, message)) {}

static inline invalidHashHash unexpectedToken(const Location &loc, const std::string &macroName, const Token *tokenA) {
return invalidHashHash(loc, macroName, "Unexpected token '"+ tokenA->str()+"'");
return {loc, macroName, "Unexpected token '"+ tokenA->str()+"'"};
}

static inline invalidHashHash cannotCombine(const Location &loc, const std::string &macroName, const Token *tokenA, const Token *tokenB) {
return invalidHashHash(loc, macroName, "Combining '"+ tokenA->str()+ "' and '"+ tokenB->str() + "' yields an invalid token.");
return {loc, macroName, "Combining '"+ tokenA->str()+ "' and '"+ tokenB->str() + "' yields an invalid token."};
}

static inline invalidHashHash unexpectedNewline(const Location &loc, const std::string &macroName) {
return invalidHashHash(loc, macroName, "Unexpected newline");
return {loc, macroName, "Unexpected newline"};
}

static inline invalidHashHash universalCharacterUB(const Location &loc, const std::string &macroName, const Token* tokenA, const std::string& strAB) {
return invalidHashHash(loc, macroName, "Combining '\\"+ tokenA->str()+ "' and '"+ strAB.substr(tokenA->str().size()) + "' yields universal character '\\" + strAB + "'. This is undefined behavior according to C standard chapter 5.1.1.2, paragraph 4.");
return {loc, macroName, "Combining '\\"+ tokenA->str()+ "' and '"+ strAB.substr(tokenA->str().size()) + "' yields universal character '\\" + strAB + "'. This is undefined behavior according to C standard chapter 5.1.1.2, paragraph 4."};
}
};
private:
Expand Down Expand Up @@ -1828,7 +1828,7 @@ namespace simplecpp {

std::vector<const Token *> getMacroParameters(const Token *nameTokInst, bool calledInDefine) const {
if (!nameTokInst->next || nameTokInst->next->op != '(' || !functionLike())
return std::vector<const Token *>();
return {};

std::vector<const Token *> parametertokens;
parametertokens.push_back(nameTokInst->next);
Expand Down
2 changes: 1 addition & 1 deletion test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static void testcase(const std::string &name, void (*f)(), int argc, char * cons
static simplecpp::TokenList makeTokenList(const char code[], std::size_t size, std::vector<std::string> &filenames, const std::string &filename=std::string(), simplecpp::OutputList *outputList=nullptr)
{
std::istringstream istr(std::string(code, size));
return simplecpp::TokenList(istr,filenames,filename,outputList);
return {istr,filenames,filename,outputList};
}

static simplecpp::TokenList makeTokenList(const char code[], std::vector<std::string> &filenames, const std::string &filename=std::string(), simplecpp::OutputList *outputList=nullptr)
Expand Down