From: Arnaud Giersch Date: Tue, 4 Oct 2022 13:27:24 +0000 (+0200) Subject: Coding style: prefer keyword "not" to "!". X-Git-Tag: v3.34~807 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/27c8bce290f11b67b83f5363885c971764af9bdd Coding style: prefer keyword "not" to "!". --- diff --git a/docs/source/tuto_network_calibration/dahu_platform_ckmeans.cpp b/docs/source/tuto_network_calibration/dahu_platform_ckmeans.cpp index d47c52154d..dc7f1f1d6e 100644 --- a/docs/source/tuto_network_calibration/dahu_platform_ckmeans.cpp +++ b/docs/source/tuto_network_calibration/dahu_platform_ckmeans.cpp @@ -88,7 +88,7 @@ static SegmentedRegression read_json_file(const std::string& jsonFile, std::mt19 double max = it.second.get_child("max_x").get_value(); coefs[max] = it.second.get_child("coefficient").get_value(); auto& mixture = mixtures[max]; - if (!mixture) + if (not mixture) mixture = std::make_shared(gen); mixture->append(it.second.get_child("mean").get_value(), it.second.get_child("sd").get_value(), it.second.get_child("prob").get_value()); @@ -138,4 +138,4 @@ void load_platform(const sg4::Engine& e) seg = read_json_file("recv_ckmeans.json", gen); smpi_register_op_cost_callback(SmpiOperation::RECV, std::bind(&smpi_cost_cb, seg, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); -} \ No newline at end of file +} diff --git a/include/xbt/asserts.hpp b/include/xbt/asserts.hpp index 84f647a047..9b50fd22f0 100644 --- a/include/xbt/asserts.hpp +++ b/include/xbt/asserts.hpp @@ -27,7 +27,7 @@ #define _xbt_enforce_ARG1(cond) _xbt_enforce_ARGN((cond), "Assertion %s failed", #cond) #define _xbt_enforce_ARGN(cond, ...) \ do { \ - if (!(cond)) { \ + if (not(cond)) { \ throw simgrid::AssertionError(XBT_THROW_POINT, xbt::string_printf(__VA_ARGS__)); \ } \ } while (0) diff --git a/src/kernel/resource/CpuImpl.cpp b/src/kernel/resource/CpuImpl.cpp index 6a6deb4b42..38f68695d3 100644 --- a/src/kernel/resource/CpuImpl.cpp +++ b/src/kernel/resource/CpuImpl.cpp @@ -112,7 +112,7 @@ CpuImpl* CpuImpl::set_core_count(int core_count) void CpuImpl::apply_sharing_policy_cfg() const { - if (!get_constraint()) + if (not get_constraint()) return; kernel::lmm::Constraint::SharingPolicy lmm_policy = kernel::lmm::Constraint::SharingPolicy::SHARED; diff --git a/src/simgrid/sg_config.cpp b/src/simgrid/sg_config.cpp index 10d160af21..415f26728b 100644 --- a/src/simgrid/sg_config.cpp +++ b/src/simgrid/sg_config.cpp @@ -333,7 +333,7 @@ void sg_config_init(int *argc, char **argv) "contexts/nthreads", "Number of parallel threads used to execute user contexts", 1, [](int nthreads) { #if HAVE_MMALLOC xbt_assert( - nthreads == 1 || !malloc_use_mmalloc(), + nthreads == 1 || not malloc_use_mmalloc(), "Parallel simulation is forbidden in the verified program, as there is no protection against race " "conditions in mmalloc itself. Please don't be so greedy and show some mercy for our implementation."); #endif diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index 723be24c99..8a46eed9ff 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -118,7 +118,7 @@ bool Request::match_types(MPI_Datatype stype, MPI_Datatype rtype){ (stype->duplicated_datatype()!=MPI_DATATYPE_NULL && match_types(stype->duplicated_datatype(), rtype)) || (rtype->duplicated_datatype()!=MPI_DATATYPE_NULL && match_types(stype, rtype->duplicated_datatype()))) match = true; - if (!match) + if (not match) XBT_WARN("Mismatched datatypes : sending %s and receiving %s", stype->name().c_str(), rtype->name().c_str()); return match; } @@ -150,8 +150,7 @@ bool Request::match_common(MPI_Request req, MPI_Request sender, MPI_Request rece receiver->truncated_ = true; } //0-sized datatypes/counts should not interfere and match - if ( sender->real_size_ != 0 && receiver->real_size_ != 0 && - !match_types(sender->type_, receiver->type_)) + if (sender->real_size_ != 0 && receiver->real_size_ != 0 && not match_types(sender->type_, receiver->type_)) receiver->unmatched_types_ = true; if (sender->detached_) receiver->detached_sender_ = sender; // tie the sender to the receiver, as it is detached and has to be freed in @@ -506,7 +505,7 @@ void Request::start() XBT_DEBUG("yes there was something for us in the small mailbox"); } } - if(!is_probe) + if (not is_probe) flags_ &= ~MPI_REQ_PROBE; kernel::actor::CommIrecvSimcall observer{process->get_actor()->get_impl(), mailbox->get_impl(), @@ -607,7 +606,7 @@ void Request::start() } else { XBT_DEBUG("Yes there was something for us in the large mailbox"); } - if(!is_probe) + if (not is_probe) flags_ &= ~MPI_REQ_PROBE; } else { mailbox = process->mailbox(); diff --git a/src/smpi/mpi/smpi_win.cpp b/src/smpi/mpi/smpi_win.cpp index c78dc3c18b..4540708851 100644 --- a/src/smpi/mpi/smpi_win.cpp +++ b/src/smpi/mpi/smpi_win.cpp @@ -90,7 +90,7 @@ int Win::del(Win* win){ colls::barrier(win->comm_); Comm::unref(win->comm_); - if (!win->lockers_.empty() || win->opened_ < 0){ + if (not win->lockers_.empty() || win->opened_ < 0) { XBT_WARN("Freeing a locked or opened window"); return MPI_ERR_WIN; }