Skip to content

Commit 12f1d38

Browse files
authored
oss-fuzz: create settings only once (#7368)
1 parent ddd4b6c commit 12f1d38

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

oss-fuzz/main.cpp

+11-6
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,25 @@ class DummyErrorLogger : public ErrorLogger {
4242
void reportErr(const ErrorMessage& /*msg*/) override {}
4343
void reportProgress(const std::string& /*filename*/,
4444
const char /*stage*/[],
45-
const std::size_t /*value*/) override {} // FN
45+
const std::size_t /*value*/) override {}
4646
};
4747

48+
static Settings create_settings()
49+
{
50+
// TODO: load std.cfg
51+
Settings s;
52+
s.addEnabled("all");
53+
s.certainty.setEnabled(Certainty::inconclusive, true);
54+
return s;
55+
}
56+
static const Settings s_settings = create_settings();
4857
static DummyErrorLogger s_errorLogger;
4958
static const FileWithDetails s_file("test.cpp");
5059

5160
static void doCheck(const std::string& code)
5261
{
53-
// TODO: create the settings only once
54-
Settings s;
55-
s.addEnabled("all");
56-
s.certainty.setEnabled(Certainty::inconclusive, true);
5762
Suppressions supprs;
58-
CppCheck cppcheck(s, supprs, s_errorLogger, false, nullptr);
63+
CppCheck cppcheck(s_settings, supprs, s_errorLogger, false, nullptr);
5964
cppcheck.check(s_file, code);
6065
}
6166

0 commit comments

Comments
 (0)