Skip to content

Commit 6ab5d54

Browse files
committed
s [skip ci]
1 parent 14f9697 commit 6ab5d54

File tree

3 files changed

+36
-22
lines changed

3 files changed

+36
-22
lines changed

lib/cppcheck.cpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ static std::string detectPython(const CppCheck::ExecuteCmdFn &executeCommand)
424424
return "";
425425
}
426426

427+
/**
428+
* @throws InternalError thrown when Python execution failed
429+
*/
427430
static std::vector<picojson::value> executeAddon(const AddonInfo &addonInfo,
428431
const std::string &defaultPythonExe,
429432
const std::string &file,
@@ -1167,32 +1170,32 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str
11671170
hasValidConfig = true;
11681171

11691172
Tokenizer tokenizer(std::move(tokenlist), mErrorLogger);
1170-
try {
1171-
if (mSettings.showtime != ShowTime::NONE)
1172-
tokenizer.setTimerResults(&s_timerResults);
1173-
tokenizer.setDirectives(directives); // TODO: how to avoid repeated copies?
1173+
if (mSettings.showtime != ShowTime::NONE)
1174+
tokenizer.setTimerResults(&s_timerResults);
1175+
tokenizer.setDirectives(directives); // TODO: how to avoid repeated copies?
11741176

1175-
// locations macros
1176-
mLogger->setLocationMacros(tokenizer.tokens(), files);
1177+
// locations macros
1178+
mLogger->setLocationMacros(tokenizer.tokens(), files);
11771179

1178-
// If only errors are printed, print filename after the check
1179-
if (!mSettings.quiet && (!currentConfig.empty() || checkCount > 1)) {
1180-
std::string fixedpath = Path::toNativeSeparators(file.spath());
1181-
mErrorLogger.reportOut("Checking " + fixedpath + ": " + currentConfig + "...", Color::FgGreen);
1182-
}
1180+
// If only errors are printed, print filename after the check
1181+
if (!mSettings.quiet && (!currentConfig.empty() || checkCount > 1)) {
1182+
std::string fixedpath = Path::toNativeSeparators(file.spath());
1183+
mErrorLogger.reportOut("Checking " + fixedpath + ": " + currentConfig + "...", Color::FgGreen);
1184+
}
11831185

1184-
if (!tokenizer.tokens())
1185-
continue;
1186+
if (!tokenizer.tokens())
1187+
continue;
11861188

1187-
// skip rest of iteration if just checking configuration
1188-
if (mSettings.checkConfiguration)
1189-
continue;
1189+
// skip rest of iteration if just checking configuration
1190+
if (mSettings.checkConfiguration)
1191+
continue;
11901192

11911193
#ifdef HAVE_RULES
1192-
// Execute rules for "raw" code
1193-
executeRules("raw", tokenizer.list);
1194+
// Execute rules for "raw" code
1195+
executeRules("raw", tokenizer.list);
11941196
#endif
11951197

1198+
try {
11961199
// Simplify tokens into normal form, skip rest of iteration if failed
11971200
if (!tokenizer.simplifyTokens1(currentConfig, fileIndex))
11981201
continue;

lib/tokenize.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4230,6 +4230,9 @@ void VariableMap::addVariable(const std::string& varname, bool globalNamespace)
42304230
it->second = ++mVarId;
42314231
}
42324232

4233+
/**
4234+
* @throws Token* thrown when closing brackets are missing
4235+
*/
42334236
static bool setVarIdParseDeclaration(Token*& tok, const VariableMap& variableMap, bool executableScope, Standards::cstd_t cStandard)
42344237
{
42354238
const Token* const tok1 = tok;

lib/tokenize.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,16 +369,24 @@ class CPPCHECKLIB Tokenizer {
369369

370370
public:
371371

372-
/** Syntax error */
372+
/** Syntax error
373+
* @throws InternalError thrown unconditionally
374+
*/
373375
NORETURN void syntaxError(const Token *tok, const std::string &code = "") const;
374376

375-
/** Syntax error. Unmatched character. */
377+
/** Syntax error. Unmatched character.
378+
* @throws InternalError thrown unconditionally
379+
*/
376380
NORETURN void unmatchedToken(const Token *tok) const;
377381

378-
/** Syntax error. C++ code in C file. */
382+
/** Syntax error. C++ code in C file.
383+
* @throws InternalError thrown unconditionally
384+
*/
379385
NORETURN void syntaxErrorC(const Token *tok, const std::string &what) const;
380386

381-
/** Warn about unknown macro(s), configuration is recommended */
387+
/** Warn about unknown macro(s), configuration is recommended #
388+
* @throws InternalError thrown unconditionally
389+
*/
382390
NORETURN void unknownMacroError(const Token *tok1) const;
383391

384392
void unhandledCharLiteral(const Token *tok, const std::string& msg) const;

0 commit comments

Comments
 (0)