Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tidy: Enable readability checks #361

Merged
merged 4 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ Checks: >
-performance-inefficient-string-concatenation,
-performance-unnecessary-value-param,
portability-*,
readability-*,
-readability-braces-around-statements,
-readability-else-after-return,
-readability-implicit-bool-conversion,
-readability-magic-numbers,
-readability-named-parameter,
-readability-qualified-auto,

WarningsAsErrors: '*'
FormatStyle: file
4 changes: 2 additions & 2 deletions test/spectests/spectests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,9 @@ class test_runner
std::cout << "SKIPPED " << message << "\n";
}

void log(std::string_view message) const { std::cout << message << "\n"; }
static void log(std::string_view message) { std::cout << message << "\n"; }

void log_no_newline(std::string_view message) const { std::cout << message << std::flush; }
static void log_no_newline(std::string_view message) { std::cout << message << std::flush; }

test_settings m_settings;
std::unordered_map<std::string, std::unique_ptr<fizzy::Instance>> m_instances;
Expand Down
4 changes: 2 additions & 2 deletions test/utils/asserts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <gmock/gmock.h>
#include <iosfwd>

MATCHER(Traps, "")
MATCHER(Traps, "") // NOLINT(readability-redundant-string-init)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw what is this error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It generates code like std::string s = "".

{
return arg.trapped;
}
Expand All @@ -18,7 +18,7 @@ MATCHER(Result, "empty result")
return !arg.trapped && arg.stack.size() == 0;
}

MATCHER_P(Result, value, "")
MATCHER_P(Result, value, "") // NOLINT(readability-redundant-string-init)
{
return !arg.trapped && arg.stack.size() == 1 && arg.stack[0] == uint64_t(value);
}
Expand Down
5 changes: 1 addition & 4 deletions test/utils/wabt_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ bool WabtEngine::instantiate(bytes_view wasm_binary)

// Run start function (this will return ok if no start function is present)
const wabt::interp::ExecResult r = m_executor.RunStartFunction(m_module);
if (r.result != wabt::interp::Result::Ok)
return false;

return true;
return r.result == wabt::interp::Result::Ok;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still hoped to prove both branches are covered with #381, but will add back the inverse of this commit for a test.

}

bool WabtEngine::init_memory(bytes_view memory)
Expand Down