Skip to content

Commit

Permalink
fix clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
empiredan committed Nov 5, 2024
1 parent da2a1b0 commit e68ab2c
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/rpc/rpc_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ bool rpc_client_matcher::on_recv_reply(network *net, uint64_t key, message_ex *r
}

auto *req = call->get_request();
auto spec = task_spec::get(req->local_rpc_code);
auto *spec = task_spec::get(req->local_rpc_code);

// if rpc is early terminated with empty reply
if (nullptr == reply) {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/fault_injector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void fault_injector::install(service_spec &spec)

s_fj_opts = new fj_opt[dsn::task_code::max() + 1];
fj_opt default_opt;
read_config("task..default", default_opt);
read_config("task..default", default_opt, nullptr);

for (int i = 0; i <= dsn::task_code::max(); i++) {
if (i == TASK_CODE_INVALID)
Expand Down
2 changes: 1 addition & 1 deletion src/task/simple_task_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "simple_task_queue.h"

#include <stdint.h>
#include <cstdint>
#include <memory>
#include <string>
#include <utility>
Expand Down
2 changes: 1 addition & 1 deletion src/task/simple_task_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class simple_task_queue : public task_queue
task *dequeue(/*inout*/ int &batch_size) override;

private:
typedef utils::blocking_priority_queue<task *, TASK_PRIORITY_COUNT> tqueue;
using tqueue = utils::blocking_priority_queue<task *, TASK_PRIORITY_COUNT>;
tqueue _samples;
};

Expand Down
2 changes: 1 addition & 1 deletion src/task/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ task::~task()
}
}

bool task::set_retry(bool enqueue_immediately /*= true*/)
bool task::set_retry(bool enqueue_immediately)
{
task_state RUNNING_STATE = TASK_STATE_RUNNING;
if (_state.compare_exchange_strong(
Expand Down
2 changes: 1 addition & 1 deletion src/task/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class task : public ref_counter, public extensible_object<task, 4>
// return:
// true : change task state from TASK_STATE_RUNNING to TASK_STATE_READY succeed
// false : change task state failed
bool set_retry(bool enqueue_immediately = true);
bool set_retry(bool enqueue_immediately);

void set_error_code(error_code err) { _error = err; }
void set_delay(int delay_milliseconds) { _delay_milliseconds = delay_milliseconds; }
Expand Down
4 changes: 1 addition & 3 deletions src/task/task_engine.sim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,8 @@ void sim_lock_provider::unlock()
}

sim_lock_nr_provider::sim_lock_nr_provider(lock_nr_provider *inner_provider)
: lock_nr_provider(inner_provider), _sema(1, nullptr)
: lock_nr_provider(inner_provider), _current_holder(-1), _lock_depth(0), _sema(1, nullptr)
{
_current_holder = -1;
_lock_depth = 0;
}

void sim_lock_nr_provider::lock()
Expand Down
9 changes: 7 additions & 2 deletions src/task/task_engine.sim.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class sim_semaphore_provider : public semaphore_provider
{
}

public:
void signal(int count) override;
bool wait(int timeout_milliseconds) override;

Expand All @@ -91,7 +90,7 @@ class sim_semaphore_provider : public semaphore_provider
class sim_lock_provider : public lock_provider
{
public:
sim_lock_provider(lock_provider *inner_provider);
explicit sim_lock_provider(lock_provider *inner_provider);
~sim_lock_provider() override;

void lock() override;
Expand All @@ -118,6 +117,9 @@ class sim_lock_nr_provider : public lock_nr_provider
int _lock_depth; // 0 for not locked;
int _current_holder; // -1 for invalid
sim_semaphore_provider _sema;

DISALLOW_COPY_AND_ASSIGN(sim_lock_nr_provider);
DISALLOW_MOVE_AND_ASSIGN(sim_lock_nr_provider);
};

// degrade to lock_nr for simplicity
Expand All @@ -141,6 +143,9 @@ class sim_rwlock_nr_provider : public rwlock_nr_provider

private:
sim_lock_nr_provider _l;

DISALLOW_COPY_AND_ASSIGN(sim_rwlock_nr_provider);
DISALLOW_MOVE_AND_ASSIGN(sim_rwlock_nr_provider);
};

} // namespace tools
Expand Down
2 changes: 1 addition & 1 deletion src/task/task_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ bool task_spec::init()

task_spec default_spec(
0, "placeholder", TASK_TYPE_COMPUTE, TASK_PRIORITY_COMMON, THREAD_POOL_DEFAULT);
if (!read_config("task..default", default_spec))
if (!read_config("task..default", default_spec, nullptr))
return false;

for (int code = 0; code <= dsn::task_code::max(); code++) {
Expand Down
3 changes: 1 addition & 2 deletions src/utils/config_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
/// please refer to "task_spec.h". it's a very good example

#define CONFIG_BEGIN(t_struct) \
inline bool read_config( \
const char *section, /*out*/ t_struct &val, t_struct *default_value = nullptr) \
inline bool read_config(const char *section, /*out*/ t_struct &val, t_struct *default_value) \
{

#define CONFIG_END \
Expand Down

0 comments on commit e68ab2c

Please sign in to comment.