| 1390 | } |
| 1391 | |
| 1392 | void globalSuppressions() { // Testing that Cppcheck::useGlobalSuppressions works (#8515) |
| 1393 | const auto settings = dinit(Settings, |
| 1394 | $.quiet = true, |
| 1395 | $.exitCode = 1, |
| 1396 | $.templateFormat = templateFormat); |
| 1397 | |
| 1398 | Suppressions supprs; |
| 1399 | ASSERT_EQUALS("", supprs.nomsg.addSuppressionLine("uninitvar")); |
| 1400 | |
| 1401 | CppCheck cppCheck(settings, supprs, *this, nullptr, false, nullptr); // <- do not "use global suppressions". pretend this is a thread that just checks a file. |
| 1402 | |
| 1403 | const char code[] = "int f() { int a; return a; }"; |
| 1404 | ASSERT_EQUALS(0, cppCheck.checkBuffer(FileWithDetails("test.c", Standards::Language::C, 0),code, sizeof(code))); // <- no unsuppressed error is seen |
| 1405 | ASSERT_EQUALS("[test.c:1:25]: (error) Uninitialized variable: a [uninitvar]\n", errout_str()); // <- report error so ThreadExecutor can suppress it and make sure the global suppression is matched. |
| 1406 | } |
| 1407 | |
| 1408 | void inlinesuppress_unusedFunction() const { // #4210, #4946 - wrong report of "unmatchedSuppression" for "unusedFunction" |
| 1409 | SuppressionList suppressions; |
nothing calls this directly
no test coverage detected