From: mlaurent Date: Wed, 7 Jun 2023 10:46:36 +0000 (+0200) Subject: Merge branch 'master' of https://framagit.org/simgrid/simgrid X-Git-Tag: v3.34~41^2~5 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/874aec87c7ce1894a9f017d2adf07ce7b8abe71d?hp=122a5a2813fd6d64d4db8ee7f1fdb5a62b7e0d6a Merge branch 'master' of https://framagit.org/simgrid/simgrid --- diff --git a/examples/cpp/exec-ptask-multicore-latency/s4u-exec-ptask-multicore-latency.cpp b/examples/cpp/exec-ptask-multicore-latency/s4u-exec-ptask-multicore-latency.cpp index 08b01f3144..e4ec699997 100644 --- a/examples/cpp/exec-ptask-multicore-latency/s4u-exec-ptask-multicore-latency.cpp +++ b/examples/cpp/exec-ptask-multicore-latency/s4u-exec-ptask-multicore-latency.cpp @@ -11,7 +11,7 @@ namespace sg4 = simgrid::s4u; static void runner() { - auto* e = sg4::Engine::get_instance(); + const auto* e = sg4::Engine::get_instance(); std::vector comp(2, 1e9); std::vector comm(4, 0.0); // Different hosts. diff --git a/examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.cpp b/examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.cpp index 8cfad72fe4..e7a17cb90f 100644 --- a/examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.cpp +++ b/examples/cpp/exec-ptask-multicore/s4u-exec-ptask-multicore.cpp @@ -10,7 +10,7 @@ namespace sg4 = simgrid::s4u; static void runner() { - auto* e = sg4::Engine::get_instance(); + const auto* e = sg4::Engine::get_instance(); std::vector comp(2, 1e9); std::vector comm(4, 0.0); // Different hosts. diff --git a/examples/cpp/exec-threads/s4u-exec-threads.cpp b/examples/cpp/exec-threads/s4u-exec-threads.cpp index 8a16b5e1dd..1de40a201b 100644 --- a/examples/cpp/exec-threads/s4u-exec-threads.cpp +++ b/examples/cpp/exec-threads/s4u-exec-threads.cpp @@ -11,7 +11,7 @@ namespace sg4 = simgrid::s4u; static void runner() { - auto* e = sg4::Engine::get_instance(); + const auto* e = sg4::Engine::get_instance(); sg4::Host* multicore_host = e->host_by_name("MyHost1"); // First test with less than, same number as, and more threads than cores double start_time = sg4::Engine::get_clock(); diff --git a/include/simgrid/plugins/task.hpp b/include/simgrid/plugins/task.hpp index 62eb12a1ea..8143333d86 100644 --- a/include/simgrid/plugins/task.hpp +++ b/include/simgrid/plugins/task.hpp @@ -134,9 +134,9 @@ public: IoTaskPtr set_disk(s4u::Disk* disk); s4u::Disk* get_disk() const { return disk_; } IoTaskPtr set_bytes(double bytes); - double get_bytes() { return get_amount(); } + double get_bytes() const { return get_amount(); } IoTaskPtr set_op_type(s4u::Io::OpType type); - s4u::Io::OpType get_op_type() { return type_; } + s4u::Io::OpType get_op_type() const { return type_; } }; } // namespace simgrid::plugins #endif diff --git a/include/simgrid/s4u/Comm.hpp b/include/simgrid/s4u/Comm.hpp index 2f07115b35..a92f87f542 100644 --- a/include/simgrid/s4u/Comm.hpp +++ b/include/simgrid/s4u/Comm.hpp @@ -68,7 +68,7 @@ public: /*! \static Add a callback fired when the send of any Comm is posted */ static void on_send_cb(const std::function& cb) { on_send.connect(cb); } /*! Add a callback fired when the send of this specific Comm is posted */ - void on_this_send_cb(const std::function& cb) { on_send.connect(cb); } + void on_this_send_cb(const std::function& cb) { on_this_send.connect(cb); } /*! \static Add a callback fired when the recv of any Comm is posted */ static void on_recv_cb(const std::function& cb) { on_recv.connect(cb); } /*! Add a callback fired when the recv of this specific Comm is posted */ diff --git a/src/instr/instr_platform.cpp b/src/instr/instr_platform.cpp index 1519f804a6..f7cbcc9dca 100644 --- a/src/instr/instr_platform.cpp +++ b/src/instr/instr_platform.cpp @@ -531,10 +531,10 @@ void define_callbacks() Container::by_name(c.get_destination()->get_name())->get_state("HOST_STATE")->push_event("start"); } }); - s4u::Comm::on_send_cb([](s4u::Comm const& c) { + s4u::Comm::on_send_cb([](s4u::Comm const&) { Container::by_name(instr_pid(*s4u::Actor::self()))->get_state("ACTOR_STATE")->push_event("send"); }); - s4u::Comm::on_recv_cb([](s4u::Comm const& c) { + s4u::Comm::on_recv_cb([](s4u::Comm const&) { Container::by_name(instr_pid(*s4u::Actor::self()))->get_state("ACTOR_STATE")->push_event("receive"); }); s4u::Actor::on_host_change_cb(on_actor_host_change); diff --git a/src/kernel/activity/SemaphoreImpl.cpp b/src/kernel/activity/SemaphoreImpl.cpp index dc7ccbe7df..b53f45771b 100644 --- a/src/kernel/activity/SemaphoreImpl.cpp +++ b/src/kernel/activity/SemaphoreImpl.cpp @@ -68,7 +68,7 @@ void SemAcquisitionImpl::finish() void SemAcquisitionImpl::cancel() { /* Remove myself from the list of interested parties */ - auto* issuer = get_issuer(); + const auto* issuer = get_issuer(); auto it = std::find_if(semaphore_->ongoing_acquisitions_.begin(), semaphore_->ongoing_acquisitions_.end(), [issuer](SemAcquisitionImplPtr acqui) { return acqui->get_issuer() == issuer; }); xbt_assert(it != semaphore_->ongoing_acquisitions_.end(), diff --git a/src/kernel/resource/WifiLinkImpl.cpp b/src/kernel/resource/WifiLinkImpl.cpp index b0abe21ab5..a40a12a6e6 100644 --- a/src/kernel/resource/WifiLinkImpl.cpp +++ b/src/kernel/resource/WifiLinkImpl.cpp @@ -18,7 +18,7 @@ namespace simgrid::kernel::resource { ************/ static void update_bw_comm_start(const s4u::Comm& comm) { - auto* pimpl = static_cast(comm.get_impl()); + const auto* pimpl = static_cast(comm.get_impl()); auto const* actionWifi = dynamic_cast(pimpl->model_action_); if (actionWifi == nullptr) diff --git a/src/mc/explo/odpor/WakeupTreeIterator.hpp b/src/mc/explo/odpor/WakeupTreeIterator.hpp index 0ccc6bc0ea..e42184cbf4 100644 --- a/src/mc/explo/odpor/WakeupTreeIterator.hpp +++ b/src/mc/explo/odpor/WakeupTreeIterator.hpp @@ -29,7 +29,12 @@ namespace simgrid::mc::odpor { class WakeupTreeIterator : public boost::iterator_facade { public: - WakeupTreeIterator() = default; + // Use rule-of-three, and implicitely disable the move constructor which cannot be 'noexcept' (as required by C++ Core + // Guidelines), due to the std::list and std:stack members. + WakeupTreeIterator() = default; + WakeupTreeIterator(const WakeupTreeIterator&) = default; + ~WakeupTreeIterator() = default; + explicit WakeupTreeIterator(const WakeupTree& tree); private: diff --git a/src/mc/explo/udpor/Configuration_test.cpp b/src/mc/explo/udpor/Configuration_test.cpp index 0d2217f245..dc3d900e36 100644 --- a/src/mc/explo/udpor/Configuration_test.cpp +++ b/src/mc/explo/udpor/Configuration_test.cpp @@ -814,47 +814,47 @@ TEST_CASE("simgrid::mc::udpor::Configuration: Computing Full Alternatives in Rea auto e0 = std::make_unique( EventSet(), std::make_shared(Transition::Type::UNKNOWN, 0)); - auto* e0_handle = e0.get(); + const auto* e0_handle = e0.get(); auto e1 = std::make_unique(EventSet({e0_handle}), std::make_shared(Transition::Type::UNKNOWN, 0)); - auto* e1_handle = e1.get(); + const auto* e1_handle = e1.get(); auto e2 = std::make_unique( EventSet({e1_handle}), std::make_shared(Transition::Type::UNKNOWN, 1)); - auto* e2_handle = e2.get(); + const auto* e2_handle = e2.get(); auto e3 = std::make_unique( EventSet({e1_handle}), std::make_shared(Transition::Type::UNKNOWN, 2)); - auto* e3_handle = e3.get(); + const auto* e3_handle = e3.get(); auto e4 = std::make_unique( EventSet({e0_handle}), std::make_shared(Transition::Type::UNKNOWN, 1)); - auto* e4_handle = e4.get(); + const auto* e4_handle = e4.get(); auto e5 = std::make_unique(EventSet({e4_handle}), std::make_shared(Transition::Type::UNKNOWN, 0)); - auto* e5_handle = e5.get(); + const auto* e5_handle = e5.get(); auto e6 = std::make_unique( EventSet({e5_handle}), std::make_shared(Transition::Type::UNKNOWN, 2)); - auto* e6_handle = e6.get(); + const auto* e6_handle = e6.get(); auto e7 = std::make_unique( EventSet({e0_handle}), std::make_shared(Transition::Type::UNKNOWN, 2)); - auto* e7_handle = e7.get(); + const auto* e7_handle = e7.get(); auto e8 = std::make_unique(EventSet({e4_handle, e7_handle}), std::make_shared(Transition::Type::UNKNOWN, 0)); - auto* e8_handle = e8.get(); + const auto* e8_handle = e8.get(); auto e9 = std::make_unique(EventSet({e7_handle}), std::make_shared(Transition::Type::UNKNOWN, 0)); - auto* e9_handle = e9.get(); + const auto* e9_handle = e9.get(); auto e10 = std::make_unique( EventSet({e9_handle}), std::make_shared(Transition::Type::UNKNOWN, 1)); - auto* e10_handle = e10.get(); + const auto* e10_handle = e10.get(); SECTION("Alternative computation call 1") { diff --git a/src/mc/explo/udpor/Unfolding_test.cpp b/src/mc/explo/udpor/Unfolding_test.cpp index 2e906cc9bc..5ee5df2083 100644 --- a/src/mc/explo/udpor/Unfolding_test.cpp +++ b/src/mc/explo/udpor/Unfolding_test.cpp @@ -24,8 +24,8 @@ TEST_CASE("simgrid::mc::udpor::Unfolding: Inserting and marking events with an u EventSet(), std::make_shared(Transition::Type::UNKNOWN, 0)); auto e2 = std::make_unique(EventSet(), std::make_shared(Transition::Type::UNKNOWN, 1)); - auto* e1_handle = e1.get(); - auto* e2_handle = e2.get(); + const auto* e1_handle = e1.get(); + const auto* e2_handle = e2.get(); unfolding.insert(std::move(e1)); REQUIRE(unfolding.size() == 1); diff --git a/src/plugins/chaos_monkey.cpp b/src/plugins/chaos_monkey.cpp index 3310cdb146..282bcd5477 100644 --- a/src/plugins/chaos_monkey.cpp +++ b/src/plugins/chaos_monkey.cpp @@ -23,7 +23,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cmonkey, kernel, "Chaos Monkey plugin"); static void sg_chaos_monkey_plugin_run() { - auto* engine = sg4::Engine::get_instance(); + const auto* engine = sg4::Engine::get_instance(); auto hosts = engine->get_all_hosts(); auto links = engine->get_all_links(); diff --git a/src/plugins/vm/dirty_page_tracking.cpp b/src/plugins/vm/dirty_page_tracking.cpp index 7fdee49640..d30a1b015d 100644 --- a/src/plugins/vm/dirty_page_tracking.cpp +++ b/src/plugins/vm/dirty_page_tracking.cpp @@ -76,7 +76,7 @@ static void on_virtual_machine_creation(const simgrid::s4u::VirtualMachine& vm) static void on_exec_creation(simgrid::s4u::Exec const& e) { - auto* exec = static_cast(e.get_impl()); + const auto* exec = static_cast(e.get_impl()); const simgrid::s4u::VirtualMachine* vm = dynamic_cast(exec->get_host()); if (vm == nullptr) return; diff --git a/src/s4u/s4u_Engine.cpp b/src/s4u/s4u_Engine.cpp index a76ed63445..11b8b48e6f 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -76,7 +76,7 @@ Engine* Engine::get_instance() Engine* Engine::get_instance(int* argc, char** argv) { if (Engine::instance_ == nullptr) { - auto* e = new Engine(argc, argv); + const auto* e = new Engine(argc, argv); xbt_assert(Engine::instance_ == e); } return Engine::instance_; diff --git a/src/smpi/internals/instr_smpi.cpp b/src/smpi/internals/instr_smpi.cpp index 560e03041d..63e8f338ee 100644 --- a/src/smpi/internals/instr_smpi.cpp +++ b/src/smpi/internals/instr_smpi.cpp @@ -147,7 +147,7 @@ void TRACE_smpi_init(aid_t pid, const std::string& calling_func) if (not TRACE_smpi_is_enabled()) return; - auto* self = simgrid::s4u::Actor::self(); + const auto* self = simgrid::s4u::Actor::self(); TRACE_smpi_setup_container(pid, sg_host_self()); simgrid::s4u::this_actor::on_exit([self](bool) { smpi_container(self->get_pid())->remove_from_parent(); }); diff --git a/teshsuite/mc/dwarf/dwarf.cpp b/teshsuite/mc/dwarf/dwarf.cpp index 05f3d2e82e..d4d513e51d 100644 --- a/teshsuite/mc/dwarf/dwarf.cpp +++ b/teshsuite/mc/dwarf/dwarf.cpp @@ -120,7 +120,7 @@ int main(int argc, char** argv) simgrid::s4u::Engine::get_instance(&argc, argv); const simgrid::mc::Variable* var; - simgrid::mc::Type* type; + const simgrid::mc::Type* type; simgrid::mc::RemoteProcessMemory process(getpid(), nullptr); diff --git a/teshsuite/s4u/host-on-off-actors/host-on-off-actors.cpp b/teshsuite/s4u/host-on-off-actors/host-on-off-actors.cpp index c0279d4d79..fcc42cb94b 100644 --- a/teshsuite/s4u/host-on-off-actors/host-on-off-actors.cpp +++ b/teshsuite/s4u/host-on-off-actors/host-on-off-actors.cpp @@ -39,7 +39,7 @@ static void commRX() { XBT_INFO(" Start RX"); try { - auto* payload = simgrid::s4u::Mailbox::by_name("comm")->get(); + const auto* payload = simgrid::s4u::Mailbox::by_name("comm")->get(); XBT_INFO(" Receive message: %s", payload->c_str()); } catch (const simgrid::HostFailureException&) { XBT_INFO(" Receive message: HOST_FAILURE"); diff --git a/teshsuite/s4u/issue71/issue71.cpp b/teshsuite/s4u/issue71/issue71.cpp index 7b5ed74ea3..7983e49f66 100644 --- a/teshsuite/s4u/issue71/issue71.cpp +++ b/teshsuite/s4u/issue71/issue71.cpp @@ -9,7 +9,7 @@ static void runner() { - auto* e = simgrid::s4u::Engine::get_instance(); + const auto* e = simgrid::s4u::Engine::get_instance(); simgrid::s4u::Host* host0 = e->host_by_name("c1_0"); simgrid::s4u::Host* host1 = e->host_by_name("c2_0"); diff --git a/tools/graphicator/graphicator.cpp b/tools/graphicator/graphicator.cpp index dbcb6e04ac..368892bd08 100644 --- a/tools/graphicator/graphicator.cpp +++ b/tools/graphicator/graphicator.cpp @@ -26,7 +26,7 @@ int main(int argc, char** argv) simgrid::instr::platform_graph_export_graphviz(outputfile); } else { - xbt_assert(false, "Unknown output file format, please use '.dot' or .csv' extension\n"); + xbt_die("Unknown output file format, please use '.dot' or .csv' extension"); } return 0; }