Cppcheck
settings.cpp
Go to the documentation of this file.
1 /*
2  * Cppcheck - A tool for static C/C++ code analysis
3  * Copyright (C) 2007-2024 Cppcheck team.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #include "config.h"
20 #include "settings.h"
21 #include "path.h"
22 #include "summaries.h"
23 #include "vfvalue.h"
24 
25 #include <cctype>
26 #include <fstream>
27 #include <sstream>
28 #include <utility>
29 
30 #include "json.h"
31 
32 #ifndef _WIN32
33 #include <unistd.h> // for getpid()
34 #else
35 #include <process.h> // for getpid()
36 #endif
37 
38 
39 std::atomic<bool> Settings::mTerminated;
40 
41 const char Settings::SafeChecks::XmlRootName[] = "safe-checks";
42 const char Settings::SafeChecks::XmlClasses[] = "class-public";
43 const char Settings::SafeChecks::XmlExternalFunctions[] = "external-functions";
44 const char Settings::SafeChecks::XmlInternalFunctions[] = "internal-functions";
45 const char Settings::SafeChecks::XmlExternalVariables[] = "external-variables";
46 
47 static int getPid()
48 {
49 #ifndef _WIN32
50  return getpid();
51 #else
52  return _getpid();
53 #endif
54 }
55 
57 {
62  pid = getPid();
63 }
64 
65 std::string Settings::loadCppcheckCfg(Settings& settings, Suppressions& suppressions)
66 {
67  // TODO: this always needs to be run *after* the Settings has been filled
68  static const std::string cfgFilename = "cppcheck.cfg";
69  std::string fileName;
70 #ifdef FILESDIR
71  if (Path::isFile(Path::join(FILESDIR, cfgFilename)))
72  fileName = Path::join(FILESDIR, cfgFilename);
73 #endif
74  // cppcheck-suppress knownConditionTrueFalse
75  if (fileName.empty()) {
76  // TODO: make sure that exename is set
77  fileName = Path::getPathFromFilename(settings.exename) + cfgFilename;
78  if (!Path::isFile(fileName))
79  return "";
80  }
81 
82  std::ifstream fin(fileName);
83  if (!fin.is_open())
84  return "could not open file";
85  picojson::value json;
86  fin >> json;
87  {
88  const std::string& lastErr = picojson::get_last_error();
89  if (!lastErr.empty())
90  return "not a valid JSON - " + lastErr;
91  }
92  const picojson::object& obj = json.get<picojson::object>();
93  {
94  const picojson::object::const_iterator it = obj.find("productName");
95  if (it != obj.cend()) {
96  const auto& v = it->second;
97  if (!v.is<std::string>())
98  return "'productName' is not a string";
99  settings.cppcheckCfgProductName = v.get<std::string>();
100  }
101  }
102  {
103  const picojson::object::const_iterator it = obj.find("about");
104  if (it != obj.cend()) {
105  const auto& v = it->second;
106  if (!v.is<std::string>())
107  return "'about' is not a string";
108  settings.cppcheckCfgAbout = v.get<std::string>();
109  }
110  }
111  {
112  const picojson::object::const_iterator it = obj.find("addons");
113  if (it != obj.cend()) {
114  const auto& entry = it->second;
115  if (!entry.is<picojson::array>())
116  return "'addons' is not an array";
117  for (const picojson::value &v : entry.get<picojson::array>())
118  {
119  if (!v.is<std::string>())
120  return "'addons' array entry is not a string";
121  const std::string &s = v.get<std::string>();
122  if (!Path::isAbsolute(s))
123  settings.addons.emplace(Path::join(Path::getPathFromFilename(fileName), s));
124  else
125  settings.addons.emplace(s);
126  }
127  }
128  }
129  {
130  const picojson::object::const_iterator it = obj.find("suppressions");
131  if (it != obj.cend()) {
132  const auto& entry = it->second;
133  if (!entry.is<picojson::array>())
134  return "'suppressions' is not an array";
135  for (const picojson::value &v : entry.get<picojson::array>())
136  {
137  if (!v.is<std::string>())
138  return "'suppressions' array entry is not a string";
139  const std::string &s = v.get<std::string>();
140  const std::string err = suppressions.nomsg.addSuppressionLine(s);
141  if (!err.empty())
142  return "could not parse suppression '" + s + "' - " + err;
143  }
144  }
145  }
146  {
147  const picojson::object::const_iterator it = obj.find("safety");
148  if (it != obj.cend()) {
149  const auto& v = it->second;
150  if (!v.is<bool>())
151  return "'safety' is not a bool";
152  settings.safety = settings.safety || v.get<bool>();
153  }
154  }
155 
156  return "";
157 }
158 
159 std::pair<std::string, std::string> Settings::getNameAndVersion(const std::string& productName) {
160  if (productName.empty())
161  return {};
162  const std::string::size_type pos1 = productName.rfind(' ');
163  if (pos1 == std::string::npos)
164  return {};
165  if (pos1 + 2 >= productName.length())
166  return {};
167  for (auto pos2 = pos1 + 1; pos2 < productName.length(); ++pos2) {
168  const char c = productName[pos2];
169  const char prev = productName[pos2-1];
170  if (std::isdigit(c))
171  continue;
172  if (c == '.' && std::isdigit(prev))
173  continue;
174  if (c == 's' && pos2 + 1 == productName.length() && std::isdigit(prev))
175  continue;
176  return {};
177  }
178  return {productName.substr(0, pos1), productName.substr(pos1+1)};
179 }
180 
181 std::string Settings::parseEnabled(const std::string &str, std::tuple<SimpleEnableGroup<Severity>, SimpleEnableGroup<Checks>> &groups)
182 {
183  // Enable parameters may be comma separated...
184  if (str.find(',') != std::string::npos) {
185  std::string::size_type prevPos = 0;
186  std::string::size_type pos = 0;
187  while ((pos = str.find(',', pos)) != std::string::npos) {
188  if (pos == prevPos)
189  return std::string("--enable parameter is empty");
190  std::string errmsg(parseEnabled(str.substr(prevPos, pos - prevPos), groups));
191  if (!errmsg.empty())
192  return errmsg;
193  ++pos;
194  prevPos = pos;
195  }
196  if (prevPos >= str.length())
197  return std::string("--enable parameter is empty");
198  return parseEnabled(str.substr(prevPos), groups);
199  }
200 
201  auto& severity = std::get<0>(groups);
202  auto& checks = std::get<1>(groups);
203 
204  if (str == "all") {
205  // "error" is always enabled and cannot be controlled - so exclude it from "all"
206  SimpleEnableGroup<Severity> newSeverity;
207  newSeverity.fill();
208  newSeverity.disable(Severity::error);
209  severity.enable(newSeverity);
212  } else if (str == "warning") {
214  } else if (str == "style") {
216  } else if (str == "performance") {
218  } else if (str == "portability") {
220  } else if (str == "information") {
222  } else if (str == "unusedFunction") {
224  } else if (str == "missingInclude") {
226  }
227 #ifdef CHECK_INTERNAL
228  else if (str == "internal") {
230  }
231 #endif
232  else {
233  // the actual option is prepending in the applyEnabled() call
234  if (str.empty())
235  return " parameter is empty";
236  return " parameter with the unknown name '" + str + "'";
237  }
238 
239  return "";
240 }
241 
242 std::string Settings::addEnabled(const std::string &str)
243 {
244  return applyEnabled(str, true);
245 }
246 
247 std::string Settings::removeEnabled(const std::string &str)
248 {
249  return applyEnabled(str, false);
250 }
251 
252 std::string Settings::applyEnabled(const std::string &str, bool enable)
253 {
254  std::tuple<SimpleEnableGroup<Severity>, SimpleEnableGroup<Checks>> groups;
255  std::string errmsg = parseEnabled(str, groups);
256  if (!errmsg.empty())
257  return (enable ? "--enable" : "--disable") + errmsg;
258 
259  const auto s = std::get<0>(groups);
260  const auto c = std::get<1>(groups);
261  if (enable) {
262  severity.enable(s);
263  checks.enable(c);
264  }
265  else {
266  severity.disable(s);
267  checks.disable(c);
268  }
269  // FIXME: hack to make sure "error" is always enabled
271  return errmsg;
272 }
273 
274 bool Settings::isEnabled(const ValueFlow::Value *value, bool inconclusiveCheck) const
275 {
276  if (!severity.isEnabled(Severity::warning) && (value->condition || value->defaultArg))
277  return false;
278  if (!certainty.isEnabled(Certainty::inconclusive) && (inconclusiveCheck || value->isInconclusive()))
279  return false;
280  return true;
281 }
282 
284 {
286 }
287 
289 {
290  if (level == CheckLevel::normal) {
291  // Checking should finish in reasonable time.
292  checkLevel = level;
295  }
296  else if (level == CheckLevel::exhaustive) {
297  // Checking can take a little while. ~ 10 times slower than normal analysis is OK.
301  }
302 }
303 
304 // TODO: auto generate these tables
305 
306 static const std::set<std::string> autosarCheckers{
307  "accessMoved",
308  "argumentSize",
309  "arrayIndexOutOfBounds",
310  "arrayIndexOutOfBoundsCond",
311  "arrayIndexThenCheck",
312  "bufferAccessOutOfBounds",
313  "comparePointers",
314  "constParameter",
315  "cstyleCast",
316  "ctuOneDefinitionRuleViolation",
317  "doubleFree",
318  "duplInheritedMember",
319  "duplicateBreak",
320  "exceptThrowInDestructor",
321  "funcArgNamesDifferent",
322  "functionConst",
323  "functionStatic",
324  "invalidContainer",
325  "memleak",
326  "mismatchAllocDealloc",
327  "missingReturn",
328  "negativeIndex",
329  "noExplicitConstructor",
330  "nullPointer",
331  "nullPointerArithmetic",
332  "nullPointerArithmeticRedundantCheck",
333  "nullPointerDefaultArg",
334  "nullPointerRedundantCheck",
335  "objectIndex",
336  "overlappingWriteFunction",
337  "overlappingWriteUnion",
338  "pointerOutOfBounds",
339  "pointerOutOfBoundsCond",
340  "preprocessorErrorDirective",
341  "redundantAssignment",
342  "redundantInitialization",
343  "returnDanglingLifetime",
344  "shadowArgument",
345  "shadowFunction",
346  "shadowVariable",
347  "shiftTooManyBits",
348  "sizeofFunctionCall",
349  "throwInNoexceptFunction",
350  "uninitData",
351  "uninitMember",
352  "unreachableCode",
353  "unreadVariable",
354  "unsignedLessThanZero",
355  "unusedFunction",
356  "unusedStructMember",
357  "unusedValue",
358  "unusedVariable",
359  "useInitializationList",
360  "variableScope",
361  "virtualCallInConstructor",
362  "zerodiv",
363  "zerodivcond"
364 };
365 
366 static const std::set<std::string> certCCheckers{
367  "IOWithoutPositioning",
368  "autoVariables",
369  "autovarInvalidDeallocation",
370  "bitwiseOnBoolean",
371  "comparePointers",
372  "danglingLifetime",
373  "deallocret",
374  "deallocuse",
375  "doubleFree",
376  "floatConversionOverflow",
377  "invalidFunctionArg",
378  "invalidLengthModifierError",
379  "invalidLifetime",
380  "invalidScanfFormatWidth",
381  "invalidscanf",
382  "leakReturnValNotUsed",
383  "leakUnsafeArgAlloc",
384  "memleak",
385  "memleakOnRealloc",
386  "mismatchAllocDealloc",
387  "missingReturn",
388  "nullPointer",
389  "nullPointerArithmetic",
390  "nullPointerArithmeticRedundantCheck",
391  "nullPointerDefaultArg",
392  "nullPointerRedundantCheck",
393  "preprocessorErrorDirective",
394  "resourceLeak",
395  "sizeofCalculation",
396  "stringLiteralWrite",
397  "uninitStructMember",
398  "uninitdata",
399  "uninitvar",
400  "unknownEvaluationOrder",
401  "useClosedFile",
402  "wrongPrintfScanfArgNum",
403  "wrongPrintfScanfParameterPositionError"
404 };
405 
406 static const std::set<std::string> certCppCheckers{
407  "IOWithoutPositioning",
408  "accessMoved",
409  "comparePointers",
410  "containerOutOfBounds",
411  "ctuOneDefinitionRuleViolation",
412  "danglingLifetime",
413  "danglingReference",
414  "danglingTempReference",
415  "danglingTemporaryLifetime",
416  "deallocThrow",
417  "deallocuse",
418  "doubleFree",
419  "eraseDereference",
420  "exceptThrowInDestructor",
421  "initializerList",
422  "invalidContainer",
423  "memleak",
424  "mismatchAllocDealloc",
425  "missingReturn",
426  "nullPointer",
427  "operatorEqToSelf",
428  "returnDanglingLifetime",
429  "sizeofCalculation",
430  "uninitvar",
431  "virtualCallInConstructor",
432  "virtualDestructor"
433 };
434 
435 static const std::set<std::string> misrac2012Checkers{
436  "alwaysFalse",
437  "alwaysTrue",
438  "argumentSize",
439  "autovarInvalidDeallocation",
440  "bufferAccessOutOfBounds",
441  "comparePointers",
442  "compareValueOutOfTypeRangeError",
443  "constParameterPointer",
444  "danglingLifetime",
445  "danglingTemporaryLifetime",
446  "duplicateBreak",
447  "funcArgNamesDifferent",
448  "incompatibleFileOpen",
449  "invalidFunctionArg",
450  "knownConditionTrueFalse",
451  "leakNoVarFunctionCall",
452  "leakReturnValNotUsed",
453  "memleak",
454  "memleakOnRealloc",
455  "missingReturn",
456  "overlappingWriteFunction",
457  "overlappingWriteUnion",
458  "pointerOutOfBounds",
459  "preprocessorErrorDirective",
460  "redundantAssignInSwitch",
461  "redundantAssignment",
462  "redundantCondition",
463  "resourceLeak",
464  "returnDanglingLifetime",
465  "shadowVariable",
466  "sizeofCalculation",
467  "sizeofwithsilentarraypointer",
468  "syntaxError",
469  "uninitvar",
470  "unknownEvaluationOrder",
471  "unreachableCode",
472  "unreadVariable",
473  "unusedLabel",
474  "unusedVariable",
475  "useClosedFile",
476  "writeReadOnlyFile"
477 };
478 
479 static const std::set<std::string> misrac2023Checkers{
480  "alwaysFalse",
481  "alwaysTrue",
482  "argumentSize",
483  "autovarInvalidDeallocation",
484  "bufferAccessOutOfBounds",
485  "comparePointers",
486  "compareValueOutOfTypeRangeError",
487  "constParameterPointer",
488  "danglingLifetime",
489  "danglingTemporaryLifetime",
490  "duplicateBreak",
491  "funcArgNamesDifferent",
492  "incompatibleFileOpen",
493  "invalidFunctionArg",
494  "knownConditionTrueFalse",
495  "leakNoVarFunctionCall",
496  "leakReturnValNotUsed",
497  "memleak",
498  "memleakOnRealloc",
499  "missingReturn",
500  "overlappingWriteFunction",
501  "overlappingWriteUnion",
502  "pointerOutOfBounds",
503  "preprocessorErrorDirective",
504  "redundantAssignInSwitch",
505  "redundantAssignment",
506  "redundantCondition",
507  "resourceLeak",
508  "returnDanglingLifetime",
509  "shadowVariable",
510  "sizeofCalculation",
511  "sizeofwithsilentarraypointer",
512  "syntaxError",
513  "uninitvar",
514  "unknownEvaluationOrder",
515  "unreachableCode",
516  "unreadVariable",
517  "unusedLabel",
518  "unusedVariable",
519  "useClosedFile",
520  "writeReadOnlyFile"
521 };
522 
523 static const std::set<std::string> misracpp2008Checkers{
524  "autoVariables",
525  "comparePointers",
526  "constParameter",
527  "constVariable",
528  "cstyleCast",
529  "ctuOneDefinitionRuleViolation",
530  "danglingLifetime",
531  "duplInheritedMember",
532  "duplicateBreak",
533  "exceptThrowInDestructor",
534  "funcArgNamesDifferent",
535  "functionConst",
536  "functionStatic",
537  "missingReturn",
538  "noExplicitConstructor",
539  "overlappingWriteFunction",
540  "overlappingWriteUnion",
541  "pointerOutOfBounds",
542  "preprocessorErrorDirective",
543  "redundantAssignment",
544  "redundantInitialization",
545  "returnReference",
546  "returnTempReference",
547  "shadowVariable",
548  "shiftTooManyBits",
549  "sizeofFunctionCall",
550  "uninitDerivedMemberVar",
551  "uninitDerivedMemberVarPrivate",
552  "uninitMemberVar",
553  "uninitMemberVarPrivate",
554  "uninitStructMember",
555  "uninitdata",
556  "uninitvar",
557  "unknownEvaluationOrder",
558  "unreachableCode",
559  "unreadVariable",
560  "unsignedLessThanZero",
561  "unusedFunction",
562  "unusedStructMember",
563  "unusedVariable",
564  "variableScope",
565  "virtualCallInConstructor"
566 };
567 
568 static const std::set<std::string> misracpp2023Checkers{
569  "accessForwarded",
570  "accessMoved",
571  "autoVariables",
572  "compareBoolExpressionWithInt",
573  "comparePointers",
574  "compareValueOutOfTypeRangeError",
575  "constParameter",
576  "constParameterReference",
577  "ctuOneDefinitionRuleViolation",
578  "danglingLifetime",
579  "identicalConditionAfterEarlyExit",
580  "identicalInnerCondition",
581  "ignoredReturnValue",
582  "invalidFunctionArg",
583  "invalidFunctionArgBool",
584  "invalidFunctionArgStr",
585  "knownConditionTrueFalse",
586  "missingReturn",
587  "noExplicitConstructor",
588  "operatorEqToSelf",
589  "overlappingWriteUnion",
590  "pointerOutOfBounds",
591  "pointerOutOfBoundsCond",
592  "preprocessorErrorDirective",
593  "redundantAssignInSwitch",
594  "redundantAssignment",
595  "redundantCopy",
596  "redundantInitialization",
597  "shadowVariable",
598  "subtractPointers",
599  "syntaxError",
600  "uninitMemberVar",
601  "uninitvar",
602  "unknownEvaluationOrder",
603  "unreachableCode",
604  "unreadVariable",
605  "virtualCallInConstructor"
606 };
607 
608 bool Settings::isPremiumEnabled(const char id[]) const
609 {
610  if (premiumArgs.find("autosar") != std::string::npos && autosarCheckers.count(id))
611  return true;
612  if (premiumArgs.find("cert-c-") != std::string::npos && certCCheckers.count(id))
613  return true;
614  if (premiumArgs.find("cert-c++") != std::string::npos && certCppCheckers.count(id))
615  return true;
616  if (premiumArgs.find("misra-c-") != std::string::npos && (misrac2012Checkers.count(id) || misrac2023Checkers.count(id)))
617  return true;
618  if (premiumArgs.find("misra-c++-2008") != std::string::npos && misracpp2008Checkers.count(id))
619  return true;
620  if (premiumArgs.find("misra-c++-2023") != std::string::npos && misracpp2023Checkers.count(id))
621  return true;
622  return false;
623 }
624 
625 void Settings::setMisraRuleTexts(const ExecuteCmdFn& executeCommand)
626 {
627  if (premiumArgs.find("--misra-c-20") != std::string::npos) {
628  const auto it = std::find_if(addonInfos.cbegin(), addonInfos.cend(), [](const AddonInfo& a) {
629  return a.name == "premiumaddon.json";
630  });
631  if (it != addonInfos.cend()) {
632  std::string arg;
633  if (premiumArgs.find("--misra-c-2023") != std::string::npos)
634  arg = "--misra-c-2023-rule-texts";
635  else
636  arg = "--misra-c-2012-rule-texts";
637  std::string output;
638  executeCommand(it->executable, {std::move(arg)}, "2>&1", output);
639  setMisraRuleTexts(output);
640  }
641  }
642 }
643 
644 void Settings::setMisraRuleTexts(const std::string& data)
645 {
646  mMisraRuleTexts.clear();
647  std::istringstream istr(data);
648  std::string line;
649  while (std::getline(istr, line)) {
650  std::string::size_type pos = line.find(' ');
651  if (pos == std::string::npos)
652  continue;
653  std::string id = line.substr(0, pos);
654  std::string text = line.substr(pos + 1);
655  if (id.empty() || text.empty())
656  continue;
657  mMisraRuleTexts[id] = std::move(text);
658  }
659 }
660 
661 std::string Settings::getMisraRuleText(const std::string& id, const std::string& text) const {
662  if (id.compare(0, 9, "misra-c20") != 0)
663  return text;
664  const auto it = mMisraRuleTexts.find(id.substr(id.rfind('-') + 1));
665  return it != mMisraRuleTexts.end() ? it->second : text;
666 }
667 
669 {
670  static constexpr ExecutorType defaultExecutor =
671 #if defined(HAS_THREADING_MODEL_FORK)
672  ExecutorType::Process;
673 #elif defined(HAS_THREADING_MODEL_THREAD)
674  ExecutorType::Thread;
675 #endif
676  return defaultExecutor;
677 }
static std::string join(const std::string &path1, const std::string &path2)
join 2 paths with '/' separators
Definition: path.cpp:339
static bool isFile(const std::string &path)
Checks if given path is a file.
Definition: path.cpp:329
static std::string getPathFromFilename(const std::string &filename)
Lookup the path part from a filename (e.g., '/tmp/a.h' -> '/tmp/', 'a.h' -> '')
Definition: path.cpp:88
static bool isAbsolute(const std::string &path)
Check if given path is absolute.
Definition: path.cpp:166
This is just a container for general settings so that we don't need to pass individual values to func...
Definition: settings.h:95
void loadSummaries()
Definition: settings.cpp:283
static std::atomic< bool > mTerminated
terminate checking
Definition: settings.h:99
static std::string loadCppcheckCfg(Settings &settings, Suppressions &suppressions)
Definition: settings.cpp:65
CheckLevel checkLevel
Definition: settings.h:465
int performanceValueFlowMaxSubFunctionArgs
max number of sets of arguments to pass to subfuncions in valueflow
Definition: settings.h:264
int pid
pid of cppcheck.
Definition: settings.h:267
std::string addEnabled(const std::string &str)
Enable extra checks by id.
Definition: settings.cpp:242
std::map< std::string, std::string > mMisraRuleTexts
Definition: settings.h:479
std::string getMisraRuleText(const std::string &id, const std::string &text) const
Definition: settings.cpp:661
ExecutorType
Definition: settings.h:198
std::string exename
Definition: settings.h:210
bool isEnabled(const ValueFlow::Value *value, bool inconclusiveCheck=false) const
Returns true if given value can be shown.
Definition: settings.cpp:274
SimpleEnableGroup< Checks > checks
Definition: settings.h:360
std::function< int(std::string, std::vector< std::string >, std::string, std::string &)> ExecuteCmdFn
Definition: settings.h:469
std::unordered_set< std::string > addons
addons, either filename of python/json file or json data
Definition: settings.h:109
void setMisraRuleTexts(const ExecuteCmdFn &executeCommand)
Definition: settings.cpp:625
bool safety
Safety certified behavior Show checkers report when Cppcheck finishes Make cppcheck checking more str...
Definition: settings.h:313
std::string removeEnabled(const std::string &str)
Disable extra checks by id.
Definition: settings.cpp:247
std::string buildDir
–cppcheck-build-dir.
Definition: settings.h:121
static std::pair< std::string, std::string > getNameAndVersion(const std::string &productName)
Definition: settings.cpp:159
std::string cppcheckCfgProductName
cppcheck.cfg: Custom product name
Definition: settings.h:165
std::vector< AddonInfo > addonInfos
the loaded addons infos
Definition: settings.h:112
std::string premiumArgs
Extra arguments for Cppcheck Premium addon.
Definition: settings.h:273
std::set< std::string > summaryReturn
Definition: settings.h:453
void setCheckLevel(CheckLevel level)
Definition: settings.cpp:288
std::string cppcheckCfgAbout
cppcheck.cfg: About text
Definition: settings.h:168
int performanceValueFlowMaxIfCount
–performance-valueflow-max-if-count=C
Definition: settings.h:261
Settings()
Definition: settings.cpp:56
static ExecutorType defaultExecutor()
Definition: settings.cpp:668
bool isPremiumEnabled(const char id[]) const
Is checker id enabled by premiumArgs.
Definition: settings.cpp:608
ExecutorType executor
Definition: settings.h:207
SimpleEnableGroup< Certainty > certainty
Definition: settings.h:359
std::string applyEnabled(const std::string &str, bool enable)
Definition: settings.cpp:252
SimpleEnableGroup< Severity > severity
Definition: settings.h:358
static std::string parseEnabled(const std::string &str, std::tuple< SimpleEnableGroup< Severity >, SimpleEnableGroup< Checks >> &groups)
Definition: settings.cpp:181
bool isEnabled(T flag) const
Definition: settings.h:66
void setEnabled(T flag, bool enabled)
Definition: settings.h:81
void disable(T flag)
Definition: settings.h:75
void enable(T flag)
Definition: settings.h:69
std::string addSuppressionLine(const std::string &line)
Don't show the given error.
bool defaultArg
Is this value passed as default parameter to the function?
Definition: vfvalue.h:299
const Token * condition
Condition that this value depends on.
Definition: vfvalue.h:280
bool isInconclusive() const
Definition: vfvalue.h:378
@ warning
Warning.
@ portability
Portability warning.
@ style
Style warning.
@ information
Checking information.
@ performance
Performance warning.
@ error
Programming error.
@ missingInclude
@ internalCheck
@ unusedFunction
CPPCHECKLIB void loadReturn(const std::string &buildDir, std::set< std::string > &summaryReturn)
Definition: summaries.cpp:156
static const std::set< std::string > autosarCheckers
Definition: settings.cpp:306
static const std::set< std::string > misrac2012Checkers
Definition: settings.cpp:435
static const std::set< std::string > misrac2023Checkers
Definition: settings.cpp:479
static const std::set< std::string > misracpp2023Checkers
Definition: settings.cpp:568
static const std::set< std::string > misracpp2008Checkers
Definition: settings.cpp:523
static const std::set< std::string > certCppCheckers
Definition: settings.cpp:406
static int getPid()
Definition: settings.cpp:47
static const std::set< std::string > certCCheckers
Definition: settings.cpp:366
static const char XmlExternalFunctions[]
Definition: settings.h:320
static const char XmlInternalFunctions[]
Definition: settings.h:321
static const char XmlClasses[]
Definition: settings.h:319
static const char XmlRootName[]
Definition: settings.h:318
static const char XmlExternalVariables[]
Definition: settings.h:322
SuppressionList nomsg
suppress message (–suppressions)
Definition: suppressions.h:264