MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / suppress_error_library

Method suppress_error_library

test/testcppcheck.cpp:339–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337 }
338
339 void suppress_error_library() const
340 {
341 ScopedFile file("suppr_err_lib.c",
342 "void f()\n"
343 "{\n"
344 " (void)(*((int*)0));\n"
345 "}");
346
347 const char xmldata[] = R"(<def format="2"><markup ext=".c" reporterrors="false"/></def>)";
348 const Settings s = settingsBuilder().libraryxml(xmldata).build();
349 Suppressions supprs;
350 ErrorLogger2 errorLogger;
351 CppCheck cppcheck(s, supprs, errorLogger, nullptr, false, {});
352 ASSERT_EQUALS(0, cppcheck.check(FileWithDetails(file.path(), Path::identify(file.path(), false), 0)));
353 // TODO: how to properly disable these warnings?
354 errorLogger.ids.erase(std::remove_if(errorLogger.ids.begin(), errorLogger.ids.end(), [](const std::string& id) {
355 return id == "logChecker";
356 }), errorLogger.ids.end());
357 ASSERT_EQUALS(0, errorLogger.ids.size());
358 }
359
360 // TODO: how to actually get duplicated findings
361 void unique_errors() const

Callers

nothing calls this directly

Calls 7

buildMethod · 0.80
FileWithDetailsClass · 0.50
checkMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected