std::vector<std::string> args = *args_;
if (not args.empty()) {
char noarg[] = {'\0'};
- std::unique_ptr<char* []> argv(new char*[argc + 1]);
+ auto argv = std::make_unique<char*[]>(argc + 1);
for (int i = 0; i != argc; ++i)
argv[i] = args[i].empty() ? noarg : &args[i].front();
argv[argc] = nullptr;
.def(py::init([](std::vector<std::string> args) {
static char noarg[] = {'\0'};
int argc = static_cast<int>(args.size());
- std::unique_ptr<char* []> argv(new char*[argc + 1]);
+ auto argv = std::make_unique<char*[]>(argc + 1);
for (int i = 0; i != argc; ++i)
argv[i] = args[i].empty() ? noarg : &args[i].front();
argv[argc] = nullptr;
xbt_assert(mc_model_checker == nullptr, "Did you manage to start the MC twice in this process?");
- auto process = std::unique_ptr<simgrid::mc::RemoteSimulation>(new simgrid::mc::RemoteSimulation(pid));
+ auto process = std::make_unique<simgrid::mc::RemoteSimulation>(pid);
model_checker_.reset(new simgrid::mc::ModelChecker(std::move(process), sockets[1]));
mc_model_checker = model_checker_.get();
std::unique_ptr<simgrid::mc::VisitedState>
VisitedStates::addVisitedState(unsigned long state_number, simgrid::mc::State* graph_state, bool compare_snapshots)
{
- std::unique_ptr<simgrid::mc::VisitedState> new_state =
- std::unique_ptr<simgrid::mc::VisitedState>(new VisitedState(state_number));
+ auto new_state = std::make_unique<simgrid::mc::VisitedState>(state_number);
graph_state->system_state_ = new_state->system_state;
XBT_DEBUG("Snapshot %p of visited state %d (exploration stack state %d)", new_state->system_state.get(),
new_state->num, graph_state->num_);
const mc::PatternCommunicationList& initial_pattern = initial_communications_pattern[issuer->get_pid()];
const std::vector<PatternCommunication*>& incomplete_pattern = incomplete_communications_pattern[issuer->get_pid()];
- std::unique_ptr<PatternCommunication> pattern(new PatternCommunication());
+ auto pattern = std::make_unique<PatternCommunication>();
pattern->index = initial_pattern.index_comm + incomplete_pattern.size();
if (call_type == MC_CALL_TYPE_SEND) {
initial_communications_pattern.resize(maxpid);
incomplete_communications_pattern.resize(maxpid);
- std::unique_ptr<State> initial_state(new State(++expanded_states_count_));
+ auto initial_state = std::make_unique<State>(++expanded_states_count_);
XBT_DEBUG("********* Start communication determinism verification *********");
mc_model_checker->wait_for_requests();
/* Create the new expanded state */
- std::unique_ptr<State> next_state(new State(++expanded_states_count_));
+ auto next_state = std::make_unique<State>(++expanded_states_count_);
/* If comm determinism verification, we cannot stop the exploration if some communications are not finished (at
* least, data are transferred). These communications are incomplete and they cannot be analyzed and compared
this->get_session().execute(state->transition_);
/* Create the new expanded state (copy the state of MCed into our MCer data) */
- std::unique_ptr<State> next_state = std::unique_ptr<State>(new State(++expanded_states_count_));
+ auto next_state = std::make_unique<State>(++expanded_states_count_);
if (_sg_mc_termination)
this->check_non_termination(next_state.get());
XBT_DEBUG("Starting the safety algorithm");
- std::unique_ptr<State> initial_state = std::unique_ptr<State>(new State(++expanded_states_count_));
+ auto initial_state = std::make_unique<State>(++expanded_states_count_);
XBT_DEBUG("**************************************************");
XBT_DEBUG("Initial state");
// No location: do not add it ?
return nullptr;
- std::unique_ptr<simgrid::mc::Variable> variable = std::unique_ptr<simgrid::mc::Variable>(new simgrid::mc::Variable());
- variable->id = dwarf_dieoffset(die);
- variable->global = frame == nullptr; // Can be override base on DW_AT_location
- variable->object_info = info;
+ auto variable = std::make_unique<simgrid::mc::Variable>();
+ variable->id = dwarf_dieoffset(die);
+ variable->global = frame == nullptr; // Can be override base on DW_AT_location
+ variable->object_info = info;
const char* name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
if (name)
boost::algorithm::to_lower(dvfs_governor);
}
- auto governor = [&dvfs_governor, &daemon_proc]() {
+ auto governor = [&dvfs_governor, &daemon_proc]() -> std::unique_ptr<simgrid::plugin::dvfs::Governor> {
if (dvfs_governor == "conservative") {
- return std::unique_ptr<simgrid::plugin::dvfs::Governor>(
- new simgrid::plugin::dvfs::Conservative(daemon_proc->get_host()));
+ return std::make_unique<simgrid::plugin::dvfs::Conservative>(daemon_proc->get_host());
} else if (dvfs_governor == "ondemand") {
- return std::unique_ptr<simgrid::plugin::dvfs::Governor>(
- new simgrid::plugin::dvfs::OnDemand(daemon_proc->get_host()));
+ return std::make_unique<simgrid::plugin::dvfs::OnDemand>(daemon_proc->get_host());
}
#if HAVE_SMPI
else if (dvfs_governor == "adagio") {
- return std::unique_ptr<simgrid::plugin::dvfs::Governor>(
- new simgrid::plugin::dvfs::Adagio(daemon_proc->get_host()));
+ return std::make_unique<simgrid::plugin::dvfs::Adagio>(daemon_proc->get_host());
}
#endif
else if (dvfs_governor == "performance") {
- return std::unique_ptr<simgrid::plugin::dvfs::Governor>(
- new simgrid::plugin::dvfs::Performance(daemon_proc->get_host()));
+ return std::make_unique<simgrid::plugin::dvfs::Performance>(daemon_proc->get_host());
} else if (dvfs_governor == "powersave") {
- return std::unique_ptr<simgrid::plugin::dvfs::Governor>(
- new simgrid::plugin::dvfs::Powersave(daemon_proc->get_host()));
+ return std::make_unique<simgrid::plugin::dvfs::Powersave>(daemon_proc->get_host());
} else {
XBT_CRITICAL("No governor specified for host %s, falling back to Performance",
daemon_proc->get_host()->get_cname());
- return std::unique_ptr<simgrid::plugin::dvfs::Governor>(
- new simgrid::plugin::dvfs::Performance(daemon_proc->get_host()));
+ return std::make_unique<simgrid::plugin::dvfs::Performance>(daemon_proc->get_host());
}
}();
int Comm::wait_any_for(const std::vector<CommPtr>* comms, double timeout)
{
- std::unique_ptr<kernel::activity::CommImpl* []> rcomms(new kernel::activity::CommImpl*[comms->size()]);
+ auto rcomms = std::make_unique<kernel::activity::CommImpl*[]>(comms->size());
std::transform(begin(*comms), end(*comms), rcomms.get(),
[](const CommPtr& comm) { return static_cast<kernel::activity::CommImpl*>(comm->pimpl_.get()); });
int changed_pos = simcall_comm_waitany(rcomms.get(), comms->size(), timeout);
int Comm::test_any(const std::vector<CommPtr>* comms)
{
- std::unique_ptr<kernel::activity::CommImpl* []> rcomms(new kernel::activity::CommImpl*[comms->size()]);
+ auto rcomms = std::make_unique<kernel::activity::CommImpl*[]>(comms->size());
std::transform(begin(*comms), end(*comms), rcomms.get(),
[](const CommPtr& comm) { return static_cast<kernel::activity::CommImpl*>(comm->pimpl_.get()); });
int changed_pos = simcall_comm_testany(rcomms.get(), comms->size());
int Exec::wait_any_for(std::vector<ExecPtr>* execs, double timeout)
{
- std::unique_ptr<kernel::activity::ExecImpl* []> rexecs(new kernel::activity::ExecImpl*[execs->size()]);
+ auto rexecs = std::make_unique<kernel::activity::ExecImpl*[]>(execs->size());
std::transform(begin(*execs), end(*execs), rexecs.get(),
[](const ExecPtr& exec) { return static_cast<kernel::activity::ExecImpl*>(exec->pimpl_.get()); });
unsigned int simcall_comm_waitany(simgrid::kernel::activity::ActivityImplPtr comms[], size_t count,
double timeout) // XBT_ATTRIB_DEPRECATED_v330
{
- std::unique_ptr<simgrid::kernel::activity::CommImpl* []> rcomms(new simgrid::kernel::activity::CommImpl*[count]);
+ auto rcomms = std::make_unique<simgrid::kernel::activity::CommImpl*[]>(count);
std::transform(comms, comms + count, rcomms.get(), [](const simgrid::kernel::activity::ActivityImplPtr& comm) {
return static_cast<simgrid::kernel::activity::CommImpl*>(comm.get());
});
{
if (count == 0)
return -1;
- std::unique_ptr<simgrid::kernel::activity::CommImpl* []> rcomms(new simgrid::kernel::activity::CommImpl*[count]);
+ auto rcomms = std::make_unique<simgrid::kernel::activity::CommImpl*[]>(count);
std::transform(comms, comms + count, rcomms.get(), [](const simgrid::kernel::activity::ActivityImplPtr& comm) {
return static_cast<simgrid::kernel::activity::CommImpl*>(comm.get());
});
return z0 * sd + mean;
}
-static std::unique_ptr<Random> default_random(new XbtRandom);
+static std::unique_ptr<Random> default_random = std::make_unique<XbtRandom>();
void set_implem_xbt()
{