Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Sonar consts of the day.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 29 Dec 2019 08:31:38 +0000 (09:31 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 29 Dec 2019 22:06:47 +0000 (23:06 +0100)
12 files changed:
include/simgrid/msg.h
src/bindings/java/jmsg_file.cpp
src/bindings/java/jmsg_host.cpp
src/bindings/java/jmsg_storage.cpp
src/bindings/java/jmsg_vm.cpp
src/mc/checker/SafetyChecker.cpp
src/mc/compare.cpp
src/mc/sosp/Snapshot_test.cpp
src/msg/msg_legacy.cpp
teshsuite/msg/cloud-migration/cloud-migration.c
teshsuite/msg/io-file/io-file.c
teshsuite/msg/task_listen_from/task_listen_from.cpp

index 4d0687c..7169d42 100644 (file)
@@ -143,7 +143,7 @@ XBT_PUBLIC int MSG_vm_is_created(msg_vm_t vm);
 XBT_PUBLIC int MSG_vm_is_running(msg_vm_t vm);
 XBT_PUBLIC int MSG_vm_is_suspended(msg_vm_t vm);
 
-XBT_PUBLIC const char* MSG_vm_get_name(msg_vm_t vm);
+XBT_PUBLIC const char* MSG_vm_get_name(const_sg_vm_t vm);
 XBT_PUBLIC void MSG_vm_set_ramsize(msg_vm_t vm, size_t size);
 XBT_PUBLIC size_t MSG_vm_get_ramsize(msg_vm_t vm);
 XBT_PUBLIC msg_host_t MSG_vm_get_pm(msg_vm_t vm);
index 5d43d22..8ff7288 100644 (file)
@@ -46,7 +46,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_File_seek(JNIEnv *env, jobject jfile
 }
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_File_close(JNIEnv *env, jobject jfile) {
-  msg_file_t file = jfile_get_native(env, jfile);
+  const_sg_file_t file = jfile_get_native(env, jfile);
 
   MSG_file_close(file);
   jfile_bind(env, jfile, nullptr);
index b895ed0..6233992 100644 (file)
@@ -340,7 +340,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_updateAllEnergyConsumptions(JNI
 
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getConsumedEnergy (JNIEnv *env, jobject jhost)
 {
-  msg_host_t host = jhost_get_native(env, jhost);
+  const_sg_host_t host = jhost_get_native(env, jhost);
 
   if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
@@ -384,7 +384,7 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getLoad(JNIEnv* env, jobject
 
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCurrentLoad (JNIEnv *env, jobject jhost)
 {
-  msg_host_t host = jhost_get_native(env, jhost);
+  const_sg_host_t host = jhost_get_native(env, jhost);
 
   if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
@@ -396,7 +396,7 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCurrentLoad (JNIEnv *env,
 
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getComputedFlops (JNIEnv *env, jobject jhost)
 {
-  msg_host_t host = jhost_get_native(env, jhost);
+  const_sg_host_t host = jhost_get_native(env, jhost);
 
   if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
@@ -408,7 +408,7 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getComputedFlops (JNIEnv *en
 
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getAvgLoad (JNIEnv *env, jobject jhost)
 {
-  msg_host_t host = jhost_get_native(env, jhost);
+  const_sg_host_t host = jhost_get_native(env, jhost);
 
   if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
index 70cd55a..b6b9891 100644 (file)
@@ -103,7 +103,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv * env, j
 }
 
 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getSize(JNIEnv * env,jobject jstorage) {
-  msg_storage_t storage = jstorage_get_native(env, jstorage);
+  const_sg_storage_t storage = jstorage_get_native(env, jstorage);
 
   if (not storage) {
     jxbt_throw_notbound(env, "storage", jstorage);
@@ -114,7 +114,7 @@ JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getSize(JNIEnv * env,jobjec
 }
 
 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getFreeSize(JNIEnv * env,jobject jstorage) {
-  msg_storage_t storage = jstorage_get_native(env, jstorage);
+  const_sg_storage_t storage = jstorage_get_native(env, jstorage);
 
   if (not storage) {
     jxbt_throw_notbound(env, "storage", jstorage);
@@ -125,7 +125,7 @@ JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getFreeSize(JNIEnv * env,jo
 }
 
 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getUsedSize(JNIEnv * env,jobject jstorage) {
-  msg_storage_t storage = jstorage_get_native(env, jstorage);
+  const_sg_storage_t storage = jstorage_get_native(env, jstorage);
 
   if (not storage) {
     jxbt_throw_notbound(env, "storage", jstorage);
index f3cdeaf..f07468e 100644 (file)
@@ -49,7 +49,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_VM_isRunning(JNIEnv* env, jobjec
 
 JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_VM_isMigrating(JNIEnv* env, jobject jvm)
 {
-  msg_vm_t vm = jvm_get_native(env,jvm);
+  const_sg_vm_t vm = jvm_get_native(env, jvm);
   return MSG_vm_is_migrating(vm);
 }
 
index e4859a2..bb5c911 100644 (file)
@@ -194,7 +194,7 @@ void SafetyChecker::backtrack()
       if (req->call_ == SIMCALL_MUTEX_LOCK || req->call_ == SIMCALL_MUTEX_TRYLOCK)
         xbt_die("Mutex is currently not supported with DPOR,  use --cfg=model-check/reduction:none");
 
-      const smx_actor_t issuer = MC_smx_simcall_get_issuer(req);
+      const kernel::actor::ActorImpl* issuer = MC_smx_simcall_get_issuer(req);
       for (auto i = stack_.rbegin(); i != stack_.rend(); ++i) {
         State* prev_state = i->get();
         if (request_depend(req, &prev_state->internal_req_)) {
index 9e93e1a..237ddaa 100644 (file)
@@ -1151,7 +1151,7 @@ static bool global_variables_differ(simgrid::mc::StateComparator& state,
         || (char *) current_var.address > (char *) object_info->end_rw)
       continue;
 
-    simgrid::mc::Type* bvariable_type = current_var.type;
+    const simgrid::mc::Type* bvariable_type = current_var.type;
     if (areas_differ_with_type(state, current_var.address, snapshot1, r1, current_var.address, snapshot2, r2,
                                bvariable_type, 0)) {
       XBT_VERB("Global variable %s (%p) is different between snapshots", current_var.name.c_str(), current_var.address);
@@ -1229,10 +1229,10 @@ bool snapshot_equal(const Snapshot* s1, const Snapshot* s2)
   }
 
   /* Init heap information used in heap comparison algorithm */
-  xbt_mheap_t heap1 = static_cast<xbt_mheap_t>(s1->read_bytes(alloca(sizeof(s_xbt_mheap_t)), sizeof(s_xbt_mheap_t),
-                                                              remote(process.heap_address), ReadOptions::lazy()));
-  xbt_mheap_t heap2 = static_cast<xbt_mheap_t>(s2->read_bytes(alloca(sizeof(s_xbt_mheap_t)), sizeof(s_xbt_mheap_t),
-                                                              remote(process.heap_address), ReadOptions::lazy()));
+  const s_xbt_mheap_t* heap1 = static_cast<xbt_mheap_t>(s1->read_bytes(
+      alloca(sizeof(s_xbt_mheap_t)), sizeof(s_xbt_mheap_t), remote(process.heap_address), ReadOptions::lazy()));
+  const s_xbt_mheap_t* heap2 = static_cast<xbt_mheap_t>(s2->read_bytes(
+      alloca(sizeof(s_xbt_mheap_t)), sizeof(s_xbt_mheap_t), remote(process.heap_address), ReadOptions::lazy()));
   if (state_comparator.initHeapInformation(heap1, heap2, s1->to_ignore_, s2->to_ignore_) == -1) {
     XBT_VERB("(%d - %d) Different heap information", s1->num_state_, s2->num_state_);
     return false;
index b9d2bde..b467855 100644 (file)
@@ -164,7 +164,7 @@ void snap_test_helper::read_pointer()
 {
   prologue_return ret = prologue(1);
   memcpy(ret.src, &mc_model_checker, sizeof(void*));
-  simgrid::mc::Region* region2 = new simgrid::mc::Region(simgrid::mc::RegionType::Data, ret.src, ret.size);
+  const simgrid::mc::Region* region2 = new simgrid::mc::Region(simgrid::mc::RegionType::Data, ret.src, ret.size);
   INFO("Mismtach in MC_region_read_pointer()");
   REQUIRE(MC_region_read_pointer(region2, ret.src) == mc_model_checker);
 
index 2454b2e..e4df590 100644 (file)
@@ -406,7 +406,7 @@ int MSG_vm_is_suspended(sg_vm_t vm)
 {
   return sg_vm_is_suspended(vm);
 }
-const char* MSG_vm_get_name(sg_vm_t vm)
+const char* MSG_vm_get_name(const_sg_vm_t vm)
 {
   return sg_vm_get_name(vm);
 }
index 0391b56..df47314 100644 (file)
@@ -34,7 +34,7 @@ static int migration_worker_main(int argc, char* argv[])
   return 0;
 }
 
-static void vm_migrate_async(msg_vm_t vm, msg_host_t dst_pm)
+static void vm_migrate_async(const_sg_vm_t vm, msg_host_t dst_pm)
 {
   const char* vm_name     = MSG_vm_get_name(vm);
   const char* dst_pm_name = MSG_host_get_name(dst_pm);
index a2feefc..fc7398a 100644 (file)
@@ -15,7 +15,6 @@ static int host(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
   msg_file_t file = NULL;
   sg_size_t read;
   sg_size_t write;
-  msg_storage_t st;
   const char* st_name;
 
   switch (MSG_process_self_PID()) {
@@ -42,7 +41,7 @@ static int host(XBT_ATTRIB_UNUSED int argc, XBT_ATTRIB_UNUSED char* argv[])
 
   const char* filename = MSG_file_get_name(file);
   XBT_INFO("\tOpen file '%s'", filename);
-  st = MSG_storage_get_by_name(st_name);
+  const_sg_storage_t st = MSG_storage_get_by_name(st_name);
 
   XBT_INFO("\tCapacity of the storage element '%s' is stored on: %llu / %llu", filename, MSG_storage_get_used_size(st),
            MSG_storage_get_size(st));
index 653845b..c4dbd0d 100644 (file)
@@ -12,7 +12,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example")
 static int tester(int, char**)
 {
   msg_task_t task = MSG_task_create("name", 0, 10, NULL);
-  msg_comm_t comm = MSG_task_isend(task, "mailbox");
+  const_msg_comm_t comm = MSG_task_isend(task, "mailbox");
 
   XBT_INFO("MSG_task_listen_from returns() %d (should return my pid, which is %d)", MSG_task_listen_from("mailbox"),
            MSG_process_get_PID(MSG_process_self()));