Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Declare functions "const" (round #2).
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 3 Jul 2020 09:50:55 +0000 (11:50 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 3 Jul 2020 09:50:55 +0000 (11:50 +0200)
14 files changed:
include/simgrid/plugins/file_system.h
include/simgrid/s4u/Actor.hpp
include/simgrid/s4u/Engine.hpp
src/kernel/actor/ActorImpl.cpp
src/kernel/actor/ActorImpl.hpp
src/mc/remote/AppSide.cpp
src/mc/remote/AppSide.hpp
src/plugins/file_system/s4u_FileSystem.cpp
src/s4u/s4u_Actor.cpp
src/s4u/s4u_Engine.cpp
src/smpi/include/smpi_comm.hpp
src/smpi/include/smpi_win.hpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_win.cpp

index fcc4f99..7b9c7a5 100644 (file)
@@ -146,7 +146,7 @@ public:
   int remote_move(sg_host_t host, const char* fullpath);
 
   int unlink() const; /** Remove a file from the contents of a disk */
-  void dump();
+  void dump() const;
 };
 
 class XBT_PUBLIC FileSystemDiskExt {
index 2354760..c664c03 100644 (file)
@@ -63,7 +63,7 @@ public:
   friend XBT_PUBLIC void intrusive_ptr_release(const Actor* actor);
 #endif
   /** Retrieve the amount of references on that object. Useful to debug the automatic refcounting */
-  int get_refcount();
+  int get_refcount() const;
 
   // ***** Actor creation *****
   /** Retrieve a reference to myself */
@@ -157,7 +157,7 @@ public:
   void resume();
 
   /** Returns true if the actor is suspended. */
-  bool is_suspended();
+  bool is_suspended() const;
 
   /** If set to true, the actor will automatically restart when its host reboots */
   void set_auto_restart(bool autorestart);
index 8903b10..2490007 100644 (file)
@@ -80,7 +80,7 @@ public:
     register_function(name, std::move(code_factory));
   }
 
-  void load_deployment(const std::string& deploy);
+  void load_deployment(const std::string& deploy) const;
 
 protected:
 #ifndef DOXYGEN
index 1c9d773..6e0b52a 100644 (file)
@@ -270,7 +270,7 @@ void ActorImpl::set_kill_time(double kill_time)
   });
 }
 
-double ActorImpl::get_kill_time()
+double ActorImpl::get_kill_time() const
 {
   return kill_timer_ ? kill_timer_->get_date() : 0;
 }
index 17b8042..181e019 100644 (file)
@@ -37,7 +37,7 @@ public:
   ~ActorImpl();
 
   static ActorImpl* self();
-  double get_kill_time();
+  double get_kill_time() const;
   void set_kill_time(double kill_time);
   boost::intrusive::list_member_hook<> host_actor_list_hook;   /* simgrid::simix::Host::process_list */
   boost::intrusive::list_member_hook<> smx_destroy_list_hook;  /* simix_global->actors_to_destroy */
index 486a9c7..907f73c 100644 (file)
@@ -106,7 +106,7 @@ void AppSide::handle_actor_enabled(const s_mc_message_actor_enabled_t* msg) cons
   xbt_assert(received_size == sizeof(_type_), "Unexpected size for " _name_ " (%zd != %zu)", received_size,            \
              sizeof(_type_))
 
-void AppSide::handle_messages()
+void AppSide::handle_messages() const
 {
   while (true) {
     XBT_DEBUG("Waiting messages from model-checker");
@@ -154,7 +154,7 @@ void AppSide::main_loop()
   }
 }
 
-void AppSide::report_assertion_failure()
+void AppSide::report_assertion_failure() const
 {
   if (channel_.send(MC_MESSAGE_ASSERTION_FAILED))
     xbt_die("Could not send assertion to model-checker");
index 0c96f35..ccb19fa 100644 (file)
@@ -27,7 +27,7 @@ private:
 public:
   AppSide();
   explicit AppSide(int fd) : channel_(fd) {}
-  void handle_messages();
+  void handle_messages() const;
 
 private:
   void handle_deadlock_check(const s_mc_message_t* msg) const;
@@ -39,7 +39,7 @@ public:
   Channel const& get_channel() const { return channel_; }
   Channel& get_channel() { return channel_; }
   XBT_ATTRIB_NORETURN void main_loop();
-  void report_assertion_failure();
+  void report_assertion_failure() const;
   void ignore_memory(void* addr, std::size_t size) const;
   void ignore_heap(void* addr, std::size_t size) const;
   void unignore_heap(void* addr, std::size_t size) const;
index 43854f9..1b40450 100644 (file)
@@ -143,7 +143,7 @@ File::~File()
   kernel::actor::simcall([this, desc_table] { desc_table->push_back(this->desc_id); });
 }
 
-void File::dump()
+void File::dump() const
 {
   if (local_storage_)
     XBT_INFO("File Descriptor information:\n"
index e6737e9..f3a612b 100644 (file)
@@ -96,7 +96,7 @@ void intrusive_ptr_release(const Actor* actor)
 {
   intrusive_ptr_release(actor->pimpl_);
 }
-int Actor::get_refcount()
+int Actor::get_refcount() const
 {
   return pimpl_->get_refcount();
 }
@@ -234,7 +234,7 @@ void Actor::resume()
   s4u::Actor::on_resume(*this);
 }
 
-bool Actor::is_suspended()
+bool Actor::is_suspended() const
 {
   return pimpl_->is_suspended();
 }
index c072730..89b3ced 100644 (file)
@@ -145,7 +145,7 @@ void Engine::register_function(const std::string& name, const kernel::actor::Act
  * See also: :ref:`deploy`.
  * \endrst
  */
-void Engine::load_deployment(const std::string& deploy)
+void Engine::load_deployment(const std::string& deploy) const
 {
   pimpl->load_deployment(deploy);
 }
index 70fa4ec..6ff921e 100644 (file)
@@ -85,7 +85,7 @@ public:
 
   void add_rma_win(MPI_Win win);
   void remove_rma_win(MPI_Win win);
-  void finish_rma_calls();
+  void finish_rma_calls() const;
   MPI_Comm split_type(int type, int key, const Info* info);
 };
 
index 595bfe8..b50573c 100644 (file)
@@ -91,7 +91,7 @@ public:
   int flush_local_all();
   int finish_comms();
   int finish_comms(int rank);
-  int shared_query(int rank, MPI_Aint* size, int* disp_unit, void* baseptr);
+  int shared_query(int rank, MPI_Aint* size, int* disp_unit, void* baseptr) const;
   MPI_Errhandler errhandler();
   void set_errhandler( MPI_Errhandler errhandler);
 };
index b72ab97..d3e4978 100644 (file)
@@ -532,7 +532,8 @@ void Comm::remove_rma_win(MPI_Win win){
   rma_wins_.remove(win);
 }
 
-void Comm::finish_rma_calls(){
+void Comm::finish_rma_calls() const
+{
   for (auto const& it : rma_wins_) {
     if(it->rank()==this->rank()){//is it ours (for MPI_COMM_WORLD)?
       int finished = it->finish_comms();
index 38ac955..f62ab4e 100644 (file)
@@ -736,7 +736,7 @@ int Win::finish_comms(int rank){
   return size;
 }
 
-int Win::shared_query(int rank, MPI_Aint* size, int* disp_unit, void* baseptr)
+int Win::shared_query(int rank, MPI_Aint* size, int* disp_unit, void* baseptr) const
 {
   const Win* target_win = rank != MPI_PROC_NULL ? connected_wins_[rank] : nullptr;
   for (int i = 0; not target_win && i < comm_->size(); i++) {