Skip to content

Commit 73a5159

Browse files
committed
Wip cmdline flag
1 parent da0456b commit 73a5159

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

cli/cmdlineparser.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,10 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
852852
else if (std::strcmp(argv[i], "--inline-suppr") == 0)
853853
mSettings.inlineSuppressions = true;
854854

855+
// Enables handling of polyspace suppressions.
856+
else if (std::strcmp(argv[i], "--polyspace-suppr") == 0)
857+
mSettings.polyspaceSuppressions = true;
858+
855859
// Checking threads
856860
else if (std::strncmp(argv[i], "-j", 2) == 0) {
857861
std::string numberString;
@@ -1836,6 +1840,7 @@ void CmdLineParser::printHelp(bool premium) const
18361840
" --inline-suppr Enable inline suppressions. Use them by placing one or\n"
18371841
" more comments, like: '// cppcheck-suppress warningId'\n"
18381842
" on the lines before the warning to suppress.\n"
1843+
" --polyspace-suppr Handle polyspace suppressions for supported coding standards.\n"
18391844
" -j <jobs> Start <jobs> threads to do the checking simultaneously.\n"
18401845
" -l <load> Specifies that no new threads should be started if\n"
18411846
" there are other threads running and the load average is\n"

lib/preprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static void addInlineSuppressions(const simplecpp::TokenList &tokens, const Sett
208208
continue;
209209
}
210210

211-
if (polyspace::isPolyspaceComment(tok->str())) {
211+
if (settings.polyspaceSuppressions && polyspace::isPolyspaceComment(tok->str())) {
212212
polyspaceParser.parse(tok->str(), tok->location.line, tokens.file(tok->location));
213213
continue;
214214
}

lib/settings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ class CPPCHECKLIB WARN_UNUSED Settings {
276276
/** @brief Is --inline-suppr given? */
277277
bool inlineSuppressions{};
278278

279+
/** @brief Is --polyspace-suppr given? */
280+
bool polyspaceSuppressions{};
281+
279282
/** @brief How many processes/threads should do checking at the same
280283
time. Default is 1. (-j N) */
281284
unsigned int jobs = 1;

0 commit comments

Comments
 (0)