From: Arnaud Giersch Date: Tue, 11 Apr 2023 13:26:28 +0000 (+0200) Subject: Pointer and reference should be "const" if the corresponding object is not modified... X-Git-Tag: v3.34~180 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/81d745edc70528272b07a8dd9f8096579e0c0250?ds=sidebyside Pointer and reference should be "const" if the corresponding object is not modified (sonar). --- diff --git a/src/mc/api/State.cpp b/src/mc/api/State.cpp index 58f7d28d8c..bccd340ac8 100644 --- a/src/mc/api/State.cpp +++ b/src/mc/api/State.cpp @@ -85,7 +85,7 @@ std::size_t State::count_todo() const std::size_t State::count_todo_multiples() const { size_t count = 0; - for (auto& [_, actor] : strategy_->actors_to_run_) + for (auto const& [_, actor] : strategy_->actors_to_run_) if (actor.is_todo()) count += actor.get_times_not_considered(); diff --git a/src/mc/api/strategy/WaitStrategy.hpp b/src/mc/api/strategy/WaitStrategy.hpp index e2d466b3a7..39a78c79e5 100644 --- a/src/mc/api/strategy/WaitStrategy.hpp +++ b/src/mc/api/strategy/WaitStrategy.hpp @@ -43,7 +43,7 @@ public: * to decrease the count. */ void execute_next(aid_t aid, RemoteApp& app) override { - auto& actor = actors_to_run_.at(aid); + auto const& actor = actors_to_run_.at(aid); if ((not taking_wait_) and is_transition_wait(actor.get_transition(actor.get_times_considered())->type_)) { taken_wait_++; taking_wait_ = true; diff --git a/src/mc/inspect/mc_unw.cpp b/src/mc/inspect/mc_unw.cpp index d9882f0157..d7e0c92199 100644 --- a/src/mc/inspect/mc_unw.cpp +++ b/src/mc/inspect/mc_unw.cpp @@ -216,7 +216,7 @@ unw_addr_space_t UnwindContext::createUnwindAddressSpace() return unw_create_addr_space(&accessors, BYTE_ORDER); } -void UnwindContext::initialize(simgrid::mc::RemoteProcessMemory& process_memory, unw_context_t* c) +void UnwindContext::initialize(simgrid::mc::RemoteProcessMemory& process_memory, const unw_context_t* c) { this->address_space_ = &process_memory; this->process_ = &process_memory; diff --git a/src/mc/inspect/mc_unw.hpp b/src/mc/inspect/mc_unw.hpp index 7b9babbba6..6291c1ce4d 100644 --- a/src/mc/inspect/mc_unw.hpp +++ b/src/mc/inspect/mc_unw.hpp @@ -45,7 +45,7 @@ class UnwindContext { unw_context_t unwind_context_ = {}; public: - void initialize(simgrid::mc::RemoteProcessMemory& process, unw_context_t* c); + void initialize(simgrid::mc::RemoteProcessMemory& process, const unw_context_t* c); unw_cursor_t cursor(); private: // Methods and virtual table for libunwind diff --git a/src/mc/sosp/Snapshot.cpp b/src/mc/sosp/Snapshot.cpp index 72e2355c48..eae958d947 100644 --- a/src/mc/sosp/Snapshot.cpp +++ b/src/mc/sosp/Snapshot.cpp @@ -219,7 +219,7 @@ Snapshot::Snapshot(long num_state, PageStore& store, RemoteProcessMemory& memory ignore_restore(); } -void Snapshot::add_region(RegionType type, RemoteProcessMemory& memory, ObjectInformation* object_info, +void Snapshot::add_region(RegionType type, const RemoteProcessMemory& memory, ObjectInformation* object_info, void* start_addr, std::size_t size) { if (type == RegionType::Data) diff --git a/src/mc/sosp/Snapshot.hpp b/src/mc/sosp/Snapshot.hpp index 04e871c27c..0b9fb57b57 100644 --- a/src/mc/sosp/Snapshot.hpp +++ b/src/mc/sosp/Snapshot.hpp @@ -89,7 +89,7 @@ public: std::vector ignored_data_; private: - void add_region(RegionType type, RemoteProcessMemory& memory, ObjectInformation* object_info, void* start_addr, + void add_region(RegionType type, const RemoteProcessMemory& memory, ObjectInformation* object_info, void* start_addr, std::size_t size); void snapshot_regions(RemoteProcessMemory& memory); void snapshot_stacks(RemoteProcessMemory& memory);