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

refactor(macro): Use CHECK to replace dassert_f/dassert #1205

Merged
merged 5 commits into from
Oct 27, 2022

Conversation

acelyc111
Copy link
Member

@acelyc111 acelyc111 commented Oct 26, 2022

#1204

  • introduce CHECK
  • introduce CHECK_NOTNULL
  • use CHECK to replace part of dassert_f, which are used to check a single condition
  • use CHECK to replace part of dassert, which are used to check a single condition. And update to use fmt style

TODO: src/replica/mutation_log.cpp:970 should be fixed later

@github-actions github-actions bot added the cpp label Oct 26, 2022
@acelyc111 acelyc111 marked this pull request as ready for review October 26, 2022 04:30
foreverneverer
foreverneverer previously approved these changes Oct 27, 2022
@@ -369,7 +368,7 @@ void redis_parser::reply_all_ready()
std::vector<dsn::message_ex *> ready_responses;
fetch_and_dequeue_messages(ready_responses, true);
for (dsn::message_ex *m : ready_responses) {
dassert(m != nullptr, "");
CHECK(m, "");
Copy link
Contributor

Choose a reason for hiding this comment

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

It's better to user m != nullptr for pointer

Copy link
Member Author

Choose a reason for hiding this comment

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

Both are OK.
But in the future refactor, we are going to introduce CHECK_EQ and CHECK_NE, it's a bit of duplicate and strange if we judge the pointer like CHECK_NE(pointer, nullptr). I also consulted some other projects' habit, both styles are OK.

Copy link
Member Author

@acelyc111 acelyc111 Oct 27, 2022

Choose a reason for hiding this comment

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

Added a new macro CHECK_NOTNULL for pointers, similar to glog CHECK_NOTNULL

src/block_service/fds/fds_service.cpp Show resolved Hide resolved
src/base/value_schema_manager.cpp Outdated Show resolved Hide resolved
src/common/replication_common.cpp Outdated Show resolved Hide resolved
src/common/replication_common.cpp Outdated Show resolved Hide resolved
src/geo/lib/geo_client.cpp Outdated Show resolved Hide resolved
src/shell/commands/debugger.cpp Outdated Show resolved Hide resolved
src/test/bench_test/benchmark.cpp Outdated Show resolved Hide resolved
src/test/bench_test/benchmark.cpp Outdated Show resolved Hide resolved
src/test/kill_test/process_kill_testor.cpp Outdated Show resolved Hide resolved
src/test/pressure_test/main.cpp Outdated Show resolved Hide resolved
@empiredan empiredan merged commit c20a88d into apache:master Oct 27, 2022
@empiredan empiredan mentioned this pull request Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants