Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please codacy: use long form of negation in C++
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 23 May 2017 21:11:57 +0000 (23:11 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 23 May 2017 21:12:34 +0000 (23:12 +0200)
and clang-format got annoying on this one

165 files changed:
examples/s4u/dht-chord/s4u_dht-chord.cpp
src/bindings/java/jmsg.cpp
src/bindings/java/jmsg_as.cpp
src/bindings/java/jmsg_comm.cpp
src/bindings/java/jmsg_host.cpp
src/bindings/java/jmsg_process.cpp
src/bindings/java/jmsg_rngstream.cpp
src/bindings/java/jmsg_storage.cpp
src/bindings/java/jmsg_task.cpp
src/bindings/java/jmsg_vm.cpp
src/bindings/java/jxbt_utilities.cpp
src/bindings/lua/lua_debug.cpp
src/bindings/lua/lua_host.cpp
src/bindings/lua/lua_platf.cpp
src/instr/instr_config.cpp
src/instr/instr_interface.cpp
src/instr/instr_paje_containers.cpp
src/instr/instr_paje_trace.cpp
src/instr/instr_paje_types.cpp
src/instr/instr_resource_utilization.cpp
src/instr/jedule/jedule.cpp
src/instr/jedule/jedule_events.cpp
src/instr/jedule/jedule_platform.cpp
src/instr/jedule/jedule_sd_binding.cpp
src/kernel/activity/MailboxImpl.cpp
src/kernel/activity/SynchroComm.cpp
src/kernel/activity/SynchroExec.cpp
src/kernel/activity/SynchroSleep.cpp
src/kernel/context/ContextBoost.cpp
src/kernel/context/ContextThread.cpp
src/kernel/routing/ClusterZone.cpp
src/kernel/routing/DijkstraZone.cpp
src/kernel/routing/FatTreeZone.cpp
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FullZone.cpp
src/kernel/routing/NetZoneImpl.cpp
src/kernel/routing/RoutedZone.cpp
src/kernel/routing/TorusZone.cpp
src/kernel/routing/VivaldiZone.cpp
src/mc/DwarfExpression.cpp
src/mc/LocationList.cpp
src/mc/ModelChecker.cpp
src/mc/ObjectInformation.cpp
src/mc/Process.cpp
src/mc/checker/CommunicationDeterminismChecker.cpp
src/mc/checker/LivenessChecker.cpp
src/mc/checker/SafetyChecker.cpp
src/mc/compare.cpp
src/mc/mc_base.cpp
src/mc/mc_checkpoint.cpp
src/mc/mc_client_api.cpp
src/mc/mc_config.cpp
src/mc/mc_dwarf.cpp
src/mc/mc_global.cpp
src/mc/mc_memory.cpp
src/mc/mc_record.cpp
src/mc/mc_request.cpp
src/mc/mc_snapshot.cpp
src/mc/mc_state.cpp
src/mc/mc_unw.cpp
src/mc/mc_xbt.cpp
src/mc/remote/Client.cpp
src/msg/msg_actions.cpp
src/msg/msg_global.cpp
src/msg/msg_gos.cpp
src/msg/msg_io.cpp
src/msg/msg_process.cpp
src/msg/msg_vm.cpp
src/plugins/vm/VirtualMachineImpl.cpp
src/plugins/vm/VmHostExt.cpp
src/s4u/s4u_engine.cpp
src/s4u/s4u_host.cpp
src/s4u/s4u_mailbox.cpp
src/simdag/sd_daxloader.cpp
src/simdag/sd_dotloader.cpp
src/simdag/sd_global.cpp
src/simdag/sd_task.cpp
src/simgrid/host.cpp
src/simgrid/sg_config.cpp
src/simix/ActorImpl.cpp
src/simix/libsmx.cpp
src/simix/popping.cpp
src/simix/smx_context.cpp
src/simix/smx_deployment.cpp
src/simix/smx_global.cpp
src/simix/smx_host.cpp
src/simix/smx_network.cpp
src/simix/smx_synchro.cpp
src/smpi/SmpiHost.cpp
src/smpi/colls/allgather/allgather-2dmesh.cpp
src/smpi/colls/allgather/allgather-3dmesh.cpp
src/smpi/colls/allgather/allgather-mvapich-smp.cpp
src/smpi/colls/allgather/allgather-spreading-simple.cpp
src/smpi/colls/allgatherv/allgatherv-mpich-ring.cpp
src/smpi/colls/allreduce/allreduce-smp-rsag-lr.cpp
src/smpi/colls/allreduce/allreduce-smp-rsag.cpp
src/smpi/colls/alltoall/alltoall-2dmesh.cpp
src/smpi/colls/alltoall/alltoall-3dmesh.cpp
src/smpi/colls/bcast/bcast-mvapich-smp.cpp
src/smpi/colls/bcast/bcast-scatter-rdb-allgather.cpp
src/smpi/colls/coll_tuned_topo.cpp
src/smpi/colls/gather/gather-mvapich.cpp
src/smpi/colls/reduce/reduce-binomial.cpp
src/smpi/colls/reduce/reduce-ompi.cpp
src/smpi/colls/reduce/reduce-scatter-gather.cpp
src/smpi/colls/reduce_scatter/reduce_scatter-mpich.cpp
src/smpi/colls/reduce_scatter/reduce_scatter-ompi.cpp
src/smpi/colls/scatter/scatter-mvapich-two-level.cpp
src/smpi/colls/scatter/scatter-ompi.cpp
src/smpi/colls/smpi_automatic_selector.cpp
src/smpi/colls/smpi_default_selector.cpp
src/smpi/colls/smpi_mpich_selector.cpp
src/smpi/colls/smpi_mvapich2_selector.cpp
src/smpi/colls/smpi_openmpi_selector.cpp
src/smpi/instr_smpi.cpp
src/smpi/smpi_coll.cpp
src/smpi/smpi_comm.cpp
src/smpi/smpi_datatype.cpp
src/smpi/smpi_deployment.cpp
src/smpi/smpi_global.cpp
src/smpi/smpi_memory.cpp
src/smpi/smpi_op.cpp
src/smpi/smpi_pmpi.cpp
src/smpi/smpi_replay.cpp
src/smpi/smpi_request.cpp
src/smpi/smpi_shared.cpp
src/smpi/smpi_static_variables.cpp
src/surf/HostImpl.cpp
src/surf/PropertyHolder.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_ti.cpp
src/surf/fair_bottleneck.cpp
src/surf/instr_routing.cpp
src/surf/instr_surf.cpp
src/surf/lagrange.cpp
src/surf/maxmin.cpp
src/surf/network_cm02.cpp
src/surf/network_ib.cpp
src/surf/network_interface.cpp
src/surf/network_ns3.cpp
src/surf/plugins/host_energy.cpp
src/surf/ptask_L07.cpp
src/surf/sg_platf.cpp
src/surf/storage_interface.cpp
src/surf/storage_n11.cpp
src/surf/surf_interface.cpp
src/surf/trace_mgr.cpp
src/surf/xml/surfxml_parseplatf.cpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/backtrace_linux.cpp
src/xbt/config.cpp
src/xbt/cunit.cpp
src/xbt/dict.cpp
src/xbt/dynar.cpp
src/xbt/ex.cpp
src/xbt/memory_map.cpp
src/xbt/parmap.cpp
src/xbt/xbt_replay.cpp
src/xbt/xbt_str.cpp
teshsuite/msg/task_destroy_cancel/task_destroy_cancel.cpp
teshsuite/s4u/listen_async/listen_async.cpp
teshsuite/s4u/storage_client_server/storage_client_server.cpp
teshsuite/simdag/flatifier/flatifier.cpp
teshsuite/surf/maxmin_bench/maxmin_bench.cpp
teshsuite/xbt/mmalloc/mmalloc_test.cpp

index 6823989..db79af6 100644 (file)
@@ -46,14 +46,14 @@ int main(int argc, char* argv[])
                        "\tExample: %s ../msg_platform.xml chord.xml\n",
              argv[0], argv[0]);
   char** options = &argv[1];
-  while (!strncmp(options[0], "-", 1)) {
+  while (not strncmp(options[0], "-", 1)) {
     unsigned int length = strlen("-nb_bits=");
-    if (!strncmp(options[0], "-nb_bits=", length) && strlen(options[0]) > length) {
+    if (not strncmp(options[0], "-nb_bits=", length) && strlen(options[0]) > length) {
       nb_bits = xbt_str_parse_int(options[0] + length, "Invalid nb_bits parameter: %s");
       XBT_DEBUG("Set nb_bits to %d", nb_bits);
     } else {
       length = strlen("-timeout=");
-      if (!strncmp(options[0], "-timeout=", length) && strlen(options[0]) > length) {
+      if (not strncmp(options[0], "-timeout=", length) && strlen(options[0]) > length) {
         timeout = xbt_str_parse_int(options[0] + length, "Invalid timeout parameter: %s");
         XBT_DEBUG("Set timeout to %d", timeout);
       } else {
index a677fda..abb1bac 100644 (file)
@@ -174,12 +174,12 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Msg_environmentGetRoutingRoot(JNI
 {
   msg_netzone_t as = MSG_zone_get_root();
   jobject jas      = jnetzone_new_instance(env);
-  if (!jas) {
+  if (not jas) {
     jxbt_throw_jni(env, "java As instantiation failed");
     return nullptr;
   }
   jas = jnetzone_ref(env, jas);
-  if (!jas) {
+  if (not jas) {
     jxbt_throw_jni(env, "new global ref allocation failed");
     return nullptr;
   }
index 09d996d..af1aa6f 100644 (file)
@@ -68,24 +68,24 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, job
 
   jclass cls = env->FindClass("org/simgrid/msg/As");
 
-  if (!cls)
+  if (not cls)
     return nullptr;
 
   jtable = env->NewObjectArray(static_cast<jsize>(self_as->children()->size()), cls, nullptr);
 
-  if (!jtable) {
+  if (not jtable) {
     jxbt_throw_jni(env, "Hosts table allocation failed");
     return nullptr;
   }
 
   for (auto tmp_as : *self_as->children()) {
     jobject tmp_jas = jnetzone_new_instance(env);
-    if (!tmp_jas) {
+    if (not tmp_jas) {
       jxbt_throw_jni(env, "java As instantiation failed");
       return nullptr;
     }
     tmp_jas = jnetzone_ref(env, tmp_jas);
-    if (!tmp_jas) {
+    if (not tmp_jas) {
       jxbt_throw_jni(env, "new global ref allocation failed");
       return nullptr;
     }
@@ -100,14 +100,14 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, job
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getProperty(JNIEnv *env, jobject jas, jobject jname) {
   simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
 
-  if (!as) {
+  if (not as) {
     jxbt_throw_notbound(env, "as", jas);
     return nullptr;
   }
   const char *name = env->GetStringUTFChars(static_cast<jstring>(jname), 0);
 
   const char* property = MSG_zone_get_property_value(as, name);
-  if (!property) {
+  if (not property) {
     return nullptr;
   }
 
@@ -126,7 +126,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
   simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
 
   jclass cls = jxbt_get_class(env, "org/simgrid/msg/Host");
-  if (!cls)
+  if (not cls)
     return nullptr;
 
   std::vector<sg_host_t> table;
@@ -134,7 +134,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
 
   jtable = env->NewObjectArray(static_cast<jsize>(table.size()), cls, nullptr);
 
-  if (!jtable) {
+  if (not jtable) {
     jxbt_throw_jni(env, "Hosts table allocation failed");
     return nullptr;
   }
@@ -142,7 +142,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
   int index = 0;
   for (auto host : table) {
     jhost = static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
-    if (!jhost) {
+    if (not jhost) {
       jname = env->NewStringUTF(host->cname());
 
       jhost = Java_org_simgrid_msg_Host_getByName(env, cls, jname);
index 320b159..8d52bfe 100644 (file)
@@ -78,7 +78,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Comm_test(JNIEnv *env, jobject j
     return JNI_TRUE;
   }
 
-  if (!comm) {
+  if (not comm) {
     jxbt_throw_null(env, bprintf("comm is null"));
     return JNI_FALSE;
   }
@@ -98,7 +98,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Comm_test(JNIEnv *env, jobject j
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_waitCompletion(JNIEnv *env, jobject jcomm, jdouble timeout) {
   msg_comm_t comm = (msg_comm_t) (uintptr_t) env->GetLongField(jcomm, jcomm_field_Comm_bind);
-  if (!comm) {
+  if (not comm) {
     jxbt_throw_null(env, bprintf("comm is null"));
     return;
   }
@@ -129,7 +129,7 @@ static msg_comm_t* jarray_to_commArray(JNIEnv *env, jobjectArray jcomms, /* OUT
         break;
 
      comms[i] = (msg_comm_t) (uintptr_t) env->GetLongField(jcomm, jcomm_field_Comm_bind);
-     if (!comms[i]) {
+     if (not comms[i]) {
        jxbt_throw_null(env, bprintf("comm at rank %d is null", i));
        return nullptr;
      }
@@ -142,7 +142,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Comm_waitAll(JNIEnv *env, jclass cls
 {
   int count;
   msg_comm_t* comms = jarray_to_commArray(env, jcomms, &count);
-  if (!comms)
+  if (not comms)
     return;
 
   MSG_comm_waitall(comms, count, static_cast<double>(timeout));
@@ -152,7 +152,7 @@ JNIEXPORT int JNICALL Java_org_simgrid_msg_Comm_waitAny(JNIEnv *env, jclass cls,
 {
   int count;
   msg_comm_t* comms = jarray_to_commArray(env, jcomms, &count);
-  if (!comms)
+  if (not comms)
     return -1;
   xbt_dynar_t dyn = xbt_dynar_new(sizeof(msg_comm_t),nullptr);
   for (int i=0; i<count; i++) {
index 1169daf..2cf5b28 100644 (file)
@@ -62,18 +62,18 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getByName(JNIEnv * env, jcla
   /* get the host by name       (the hosts are created during the grid resolution) */
   msg_host_t host = MSG_host_by_name(name);
 
-  if (!host) {                  /* invalid name */
+  if (not host) { /* invalid name */
     jxbt_throw_host_not_found(env, name);
     env->ReleaseStringUTFChars(jname, name);
     return nullptr;
   }
   env->ReleaseStringUTFChars(jname, name);
 
-  if (!host->extension(JAVA_HOST_LEVEL)) {       /* native host not associated yet with java host */
+  if (not host->extension(JAVA_HOST_LEVEL)) { /* native host not associated yet with java host */
     /* Instantiate a new java host */
     jobject jhost = jhost_new_instance(env);
 
-    if (!jhost) {
+    if (not jhost) {
       jxbt_throw_jni(env, "java host instantiation failed");
       return nullptr;
     }
@@ -81,7 +81,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getByName(JNIEnv * env, jcla
     /* get a global reference to the newly created host */
     jhost = jhost_ref(env, jhost);
 
-    if (!jhost) {
+    if (not jhost) {
       jxbt_throw_jni(env, "new global ref allocation failed");
       return nullptr;
     }
@@ -103,13 +103,13 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_currentHost(JNIEnv * env, jc
 
   msg_host_t host = MSG_host_self();
 
-  if (!host->extension(JAVA_HOST_LEVEL)) {
+  if (not host->extension(JAVA_HOST_LEVEL)) {
     /* the native host not yet associated with the java host instance */
 
     /* instanciate a new java host instance */
     jhost = jhost_new_instance(env);
 
-    if (!jhost) {
+    if (not jhost) {
       jxbt_throw_jni(env, "java host instantiation failed");
       return nullptr;
     }
@@ -117,7 +117,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_currentHost(JNIEnv * env, jc
     /* get a global reference to the newly created host */
     jhost = jhost_ref(env, jhost);
 
-    if (!jhost) {
+    if (not jhost) {
       jxbt_throw_jni(env, "global ref allocation failed");
       return nullptr;
     }
@@ -154,7 +154,7 @@ JNIEXPORT jint JNICALL Java_org_simgrid_msg_Host_getCount(JNIEnv * env, jclass c
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getSpeed(JNIEnv * env, jobject jhost) {
   msg_host_t host = jhost_get_native(env, jhost);
 
-  if (!host) {
+  if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
     return -1;
   }
@@ -165,7 +165,7 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getSpeed(JNIEnv * env, jobje
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCoreNumber(JNIEnv * env, jobject jhost) {
   msg_host_t host = jhost_get_native(env, jhost);
 
-  if (!host) {
+  if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
     return -1;
   }
@@ -176,14 +176,14 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCoreNumber(JNIEnv * env,
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getProperty(JNIEnv *env, jobject jhost, jobject jname) {
   msg_host_t host = jhost_get_native(env, jhost);
 
-  if (!host) {
+  if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
     return nullptr;
   }
   const char *name = env->GetStringUTFChars((jstring) jname, 0);
 
   const char *property = MSG_host_get_property_value(host, name);
-  if (!property) {
+  if (not property) {
     return nullptr;
   }
 
@@ -198,7 +198,7 @@ JNIEXPORT void JNICALL
 Java_org_simgrid_msg_Host_setProperty(JNIEnv *env, jobject jhost, jobject jname, jobject jvalue) {
   msg_host_t host = jhost_get_native(env, jhost);
 
-  if (!host) {
+  if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
     return;
   }
@@ -216,7 +216,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Host_isOn(JNIEnv * env, jobject
 {
   msg_host_t host = jhost_get_native(env, jhost);
 
-  if (!host) {
+  if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
     return 0;
   }
@@ -230,7 +230,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getMountedStorage(JNIEn
   jobject jstorage;
   jstring jname;
 
-  if (!host) {
+  if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
     return 0;
   }
@@ -243,9 +243,9 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getMountedStorage(JNIEn
 
   jtable = env->NewObjectArray((jsize) count, cls, nullptr);
 
-  if (!jtable) {
-   jxbt_throw_jni(env, "Storages table allocation failed");
-   return nullptr;
+  if (not jtable) {
+    jxbt_throw_jni(env, "Storages table allocation failed");
+    return nullptr;
   }
 
   xbt_dict_cursor_t cursor=nullptr;
@@ -266,7 +266,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getAttachedStorage(JNIE
 {
   msg_host_t host = jhost_get_native(env, jhost);
 
-  if (!host) {
+  if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
     return 0;
   }
@@ -290,7 +290,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getStorageContent(JNIEn
 {
   msg_host_t host = jhost_get_native(env, jhost);
 
-  if (!host) {
+  if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
     return 0;
   }
@@ -304,12 +304,12 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_all(JNIEnv * env, jclas
   int count = xbt_dynar_length(table);
 
   jclass cls = jxbt_get_class(env, "org/simgrid/msg/Host");
-  if (!cls)
+  if (not cls)
     return nullptr;
 
   jobjectArray jtable = env->NewObjectArray((jsize)count, cls, nullptr);
 
-  if (!jtable) {
+  if (not jtable) {
     jxbt_throw_jni(env, "Hosts table allocation failed");
     return nullptr;
   }
@@ -318,7 +318,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_all(JNIEnv * env, jclas
     msg_host_t host = xbt_dynar_get_as(table, index, msg_host_t);
     jobject jhost   = static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
 
-    if (!jhost) {
+    if (not jhost) {
       jstring jname = env->NewStringUTF(host->cname());
       jhost         = Java_org_simgrid_msg_Host_getByName(env, cls_arg, jname);
     }
@@ -340,7 +340,7 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getConsumedEnergy (JNIEnv *e
 {
   msg_host_t host = jhost_get_native(env, jhost);
 
-  if (!host) {
+  if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
     return 0;
   }
index 400ab15..8fcbe02 100644 (file)
@@ -100,14 +100,14 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID(JNIEnv * env, jcl
 {
   msg_process_t process = MSG_process_from_PID(pid);
 
-  if (!process) {
+  if (not process) {
     jxbt_throw_process_not_found(env, bprintf("PID = %d",static_cast<int>(pid)));
     return nullptr;
   }
 
   jobject jprocess = jprocess_from_native(process);
 
-  if (!jprocess) {
+  if (not jprocess) {
     jxbt_throw_jni(env, "get process failed");
     return nullptr;
   }
@@ -118,14 +118,14 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_fromPID(JNIEnv * env, jcl
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getProperty(JNIEnv *env, jobject jprocess, jobject jname) {
   msg_process_t process = jprocess_to_native(jprocess, env);
 
-  if (!process) {
+  if (not process) {
     jxbt_throw_notbound(env, "process", jprocess);
     return nullptr;
   }
   const char *name = env->GetStringUTFChars((jstring)jname, 0);
 
   const char *property = MSG_process_get_property_value(process, name);
-  if (!property)
+  if (not property)
     return nullptr;
 
   jobject jproperty = env->NewStringUTF(property);
@@ -138,7 +138,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getProperty(JNIEnv *env,
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Process_getCurrentProcess(JNIEnv * env, jclass cls)
 {
   jobject jprocess = jprocess_from_native(MSG_process_self());
-  if (!jprocess)
+  if (not jprocess)
     jxbt_throw_jni(env, xbt_strdup("SIMIX_process_get_jprocess() failed"));
 
   return jprocess;
@@ -148,7 +148,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_suspend(JNIEnv * env, jobjec
 {
   msg_process_t process = jprocess_to_native(jprocess, env);
 
-  if (!process) {
+  if (not process) {
     jxbt_throw_notbound(env, "process", jprocess);
     return;
   }
@@ -163,7 +163,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_resume(JNIEnv * env, jobject
 {
   msg_process_t process = jprocess_to_native(jprocess, env);
 
-  if (!process) {
+  if (not process) {
     jxbt_throw_notbound(env, "process", jprocess);
     return;
   }
@@ -177,7 +177,7 @@ JNIEXPORT void
 JNICALL Java_org_simgrid_msg_Process_setAutoRestart (JNIEnv *env, jobject jprocess, jboolean jauto_restart) {
 
   msg_process_t process = jprocess_to_native(jprocess, env);
-  if (!process) {
+  if (not process) {
     jxbt_throw_notbound(env, "process", jprocess);
     return;
   }
@@ -189,7 +189,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_restart (JNIEnv *env, jobjec
   msg_process_t process = jprocess_to_native(jprocess, env);
   xbt_ex_t e;
 
-  if (!process) {
+  if (not process) {
     jxbt_throw_notbound(env, "process", jprocess);
     return;
   }
@@ -206,7 +206,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Process_isSuspended(JNIEnv * env
 {
   msg_process_t process = jprocess_to_native(jprocess, env);
 
-  if (!process) {
+  if (not process) {
     jxbt_throw_notbound(env, "process", jprocess);
     return 0;
   }
@@ -250,7 +250,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_kill(JNIEnv * env, jobject j
 {
   /* get the native instances from the java ones */
   msg_process_t process = jprocess_to_native(jprocess, env);
-  if (!process) {
+  if (not process) {
     jxbt_throw_notbound(env, "process", jprocess);
     return;
   }
@@ -267,14 +267,14 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_migrate(JNIEnv * env, jobjec
 {
   msg_process_t process = jprocess_to_native(jprocess, env);
 
-  if (!process) {
+  if (not process) {
     jxbt_throw_notbound(env, "process", jprocess);
     return;
   }
 
   msg_host_t host = jhost_get_native(env, jhost);
 
-  if (!host) {
+  if (not host) {
     jxbt_throw_notbound(env, "host", jhost);
     return;
   }
index aa1a050..0bb54a2 100644 (file)
@@ -16,7 +16,7 @@ jfieldID jrngstream_bind;
 
 RngStream jrngstream_to_native(JNIEnv *env, jobject jrngstream) {
   RngStream rngstream = (RngStream)(intptr_t)env->GetLongField(jrngstream, jrngstream_bind);
-  if (!rngstream) {
+  if (not rngstream) {
     jxbt_throw_notbound(env, "rngstream", jrngstream);
     return nullptr;
   }
@@ -67,7 +67,7 @@ Java_org_simgrid_msg_RngStream_setPackageSeed(JNIEnv *env, jobject jrngstream, j
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_resetStart(JNIEnv *env, jobject jrngstream) {
   RngStream rngstream = jrngstream_to_native(env, jrngstream);
-  if (!rngstream)
+  if (not rngstream)
     return;
 
   RngStream_ResetStartStream(rngstream);
@@ -75,7 +75,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_resetStart(JNIEnv *env, jo
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_resetStartSubstream(JNIEnv *env, jobject jrngstream) {
   RngStream rngstream = jrngstream_to_native(env, jrngstream);
-  if (!rngstream)
+  if (not rngstream)
     return;
 
   RngStream_ResetStartSubstream(rngstream);
@@ -83,7 +83,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_resetStartSubstream(JNIEnv
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_resetNextSubstream(JNIEnv *env, jobject jrngstream) {
   RngStream rngstream = jrngstream_to_native(env, jrngstream);
-  if (!rngstream)
+  if (not rngstream)
     return;
 
   RngStream_ResetNextSubstream(rngstream);
@@ -91,7 +91,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_resetNextSubstream(JNIEnv
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_setAntithetic(JNIEnv *env, jobject jrngstream, jboolean ja) {
   RngStream rngstream = jrngstream_to_native(env, jrngstream);
-  if (!rngstream)
+  if (not rngstream)
     return;
 
   if (ja == JNI_TRUE) {
@@ -108,7 +108,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_RngStream_setSeed(JNIEnv *env, j
   env->GetIntArrayRegion(jseed, 0, 6, buffer);
 
   RngStream rngstream = jrngstream_to_native(env, jrngstream);
-  if (!rngstream)
+  if (not rngstream)
     return JNI_FALSE;
 
   // The C API expects unsigned long which are wider than int on LP64.
@@ -124,7 +124,7 @@ JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_RngStream_setSeed(JNIEnv *env, j
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_advanceState(JNIEnv *env, jobject jrngstream, jint e, jint g) {
   RngStream rngstream = jrngstream_to_native(env, jrngstream);
-  if (!rngstream)
+  if (not rngstream)
     return;
 
   RngStream_AdvanceState(rngstream, (long)e, (long)g);
@@ -132,7 +132,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_RngStream_advanceState(JNIEnv *env,
 
 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_RngStream_randU01(JNIEnv *env, jobject jrngstream) {
   RngStream rngstream = jrngstream_to_native(env, jrngstream);
-  if (!rngstream)
+  if (not rngstream)
     return 0;
 
   return (jdouble)RngStream_RandU01(rngstream);
@@ -140,7 +140,7 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_RngStream_randU01(JNIEnv *env, jo
 
 JNIEXPORT jint JNICALL Java_org_simgrid_msg_RngStream_randInt(JNIEnv *env, jobject jrngstream, jint i, jint j) {
   RngStream rngstream = jrngstream_to_native(env, jrngstream);
-  if (!rngstream)
+  if (not rngstream)
     return 0;
 
   return (jint)RngStream_RandInt(rngstream, (int)i, (int)j);
index 15bd3fe..a9f5629 100644 (file)
@@ -63,7 +63,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv * env, j
   const char *name = env->GetStringUTFChars(jname, 0);
   storage = MSG_storage_get_by_name(name);
 
-  if (!storage) {                  /* invalid name */
+  if (not storage) { /* invalid name */
     jxbt_throw_storage_not_found(env, name);
     env->ReleaseStringUTFChars(jname, name);
     return nullptr;
@@ -74,7 +74,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv * env, j
     /* Instantiate a new java storage */
     jstorage = jstorage_new_instance(env);
 
-    if (!jstorage) {
+    if (not jstorage) {
       jxbt_throw_jni(env, "java storage instantiation failed");
       return nullptr;
     }
@@ -82,7 +82,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv * env, j
     /* get a global reference to the newly created storage */
     jstorage = jstorage_ref(env, jstorage);
 
-    if (!jstorage) {
+    if (not jstorage) {
       jxbt_throw_jni(env, "new global ref allocation failed");
       return nullptr;
     }
@@ -105,7 +105,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);
 
-  if (!storage) {
+  if (not storage) {
     jxbt_throw_notbound(env, "storage", jstorage);
     return -1;
   }
@@ -116,7 +116,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);
 
-  if (!storage) {
+  if (not storage) {
     jxbt_throw_notbound(env, "storage", jstorage);
     return -1;
   }
@@ -127,7 +127,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);
 
-  if (!storage) {
+  if (not storage) {
     jxbt_throw_notbound(env, "storage", jstorage);
     return -1;
   }
@@ -138,14 +138,14 @@ JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getUsedSize(JNIEnv * env,jo
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getProperty(JNIEnv *env, jobject jstorage, jobject jname) {
   msg_storage_t storage = jstorage_get_native(env, jstorage);
 
-  if (!storage) {
+  if (not storage) {
     jxbt_throw_notbound(env, "storage", jstorage);
     return nullptr;
   }
   const char *name = env->GetStringUTFChars((jstring) jname, 0);
 
   const char *property = MSG_storage_get_property_value(storage, name);
-  if (!property) {
+  if (not property) {
     return nullptr;
   }
   jobject jproperty = env->NewStringUTF(property);
@@ -159,7 +159,7 @@ JNIEXPORT void JNICALL
 Java_org_simgrid_msg_Storage_setProperty(JNIEnv *env, jobject jstorage, jobject jname, jobject jvalue) {
   msg_storage_t storage = jstorage_get_native(env, jstorage);
 
-  if (!storage) {
+  if (not storage) {
     jxbt_throw_notbound(env, "storage", jstorage);
     return;
   }
@@ -177,12 +177,12 @@ Java_org_simgrid_msg_Storage_setProperty(JNIEnv *env, jobject jstorage, jobject
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getHost(JNIEnv * env,jobject jstorage) {
   msg_storage_t storage = jstorage_get_native(env, jstorage);
 
-  if (!storage) {
+  if (not storage) {
     jxbt_throw_notbound(env, "storage", jstorage);
     return nullptr;
   }
   const char *host_name = MSG_storage_get_host(storage);
-  if (!host_name) {
+  if (not host_name) {
     return nullptr;
   }
   jobject jhost_name = env->NewStringUTF(host_name);
@@ -203,13 +203,13 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Storage_all(JNIEnv * env, jc
 
   jclass cls = jxbt_get_class(env, "org/simgrid/msg/Storage");
 
-  if (!cls) {
+  if (not cls) {
     return nullptr;
   }
 
   jtable = env->NewObjectArray((jsize) count, cls, nullptr);
 
-  if (!jtable) {
+  if (not jtable) {
     jxbt_throw_jni(env, "Storages table allocation failed");
     return nullptr;
   }
index d615184..47dfe47 100644 (file)
@@ -105,7 +105,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_cancel(JNIEnv * env, jobject jt
 {
   msg_task_t ptask = jtask_to_native(jtask, env);
 
-  if (!ptask) {
+  if (not ptask) {
     jxbt_throw_notbound(env, "task", jtask);
     return;
   }
@@ -119,7 +119,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_execute(JNIEnv * env, jobject j
 {
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     jxbt_throw_notbound(env, "task", jtask);
     return;
   }
@@ -136,7 +136,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setBound(JNIEnv * env, jobject
 {
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     jxbt_throw_notbound(env, "task", jtask);
     return;
   }
@@ -146,7 +146,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setBound(JNIEnv * env, jobject
 JNIEXPORT jstring JNICALL Java_org_simgrid_msg_Task_getName(JNIEnv * env, jobject jtask) {
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     jxbt_throw_notbound(env, "task", jtask);
     return nullptr;
   }
@@ -159,7 +159,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_getSender(JNIEnv * env, jobj
 
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     jxbt_throw_notbound(env, "task", jtask);
     return nullptr;
   }
@@ -176,7 +176,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_getSource(JNIEnv * env, jobj
   msg_host_t host;
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     jxbt_throw_notbound(env, "task", jtask);
     return nullptr;
   }
@@ -185,7 +185,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_getSource(JNIEnv * env, jobj
   if (host == nullptr) {
     return nullptr;
   }
-  if (!host->extension(JAVA_HOST_LEVEL)) {
+  if (not host->extension(JAVA_HOST_LEVEL)) {
     jxbt_throw_jni(env, "MSG_task_get_source() failed");
     return nullptr;
   }
@@ -197,7 +197,7 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Task_getFlopsAmount(JNIEnv * env,
 {
   msg_task_t ptask = jtask_to_native(jtask, env);
 
-  if (!ptask) {
+  if (not ptask) {
     jxbt_throw_notbound(env, "task", jtask);
     return -1;
   }
@@ -207,7 +207,7 @@ JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Task_getFlopsAmount(JNIEnv * env,
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setName(JNIEnv *env, jobject jtask, jobject jname) {
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     jxbt_throw_notbound(env, "task", jtask);
     return;
   }
@@ -223,7 +223,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setPriority(JNIEnv * env, jobje
 {
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     jxbt_throw_notbound(env, "task", jtask);
     return;
   }
@@ -234,7 +234,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setFlopsAmount (JNIEnv *env, jo
 {
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     jxbt_throw_notbound(env, "task", jtask);
     return;
   }
@@ -245,7 +245,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_setBytesAmount (JNIEnv *env, jo
 {
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     jxbt_throw_notbound(env, "task", jtask);
     return;
   }
@@ -257,7 +257,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_sendBounded(JNIEnv * env,jobjec
                                                              jdouble jtimeout,jdouble maxrate)
 {
   msg_task_t task = jtask_to_native(jtask, env);
-  if (!task) {
+  if (not task) {
     jxbt_throw_notbound(env, "task", jtask);
     return;
   }
@@ -299,7 +299,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv* env, jclass
 
 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecv(JNIEnv * env, jclass cls, jstring jmailbox) {
   jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
-  if (!comm_class)
+  if (not comm_class)
     return nullptr;
 
   //pointer to store the task object pointer.
@@ -308,7 +308,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecv(JNIEnv * env, jclass c
   /* There should be a cache here */
 
   jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
-  if (!jcomm) {
+  if (not jcomm) {
     jxbt_throw_jni(env, "Can't create a Comm object.");
     return nullptr;
   }
@@ -354,14 +354,14 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_irecvBounded(JNIEnv * env, j
                                                                  jdouble rate)
 {
   jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
-  if (!comm_class)
+  if (not comm_class)
     return nullptr;
 
   // pointer to store the task object pointer.
   msg_task_t* task = xbt_new0(msg_task_t, 1);
 
   jobject jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
-  if (!jcomm) {
+  if (not jcomm) {
     jxbt_throw_jni(env, "Can't create a Comm object.");
     return nullptr;
   }
@@ -383,14 +383,15 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isend(JNIEnv *env, jobject j
 
   jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
 
-  if (!comm_class) return nullptr;
+  if (not comm_class)
+    return nullptr;
 
   jobject jcomm       = env->NewObject(comm_class, jtask_method_Comm_constructor);
   const char* mailbox = env->GetStringUTFChars(jmailbox, 0);
 
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     env->ReleaseStringUTFChars(jmailbox, mailbox);
     env->DeleteLocalRef(jcomm);
     jxbt_throw_notbound(env, "task", jtask);
@@ -418,7 +419,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isendBounded(JNIEnv *env, jo
   const char *mailbox;
 
   jclass comm_class = env->FindClass("org/simgrid/msg/Comm");
-  if (!comm_class)
+  if (not comm_class)
     return nullptr;
 
   jcomm = env->NewObject(comm_class, jtask_method_Comm_constructor);
@@ -426,7 +427,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_isendBounded(JNIEnv *env, jo
 
   task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     env->ReleaseStringUTFChars(jmailbox, mailbox);
     env->DeleteLocalRef(jcomm);
     jxbt_throw_notbound(env, "task", jtask);
@@ -449,7 +450,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_nativeFinalize(JNIEnv * env, jo
 {
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     jxbt_throw_notbound(env, "task", jtask);
     return;
     }
@@ -474,7 +475,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_dsend(JNIEnv * env, jobject jta
 
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     env->ReleaseStringUTFChars(jalias, alias);
     jxbt_throw_notbound(env, "task", jtask);
     return;
@@ -494,7 +495,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_dsendBounded(JNIEnv * env, jobj
 
   msg_task_t task = jtask_to_native(jtask, env);
 
-  if (!task) {
+  if (not task) {
     env->ReleaseStringUTFChars(jalias, alias);
     jxbt_throw_notbound(env, "task", jtask);
     return;
index 307b8f3..fc5da71 100644 (file)
@@ -101,11 +101,11 @@ JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_VM_all(JNIEnv* env, jclass c
   int count = vms.size();
 
   jclass cls = jxbt_get_class(env, "org/simgrid/msg/VM");
-  if (!cls)
+  if (not cls)
     return nullptr;
 
   jobjectArray jtable = env->NewObjectArray((jsize)count, cls, nullptr);
-  if (!jtable) {
+  if (not jtable) {
     jxbt_throw_jni(env, "Hosts table allocation failed");
     return nullptr;
   }
@@ -180,7 +180,7 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_VM_getVMByName(JNIEnv* env, jclas
   /* get the VM by name   (VMs are just special hosts, unfortunately) */
   msg_host_t host = MSG_host_by_name(name);
 
-  if (!host) { /* invalid name */
+  if (not host) { /* invalid name */
     jxbt_throw_host_not_found(env, name);
     env->ReleaseStringUTFChars(jname, name);
     return nullptr;
index c735ff4..128f077 100644 (file)
@@ -16,7 +16,7 @@ jclass jxbt_get_class(JNIEnv * env, const char *name)
 {
   jclass cls = env->FindClass(name);
 
-  if (!cls) {
+  if (not cls) {
     jxbt_throw_jni(env, std::string("Class ") + name + " not found");
     return nullptr;
   }
@@ -28,11 +28,11 @@ jmethodID jxbt_get_jmethod(JNIEnv * env, jclass cls, const char *name, const cha
 {
   jmethodID id;
 
-  if (!cls)
+  if (not cls)
     return 0;
   id = env->GetMethodID(cls, name, signature);
 
-  if (!id) {
+  if (not id) {
 
     jmethodID tostr_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;");
     jstring jclassname = (jstring) env->CallObjectMethod(cls, tostr_id, nullptr);
@@ -51,11 +51,11 @@ jmethodID jxbt_get_static_jmethod(JNIEnv * env, jclass cls, const char *name, co
 {
   jmethodID id;
 
-  if (!cls)
+  if (not cls)
     return 0;
   id = env->GetStaticMethodID(cls, name, signature);
 
-  if (!id) {
+  if (not id) {
     jmethodID tostr_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;");
     jstring jclassname = (jstring) env->CallObjectMethod(cls, tostr_id, nullptr);
     const char *classname = env->GetStringUTFChars(jclassname, 0);
@@ -75,12 +75,12 @@ jmethodID jxbt_get_static_smethod(JNIEnv * env, const char *classname, const cha
   jmethodID id;
   cls = jxbt_get_class(env, classname);
 
-  if (!cls)
+  if (not cls)
     return 0;
 
   id = env->GetStaticMethodID(cls, name, signature);
 
-  if (!id) {
+  if (not id) {
     jxbt_throw_jni(env, std::string("Cannot find static method") + name + "(" + signature + ") in " + classname);
     return 0;
   }
@@ -93,12 +93,12 @@ jmethodID jxbt_get_smethod(JNIEnv * env, const char *classname, const char *name
   jmethodID id;
   cls = jxbt_get_class(env, classname);
 
-  if (!cls)
+  if (not cls)
     return 0;
 
   id = env->GetMethodID(cls, name, signature);
 
-  if (!id) {
+  if (not id) {
     jxbt_throw_jni(env, std::string("Cannot find method") + name + "(" + signature + ") in " + classname);
     return 0;
   }
@@ -109,12 +109,12 @@ jfieldID jxbt_get_jfield(JNIEnv * env, jclass cls, const char *name, const char
 {
   jfieldID id;
 
-  if (!cls)
+  if (not cls)
     return 0;
 
   id = env->GetFieldID(cls, name, signature);
 
-  if (!id) {
+  if (not id) {
     jmethodID getname_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;");
     jstring jclassname = (jstring) env->CallObjectMethod(cls, getname_id, nullptr);
     const char *classname = env->GetStringUTFChars(jclassname, 0);
@@ -134,12 +134,12 @@ jfieldID jxbt_get_sfield(JNIEnv * env, const char *classname, const char *name,
   jclass cls = jxbt_get_class(env, classname);
   jfieldID id;
 
-  if (!cls)
+  if (not cls)
     return 0;
 
   id = env->GetFieldID(cls, name, signature);
 
-  if (!id) {
+  if (not id) {
     jxbt_throw_jni(env, std::string("Cannot find field") + signature + " " + name + " in " + classname);
     return 0;
   }
index 79b1bc5..df54f3f 100644 (file)
@@ -198,7 +198,7 @@ void* sglua_checkudata_debug(lua_State* L, int ud, const char* tname)
   XBT_DEBUG("Checking the task's metatable: expected %p, found %p", correct_mt, actual_mt);
   sglua_stack_dump(L, "my_checkudata: ");
 
-  if (p == nullptr || !lua_getmetatable(L, ud) || !lua_rawequal(L, -1, -2))
+  if (p == nullptr || not lua_getmetatable(L, ud) || not lua_rawequal(L, -1, -2))
     XBT_ERROR("Error: Userdata is nullptr, couldn't find metatable or top of stack does not equal element below it.");
   lua_pop(L, 2);
   return p;
index 71484a4..4d4eac9 100644 (file)
@@ -34,7 +34,7 @@ sg_host_t sglua_check_host(lua_State * L, int index)
   if (pi == nullptr)
     XBT_ERROR("luaL_checkudata() returned nullptr");
   sg_host_t ht = *pi;
-  if (!ht)
+  if (not ht)
     luaL_error(L, "null Host");
   return ht;
 }
index dea2bab..3f9a36d 100644 (file)
@@ -94,9 +94,9 @@ int console_add_backbone(lua_State *L) {
   lua_pushstring(L, "sharing_policy");
   type = lua_gettable(L, -2);
   const char* policy = lua_tostring(L, -1);
-  if (policy && !strcmp(policy,"FULLDUPLEX")) {
+  if (policy && not strcmp(policy, "FULLDUPLEX")) {
     link.policy = SURF_LINK_FULLDUPLEX;
-  } else if (policy && !strcmp(policy,"FATPIPE")) {
+  } else if (policy && not strcmp(policy, "FATPIPE")) {
     link.policy = SURF_LINK_FATPIPE;
   } else {
     link.policy = SURF_LINK_SHARED;
@@ -173,8 +173,8 @@ int console_add_host(lua_State *L) {
   // get core
   lua_pushstring(L, "core");
   lua_gettable(L, -2);
-  if(!lua_isnumber(L,-1))
-      host.core_amount = 1;// Default value
+  if (not lua_isnumber(L, -1))
+    host.core_amount = 1; // Default value
   else
     host.core_amount = lua_tonumber(L, -1);
   if (host.core_amount == 0)
@@ -270,9 +270,9 @@ int  console_add_link(lua_State *L) {
   lua_gettable(L, -2);
   policy = lua_tostring(L, -1);
   lua_pop(L, 1);
-  if (policy && !strcmp(policy,"FULLDUPLEX")) {
+  if (policy && not strcmp(policy, "FULLDUPLEX")) {
     link.policy = SURF_LINK_FULLDUPLEX;
-  } else if (policy && !strcmp(policy,"FATPIPE")) {
+  } else if (policy && not strcmp(policy, "FATPIPE")) {
     link.policy = SURF_LINK_FATPIPE;
   } else {
     link.policy = SURF_LINK_SHARED;
@@ -473,13 +473,20 @@ int console_AS_open(lua_State *L) {
  lua_pop(L, 1);
 
  int mode_int = A_surfxml_AS_routing_None;
- if(!strcmp(mode,"Full")) mode_int = A_surfxml_AS_routing_Full;
- else if(!strcmp(mode,"Floyd")) mode_int = A_surfxml_AS_routing_Floyd;
- else if(!strcmp(mode,"Dijkstra")) mode_int = A_surfxml_AS_routing_Dijkstra;
- else if(!strcmp(mode,"DijkstraCache")) mode_int = A_surfxml_AS_routing_DijkstraCache;
- else if(!strcmp(mode,"Vivaldi")) mode_int = A_surfxml_AS_routing_Vivaldi;
- else if(!strcmp(mode,"Cluster")) mode_int = A_surfxml_AS_routing_Cluster;
- else if(!strcmp(mode,"none")) mode_int = A_surfxml_AS_routing_None;
+ if (not strcmp(mode, "Full"))
+   mode_int = A_surfxml_AS_routing_Full;
+ else if (not strcmp(mode, "Floyd"))
+   mode_int = A_surfxml_AS_routing_Floyd;
+ else if (not strcmp(mode, "Dijkstra"))
+   mode_int = A_surfxml_AS_routing_Dijkstra;
+ else if (not strcmp(mode, "DijkstraCache"))
+   mode_int = A_surfxml_AS_routing_DijkstraCache;
+ else if (not strcmp(mode, "Vivaldi"))
+   mode_int = A_surfxml_AS_routing_Vivaldi;
+ else if (not strcmp(mode, "Cluster"))
+   mode_int = A_surfxml_AS_routing_Cluster;
+ else if (not strcmp(mode, "none"))
+   mode_int = A_surfxml_AS_routing_None;
  else xbt_die("Don't have the model name '%s'",mode);
 
  s_sg_platf_AS_cbarg_t AS;
index 8b923a6..e6eb6f5 100644 (file)
@@ -105,9 +105,9 @@ int TRACE_start()
     /* open the trace file(s) */
     const char* format = xbt_cfg_get_string(OPT_TRACING_FORMAT);
     XBT_DEBUG("Tracing format %s\n", format);
-    if(!strcmp(format, "Paje")){
+    if (not strcmp(format, "Paje")) {
       TRACE_paje_start();
-    }else if (!strcmp(format, "TI")){
+    } else if (not strcmp(format, "TI")) {
       instr_fmt_type = instr_fmt_TI;
       TRACE_TI_start();
     }else{
@@ -134,7 +134,7 @@ int TRACE_start()
 int TRACE_end()
 {
   int retval;
-  if (!trace_active) {
+  if (not trace_active) {
     retval = 1;
   } else {
     retval = 0;
@@ -161,9 +161,9 @@ int TRACE_end()
     /* close the trace files */
     const char* format = xbt_cfg_get_string(OPT_TRACING_FORMAT);
     XBT_DEBUG("Tracing format %s\n", format);
-    if(!strcmp(format, "Paje")){
+    if (not strcmp(format, "Paje")) {
       TRACE_paje_end();
-    }else if (!strcmp(format, "TI")){
+    } else if (not strcmp(format, "TI")) {
       TRACE_TI_end();
     }else{
       xbt_die("Unknown trace format :%s ", format);
@@ -605,7 +605,7 @@ static int previous_trace_state = -1;
 void instr_pause_tracing ()
 {
   previous_trace_state = trace_enabled;
-  if (!TRACE_is_enabled()){
+  if (not TRACE_is_enabled()) {
     XBT_DEBUG ("Tracing is already paused, therefore do nothing.");
   }else{
     XBT_DEBUG ("Tracing is being paused.");
index 7946c2b..dbefe45 100644 (file)
@@ -30,7 +30,7 @@ extern xbt_dict_t trivaEdgeTypes;
 
 static xbt_dynar_t instr_dict_to_dynar (xbt_dict_t filter)
 {
-  if (!TRACE_is_enabled() || !TRACE_needs_platform())
+  if (not TRACE_is_enabled() || not TRACE_needs_platform())
     return nullptr;
 
   xbt_dynar_t ret = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
@@ -81,7 +81,7 @@ void TRACE_category(const char *category)
 void TRACE_category_with_color (const char *category, const char *color)
 {
   /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with categories */
-  if (!TRACE_is_enabled() || !TRACE_needs_platform())
+  if (not TRACE_is_enabled() || not TRACE_needs_platform())
     return;
 
   if (!(TRACE_categorized() && category != nullptr))
@@ -95,7 +95,7 @@ void TRACE_category_with_color (const char *category, const char *color)
 
   //define final_color
   char final_color[INSTR_DEFAULT_STR_SIZE];
-  if (!color){
+  if (not color) {
     //generate a random color
     double red = drand48();
     double green = drand48();
@@ -125,7 +125,7 @@ void TRACE_category_with_color (const char *category, const char *color)
  */
 xbt_dynar_t TRACE_get_categories ()
 {
-  if (!TRACE_is_enabled() || !TRACE_categorized())
+  if (not TRACE_is_enabled() || not TRACE_categorized())
     return nullptr;
 
   return instr_dict_to_dynar (created_categories);
@@ -144,10 +144,10 @@ xbt_dynar_t TRACE_get_categories ()
 void TRACE_declare_mark(const char *mark_type)
 {
   /* safe switchs. tracing has to be activated and if platform is not traced, we can't deal with marks */
-  if (!TRACE_is_enabled() || !TRACE_needs_platform())
+  if (not TRACE_is_enabled() || not TRACE_needs_platform())
     return;
 
-  if (!mark_type)
+  if (not mark_type)
     THROWF (tracing_error, 1, "mark_type is nullptr");
 
   //check if mark_type is already declared
@@ -178,21 +178,21 @@ void TRACE_declare_mark(const char *mark_type)
 void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mark_value, const char *mark_color)
 {
   /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with marks */
-  if (!TRACE_is_enabled() || !TRACE_needs_platform())
+  if (not TRACE_is_enabled() || not TRACE_needs_platform())
     return;
 
-  if (!mark_type)
+  if (not mark_type)
     THROWF (tracing_error, 1, "mark_type is nullptr");
-  if (!mark_value)
+  if (not mark_value)
     THROWF (tracing_error, 1, "mark_value is nullptr");
 
   type_t type = PJ_type_get (mark_type, PJ_type_get_root());
-  if (!type){
+  if (not type) {
     THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
   }
 
   char white[INSTR_DEFAULT_STR_SIZE] = "1.0 1.0 1.0";
-  if (!mark_color)
+  if (not mark_color)
     mark_color = white;
 
   XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
@@ -233,17 +233,17 @@ void TRACE_declare_mark_value (const char *mark_type, const char *mark_value)
 void TRACE_mark(const char *mark_type, const char *mark_value)
 {
   /* safe switches. tracing has to be activated and if platform is not traced, we can't deal with marks */
-  if (!TRACE_is_enabled() || !TRACE_needs_platform())
+  if (not TRACE_is_enabled() || not TRACE_needs_platform())
     return;
 
-  if (!mark_type)
+  if (not mark_type)
     THROWF (tracing_error, 1, "mark_type is nullptr");
-  if (!mark_value)
+  if (not mark_value)
     THROWF (tracing_error, 1, "mark_value is nullptr");
 
   //check if mark_type is already declared
   type_t type = PJ_type_get (mark_type, PJ_type_get_root());
-  if (!type){
+  if (not type) {
     THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
   }
 
@@ -261,7 +261,7 @@ void TRACE_mark(const char *mark_type, const char *mark_value)
  */
 xbt_dynar_t TRACE_get_marks ()
 {
-  if (!TRACE_is_enabled())
+  if (not TRACE_is_enabled())
     return nullptr;
 
   return instr_dict_to_dynar (declared_marks);
@@ -271,13 +271,13 @@ static void instr_user_variable(double time, const char *resource, const char *v
                          double value, InstrUserVariable what, const char *color, xbt_dict_t filter)
 {
   /* safe switches. tracing has to be activated and if platform is not traced, we don't allow user variables */
-  if (!TRACE_is_enabled() || !TRACE_needs_platform())
+  if (not TRACE_is_enabled() || not TRACE_needs_platform())
     return;
 
   //check if variable is already declared
   char *created = (char*)xbt_dict_get_or_null(filter, variable);
   if (what == INSTR_US_DECLARE){
-    if (!created) { // not declared yet
+    if (not created) { // not declared yet
       xbt_dict_set (filter, variable, xbt_strdup("1"), nullptr);
       instr_new_user_variable_type (father_type, variable, color);
     }
@@ -309,11 +309,11 @@ static void instr_user_srcdst_variable(double time, const char *src, const char
                               const char *father_type, double value, InstrUserVariable what)
 {
   sg_netpoint_t src_elm = sg_netpoint_by_name_or_null(src);
-  if(!src_elm)
+  if (not src_elm)
     xbt_die("Element '%s' not found!",src);
 
   sg_netpoint_t dst_elm = sg_netpoint_by_name_or_null(dst);
-  if(!dst_elm)
+  if (not dst_elm)
     xbt_die("Element '%s' not found!",dst);
 
   std::vector<simgrid::surf::LinkImpl*> route;
@@ -336,7 +336,7 @@ static void instr_user_srcdst_variable(double time, const char *src, const char
 int TRACE_platform_graph_export_graphviz (const char *filename)
 {
   /* returns 1 if successful, 0 otherwise */
-  if (!TRACE_is_enabled())
+  if (not TRACE_is_enabled())
     return 0;
   xbt_graph_t g = instr_routing_platform_graph();
   if (g == nullptr)
index 9b50d75..f024629 100644 (file)
@@ -203,7 +203,7 @@ void PJ_container_free (container_t container)
   TRACE_paje_dump_buffer(1);
 
   //trace my destruction
-  if (!TRACE_disable_destroy() && container != PJ_container_get_root()){
+  if (not TRACE_disable_destroy() && container != PJ_container_get_root()) {
     //do not trace the container destruction if user requests
     //or if the container is root
     new DestroyContainerEvent(container);
@@ -245,7 +245,7 @@ void PJ_container_free_all ()
   rootContainer = nullptr;
 
   //checks
-  if (!xbt_dict_is_empty(allContainers)){
+  if (not xbt_dict_is_empty(allContainers)) {
     THROWF(tracing_error, 0, "some containers still present even after destroying all of them");
   }
 }
index 54473ac..c574f80 100644 (file)
@@ -44,18 +44,20 @@ void buffer_debug(std::vector<PajeEvent*> *buf);
 
 void dump_comment (const char *comment)
 {
-  if (!strlen(comment)) return;
+  if (not strlen(comment))
+    return;
   fprintf (tracing_file, "# %s\n", comment);
 }
 
 void dump_comment_file (const char *filename)
 {
-  if (!strlen(filename)) return;
+  if (not strlen(filename))
+    return;
   FILE *file = fopen (filename, "r");
-  if (!file){
+  if (not file) {
     THROWF (system_error, 1, "Comment file %s could not be opened for reading.", filename);
   }
-  while (!feof(file)){
+  while (not feof(file)) {
     char c;
     c = fgetc(file);
     if (feof(file)) break;
@@ -74,7 +76,8 @@ double TRACE_last_timestamp_to_dump = 0;
 //dumps the trace file until the timestamp TRACE_last_timestamp_to_dump
 void TRACE_paje_dump_buffer (int force)
 {
-  if (!TRACE_is_enabled()) return;
+  if (not TRACE_is_enabled())
+    return;
   XBT_DEBUG("%s: dump until %f. starts", __FUNCTION__, TRACE_last_timestamp_to_dump);
   if (force){
     for (auto event : buffer){
@@ -429,9 +432,9 @@ void CreateContainerEvent::print() {
                        prefix = xbt_os_time();
                }
 
-               if (!xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || ti_unique_file == nullptr) {
-                       char *folder_name = bprintf("%s_files", TRACE_get_filename());
-                       char *filename = bprintf("%s/%f_%s.txt", folder_name, prefix, container->name);
+                if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || ti_unique_file == nullptr) {
+                  char* folder_name = bprintf("%s_files", TRACE_get_filename());
+                  char* filename    = bprintf("%s/%f_%s.txt", folder_name, prefix, container->name);
 #ifdef WIN32
                        _mkdir(folder_name);
 #else
@@ -473,14 +476,14 @@ void DestroyContainerEvent::print() {
 
                print_row();
        } else if (instr_fmt_type == instr_fmt_TI) {
-               if (!xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file")|| xbt_dict_length(tracing_files) == 1) {
-                       FILE* f = (FILE*)xbt_dict_get_or_null(tracing_files, container->name);
-                       fclose(f);
-               }
-               xbt_dict_remove(tracing_files, container->name);
-       } else {
-               THROW_IMPOSSIBLE;
-       }
+          if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || xbt_dict_length(tracing_files) == 1) {
+            FILE* f = (FILE*)xbt_dict_get_or_null(tracing_files, container->name);
+            fclose(f);
+          }
+          xbt_dict_remove(tracing_files, container->name);
+        } else {
+          THROW_IMPOSSIBLE;
+        }
 }
 
 SetVariableEvent::SetVariableEvent (double timestamp, container_t container, type_t type, double value)
index c9baee5..acb89e3 100644 (file)
@@ -156,7 +156,7 @@ type_t PJ_type_variable_new (const char *name, const char *color, type_t father)
   type_t ret = nullptr;
 
   char white[INSTR_DEFAULT_STR_SIZE] = "1 1 1";
-  if (!color){
+  if (not color) {
     ret = newType (name, name, white, TYPE_VARIABLE, father);
   }else{
     ret = newType (name, name, color, TYPE_VARIABLE, father);
index 0cfed5e..3135882 100644 (file)
@@ -26,7 +26,7 @@ static void __TRACE_surf_check_variable_set_to_zero(double now, const char *vari
   snprintf (key, n, "%s%s", resource, variable);
 
   // check if key exists: if it doesn't, set the variable to zero and mark this in the dict
-  if (!xbt_dict_get_or_null(platform_variables, key)) {
+  if (not xbt_dict_get_or_null(platform_variables, key)) {
     container_t container = PJ_container_get (resource);
     type_t type = PJ_type_get (variable, container->type);
     new SetVariableEvent (now, container, type, 0);
@@ -46,9 +46,9 @@ static void instr_event (double now, double delta, type_t variable, container_t
 void TRACE_surf_link_set_utilization(const char *resource, const char *category, double value, double now, double delta)
 {
   //only trace link utilization if link is known by tracing mechanism
-  if (!PJ_container_get_or_null(resource))
+  if (not PJ_container_get_or_null(resource))
     return;
-  if (!value)
+  if (not value)
     return;
 
   //trace uncategorized link utilization
@@ -61,7 +61,7 @@ void TRACE_surf_link_set_utilization(const char *resource, const char *category,
 
   //trace categorized utilization
   if (TRACE_categorized()){
-    if (!category)
+    if (not category)
       return;
     //variable of this category starts by 'b', because we have a link here
     char category_type[INSTR_DEFAULT_STR_SIZE];
@@ -78,7 +78,7 @@ void TRACE_surf_host_set_utilization(const char *resource, const char *category,
 {
   //only trace host utilization if host is known by tracing mechanism
   container_t container = PJ_container_get_or_null(resource);
-  if (!container || !value)
+  if (not container || not value)
     return;
 
   //trace uncategorized host utilization
@@ -90,7 +90,7 @@ void TRACE_surf_host_set_utilization(const char *resource, const char *category,
 
   //trace categorized utilization
   if (TRACE_categorized()){
-    if (!category)
+    if (not category)
       return;
     //variable of this category starts by 'p', because we have a host here
     char category_type[INSTR_DEFAULT_STR_SIZE];
index 86dbae5..4f7841f 100644 (file)
@@ -27,10 +27,10 @@ void Jedule::addMetaInfo(char *key, char *value) {
 }
 
 void Jedule::writeOutput(FILE *file) {
-  if (!this->event_set.empty()){
+  if (not this->event_set.empty()) {
     fprintf(file, "<jedule>\n");
 
-    if (!this->meta_info.empty()){
+    if (not this->meta_info.empty()) {
       fprintf(file, "  <jedule_meta>\n");
       for (auto elm: this->meta_info)
         fprintf(file, "        <prop key=\"%s\" value=\"%s\" />\n",elm.first,elm.second);
index 95a591b..afe12f3 100644 (file)
@@ -20,7 +20,7 @@ Event::Event(std::string name, double start_time, double end_time, std::string t
 
 Event::~Event()
 {
-  if (!this->resource_subsets->empty()){
+  if (not this->resource_subsets->empty()) {
     for (auto subset: *this->resource_subsets)
       delete subset;
     delete this->resource_subsets;
@@ -51,7 +51,7 @@ void Event::print(FILE *jed_file)
   fprintf(jed_file, "      <prop key=\"end\" value=\"%g\" />\n", this->end_time);
   fprintf(jed_file, "      <prop key=\"type\" value=\"%s\" />\n", this->type.c_str());
 
-  xbt_assert(!this->resource_subsets->  empty());
+  xbt_assert(not this->resource_subsets->empty());
   fprintf(jed_file, "      <res_util>\n");
   for (auto subset: *this->resource_subsets) {
     fprintf(jed_file, "        <select resources=\"");
@@ -61,14 +61,14 @@ void Event::print(FILE *jed_file)
   }
   fprintf(jed_file, "      </res_util>\n");
 
-  if (!this->characteristics_list.empty()){
+  if (not this->characteristics_list.empty()) {
     fprintf(jed_file, "      <characteristics>\n");
     for (auto ch: this->characteristics_list)
       fprintf(jed_file, "          <characteristic name=\"%s\" />\n", ch);
     fprintf(jed_file, "      </characteristics>\n");
   }
 
-  if (!this->info_map.empty()){
+  if (not this->info_map.empty()) {
     fprintf(jed_file, "      <info>\n");
     for (auto elm: this->info_map)
       fprintf(jed_file, "        <prop key=\"%s\" value=\"%s\" />\n",elm.first,elm.second);
index 1bc42af..c5e6b32 100644 (file)
@@ -26,7 +26,7 @@ Container::Container(std::string name): name(name)
 
 Container::~Container()
 {
-  if(!this->children.empty())
+  if (not this->children.empty())
     for (auto child: this->children)
       delete child;
 }
@@ -80,7 +80,7 @@ std::vector<int> Container::getHierarchy()
 
   if(this->parent != nullptr ) {
 
-    if(!this->parent->children.empty()) {
+    if (not this->parent->children.empty()) {
       // we are in the last level
       return this->parent->getHierarchy();
     } else {
@@ -128,7 +128,7 @@ std::string Container::getHierarchyAsString()
 void Container::printResources(FILE * jed_file)
 {
   unsigned int i=0;
-  xbt_assert(!this->resource_list.empty());
+  xbt_assert(not this->resource_list.empty());
 
   unsigned int res_nb = this->resource_list.size();
   std::string resid = this->getHierarchyAsString();
@@ -149,7 +149,7 @@ void Container::print(FILE* jed_file)
 {
   xbt_assert( this != nullptr );
   fprintf(jed_file, "    <res name=\"%s\">\n", this->name.c_str());
-  if( !this->children.empty()){
+  if (not this->children.empty()) {
     for (auto child: this->children) {
       child->print(jed_file);
     }
index e22d6a8..2424f5a 100644 (file)
@@ -47,7 +47,7 @@ void jedule_sd_dump(const char * filename)
 {
   if (my_jedule) {
     char *fname;
-    if (!filename) {
+    if (not filename) {
       fname = bprintf("%s.jed", xbt_binary_name);
     } else {
       fname = xbt_strdup(filename);
index 06060f4..86b2e24 100644 (file)
@@ -35,7 +35,7 @@ MailboxImpl* MailboxImpl::byNameOrCreate(const char* name)
   xbt_assert(name, "Mailboxes must have a name");
   /* two processes may have pushed the same mbox_create simcall at the same time */
   smx_mailbox_t mbox = static_cast<smx_mailbox_t>(xbt_dict_get_or_null(mailboxes, name));
-  if (!mbox) {
+  if (not mbox) {
     mbox = new MailboxImpl(name);
     XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name);
     xbt_dict_set(mailboxes, mbox->name_, mbox, nullptr);
index f8969b7..1949b21 100644 (file)
@@ -61,10 +61,8 @@ void simgrid::kernel::activity::Comm::cancel()
   if (state == SIMIX_WAITING) {
     mbox->remove(this);
     state = SIMIX_CANCELED;
-  }
-  else if (!MC_is_active() /* when running the MC there are no surf actions */
-           && !MC_record_replay_is_active()
-           && (state == SIMIX_READY || state == SIMIX_RUNNING)) {
+  } else if (not MC_is_active() /* when running the MC there are no surf actions */
+             && not MC_record_replay_is_active() && (state == SIMIX_READY || state == SIMIX_RUNNING)) {
 
     surf_comm->cancel();
   }
@@ -122,6 +120,6 @@ void simgrid::kernel::activity::Comm::post()
   cleanupSurf();
 
   /* if there are simcalls associated with the synchro, then answer them */
-  if (!simcalls.empty())
+  if (not simcalls.empty())
     SIMIX_comm_finish(this);
 }
index 5528f86..58af6ff 100644 (file)
@@ -73,6 +73,6 @@ void simgrid::kernel::activity::Exec::post()
   }
 
   /* If there are simcalls associated with the synchro, then answer them */
-  if (!simcalls.empty())
+  if (not simcalls.empty())
     SIMIX_execution_finish(this);
 }
index a2f281e..8143f7c 100644 (file)
@@ -26,7 +26,7 @@ void simgrid::kernel::activity::Sleep::resume()
 
 void simgrid::kernel::activity::Sleep::post()
 {
-  while (!simcalls.empty()) {
+  while (not simcalls.empty()) {
     smx_simcall_t simcall = simcalls.front();
     simcalls.pop_front();
 
index aa1ce97..a88920d 100644 (file)
@@ -62,15 +62,15 @@ BoostContextFactory::BoostContextFactory()
 {
   BoostContext::parallel_ = SIMIX_context_is_parallel();
   if (BoostContext::parallel_) {
-#if !HAVE_THREAD_CONTEXTS
-    xbt_die("No thread support for parallel context execution");
-#else
+#if HAVE_THREAD_CONTEXTS
     int nthreads = SIMIX_context_get_nthreads();
     BoostContext::parmap_ = xbt_parmap_new(nthreads, SIMIX_context_get_parallel_mode());
     BoostContext::workers_context_.clear();
     BoostContext::workers_context_.resize(nthreads, nullptr);
     BoostContext::maestro_context_ = nullptr;
     xbt_os_thread_key_create(&BoostContext::worker_id_key_);
+#else
+    xbt_die("No thread support for parallel context execution");
 #endif
   }
 }
@@ -166,7 +166,7 @@ BoostContext::BoostContext(std::function<void()> code,
 BoostContext::~BoostContext()
 {
 #if HAVE_BOOST_CONTEXTS == 1
-  if (!this->stack_)
+  if (not this->stack_)
     delete this->fc_;
 #endif
   if (this == maestro_context_)
index 9b6d207..3e28c30 100644 (file)
@@ -52,7 +52,7 @@ ThreadContext* ThreadContextFactory::create_context(
     std::function<void()> code,
     void_pfn_smxprocess_t cleanup, smx_actor_t process)
 {
-  return this->new_context<ThreadContext>(std::move(code), cleanup, process, !code);
+  return this->new_context<ThreadContext>(std::move(code), cleanup, process, not code);
 }
 
 void ThreadContextFactory::run_all()
index 41ebd69..73ab218 100644 (file)
@@ -23,11 +23,11 @@ ClusterZone::ClusterZone(NetZone* father, const char* name) : NetZoneImpl(father
 void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg_t route, double* lat)
 {
   XBT_VERB("cluster getLocalRoute from '%s'[%d] to '%s'[%d]", src->cname(), src->id(), dst->cname(), dst->id());
-  xbt_assert(!privateLinks_.empty(),
+  xbt_assert(not privateLinks_.empty(),
              "Cluster routing: no links attached to the source node - did you use host_link tag?");
 
   if ((src->id() == dst->id()) && hasLoopback_) {
-    xbt_assert(!src->isRouter(), "Routing from a cluster private router to itself is meaningless");
+    xbt_assert(not src->isRouter(), "Routing from a cluster private router to itself is meaningless");
 
     std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id() * linkCountPerNode_);
     route->link_list->push_back(info.first);
@@ -36,7 +36,7 @@ void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba
     return;
   }
 
-  if (!src->isRouter()) { // No private link for the private router
+  if (not src->isRouter()) { // No private link for the private router
     if (hasLimiter_) { // limiter for sender
       std::pair<surf::LinkImpl*, surf::LinkImpl*> info =
           privateLinks_.at(src->id() * linkCountPerNode_ + (hasLoopback_ ? 1 : 0));
@@ -58,7 +58,7 @@ void ClusterZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba
       *lat += backbone_->latency();
   }
 
-  if (!dst->isRouter()) { // No specific link for router
+  if (not dst->isRouter()) { // No specific link for router
 
     std::pair<surf::LinkImpl*, surf::LinkImpl*> info =
         privateLinks_.at(dst->id() * linkCountPerNode_ + hasLoopback_ + hasLimiter_);
@@ -89,7 +89,7 @@ void ClusterZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges
   }
 
   for (auto src : vertices_) {
-    if (!src->isRouter()) {
+    if (not src->isRouter()) {
       xbt_node_t previous = new_xbt_graph_node(graph, src->cname(), nodes);
 
       std::pair<surf::LinkImpl*, surf::LinkImpl*> info = privateLinks_.at(src->id());
index f987ae3..6c9efbd 100644 (file)
@@ -49,9 +49,9 @@ void DijkstraZone::seal()
   unsigned int cursor;
 
   /* Create the topology graph */
-  if (!routeGraph_)
+  if (not routeGraph_)
     routeGraph_ = xbt_graph_new_graph(1, nullptr);
-  if (!graphNodeMap_)
+  if (not graphNodeMap_)
     graphNodeMap_ = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
 
   /* Add the loopback if needed */
@@ -67,7 +67,7 @@ void DijkstraZone::seal()
         }
       }
 
-      if (!found) {
+      if (not found) {
         sg_platf_route_cbarg_t e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
         e_route->link_list             = new std::vector<surf::LinkImpl*>();
         e_route->link_list->push_back(surf_network_model->loopback_);
@@ -295,7 +295,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb
     xbt_dict_set_ext(routeCache_, (char*)(&src_id), sizeof(int), (xbt_dictelm_t)elm, nullptr);
   }
 
-  if (!routeCache_)
+  if (not routeCache_)
     xbt_free(pred_arr);
 }
 
@@ -324,9 +324,9 @@ void DijkstraZone::addRoute(sg_platf_route_cbarg_t route)
   addRouteCheckParams(route);
 
   /* Create the topology graph */
-  if (!routeGraph_)
+  if (not routeGraph_)
     routeGraph_ = xbt_graph_new_graph(1, nullptr);
-  if (!graphNodeMap_)
+  if (not graphNodeMap_)
     graphNodeMap_ = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
 
   /* we don't check whether the route already exist, because the algorithm may find another path through some other
@@ -338,7 +338,7 @@ void DijkstraZone::addRoute(sg_platf_route_cbarg_t route)
 
   // Symmetrical YES
   if (route->symmetrical == true) {
-    if (!route->gw_dst && !route->gw_src)
+    if (not route->gw_dst && not route->gw_src)
       XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dstName, srcName);
     else
       XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, route->gw_dst->name().c_str(), srcName,
index 702655b..70a928d 100644 (file)
@@ -89,7 +89,7 @@ void FatTreeZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cba
   FatTreeNode* currentNode = source;
 
   // up part
-  while (!isInSubTree(currentNode, destination)) {
+  while (not isInSubTree(currentNode, destination)) {
     int d = destination->position; // as in d-mod-k
 
     for (unsigned int i = 0; i < currentNode->level; i++)
index 000db3f..894aa18 100644 (file)
@@ -66,7 +66,7 @@ void FloydZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cbarg
   }
 
   sg_netpoint_t prev_dst_gw = nullptr;
-  while (!route_stack.empty()) {
+  while (not route_stack.empty()) {
     sg_platf_route_cbarg_t e_route = route_stack.back();
     route_stack.pop_back();
     if (hierarchy_ == RoutingMode::recursive && prev_dst_gw != nullptr &&
@@ -91,7 +91,7 @@ void FloydZone::addRoute(sg_platf_route_cbarg_t route)
 
   addRouteCheckParams(route);
 
-  if (!linkTable_) {
+  if (not linkTable_) {
     /* Create Cost, Predecessor and Link tables */
     costTable_        = xbt_new0(double, table_size* table_size);                  /* link cost from host to host */
     predecessorTable_ = xbt_new0(int, table_size* table_size);                     /* predecessor host numbers */
@@ -140,7 +140,7 @@ void FloydZone::addRoute(sg_platf_route_cbarg_t route)
       route->gw_dst   = gw_tmp;
     }
 
-    if (!route->gw_src && !route->gw_dst)
+    if (not route->gw_src && not route->gw_dst)
       XBT_DEBUG("Load Route from \"%s\" to \"%s\"", route->dst->name().c_str(), route->src->name().c_str());
     else
       XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", route->dst->name().c_str(), route->gw_src->name().c_str(),
@@ -158,7 +158,7 @@ void FloydZone::seal()
   /* set the size of table routing */
   size_t table_size = vertices_.size();
 
-  if (!linkTable_) {
+  if (not linkTable_) {
     /* Create Cost, Predecessor and Link tables */
     costTable_        = xbt_new0(double, table_size* table_size);                  /* link cost from host to host */
     predecessorTable_ = xbt_new0(int, table_size* table_size);                     /* predecessor host numbers */
@@ -177,7 +177,7 @@ void FloydZone::seal()
   if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
     for (unsigned int i = 0; i < table_size; i++) {
       sg_platf_route_cbarg_t e_route = TO_FLOYD_LINK(i, i);
-      if (!e_route) {
+      if (not e_route) {
         e_route            = xbt_new0(s_sg_platf_route_cbarg_t, 1);
         e_route->gw_src    = nullptr;
         e_route->gw_dst    = nullptr;
index 8187c3d..89cdec6 100644 (file)
@@ -23,14 +23,14 @@ void FullZone::seal()
   int table_size = static_cast<int>(vertices_.size());
 
   /* Create table if needed */
-  if (!routingTable_)
+  if (not routingTable_)
     routingTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);
 
   /* Add the loopback if needed */
   if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) {
     for (int i = 0; i < table_size; i++) {
       sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(i, i);
-      if (!e_route) {
+      if (not e_route) {
         e_route            = xbt_new0(s_sg_platf_route_cbarg_t, 1);
         e_route->gw_src    = nullptr;
         e_route->gw_dst    = nullptr;
@@ -84,7 +84,7 @@ void FullZone::addRoute(sg_platf_route_cbarg_t route)
 
   size_t table_size = vertices_.size();
 
-  if (!routingTable_)
+  if (not routingTable_)
     routingTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size);
 
   /* Check that the route does not already exist */
index 4a2dd54..dc21bff 100644 (file)
@@ -69,15 +69,15 @@ void NetZoneImpl::addBypassRoute(sg_platf_route_cbarg_t e_route)
   if (e_route->gw_dst) {
     XBT_DEBUG("Load bypassNetzoneRoute from %s@%s to %s@%s", e_route->src->cname(), e_route->gw_src->cname(),
               e_route->dst->cname(), e_route->gw_dst->cname());
-    xbt_assert(!e_route->link_list->empty(), "Bypass route between %s@%s and %s@%s cannot be empty.",
+    xbt_assert(not e_route->link_list->empty(), "Bypass route between %s@%s and %s@%s cannot be empty.",
                e_route->src->cname(), e_route->gw_src->cname(), e_route->dst->cname(), e_route->gw_dst->cname());
     xbt_assert(bypassRoutes_.find({e_route->src, e_route->dst}) == bypassRoutes_.end(),
                "The bypass route between %s@%s and %s@%s already exists.", e_route->src->cname(),
                e_route->gw_src->cname(), e_route->dst->cname(), e_route->gw_dst->cname());
   } else {
     XBT_DEBUG("Load bypassRoute from %s to %s", e_route->src->cname(), e_route->dst->cname());
-    xbt_assert(!e_route->link_list->empty(), "Bypass route between %s and %s cannot be empty.", e_route->src->cname(),
-               e_route->dst->cname());
+    xbt_assert(not e_route->link_list->empty(), "Bypass route between %s and %s cannot be empty.",
+               e_route->src->cname(), e_route->dst->cname());
     xbt_assert(bypassRoutes_.find({e_route->src, e_route->dst}) == bypassRoutes_.end(),
                "The bypass route between %s and %s already exists.", e_route->src->cname(), e_route->dst->cname());
   }
index d12ad8c..c8d4bae 100644 (file)
@@ -178,15 +178,17 @@ void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route)
   const char* srcName = src->cname();
   const char* dstName = dst->cname();
 
-  if (!route->gw_dst && !route->gw_src) {
+  if (not route->gw_dst && not route->gw_src) {
     XBT_DEBUG("Load Route from \"%s\" to \"%s\"", srcName, dstName);
     xbt_assert(src, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, srcName);
     xbt_assert(dst, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, dstName);
-    xbt_assert(!route->link_list->empty(), "Empty route (between %s and %s) forbidden.", srcName, dstName);
-    xbt_assert(!src->isNetZone(),
-               "When defining a route, src cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?", srcName);
-    xbt_assert(!dst->isNetZone(),
-               "When defining a route, dst cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?", dstName);
+    xbt_assert(not route->link_list->empty(), "Empty route (between %s and %s) forbidden.", srcName, dstName);
+    xbt_assert(not src->isNetZone(),
+               "When defining a route, src cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?",
+               srcName);
+    xbt_assert(not dst->isNetZone(),
+               "When defining a route, dst cannot be a netzone such as '%s'. Did you meant to have an NetzoneRoute?",
+               dstName);
   } else {
     XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", srcName, route->gw_src->cname(), dstName, route->gw_dst->cname());
     xbt_assert(src->isNetZone(), "When defining a NetzoneRoute, src must be a netzone but '%s' is not", srcName);
@@ -203,7 +205,7 @@ void RoutedZone::addRouteCheckParams(sg_platf_route_cbarg_t route)
                dstName, route->gw_dst->cname(), srcName);
     xbt_assert(dst, "Cannot add a route from %s@%s to %s@%s: %s does not exist.", srcName, route->gw_src->cname(),
                dstName, route->gw_dst->cname(), dstName);
-    xbt_assert(!route->link_list->empty(), "Empty route (between %s@%s and %s@%s) forbidden.", srcName,
+    xbt_assert(not route->link_list->empty(), "Empty route (between %s@%s and %s@%s) forbidden.", srcName,
                route->gw_src->cname(), dstName, route->gw_dst->cname());
   }
 
index de87cef..39dab91 100644 (file)
@@ -86,7 +86,7 @@ void TorusZone::parse_specific_arguments(sg_platf_cluster_cbarg_t cluster)
   std::vector<std::string> dimensions;
   boost::split(dimensions, cluster->topo_parameters, boost::is_any_of(","));
 
-  if (!dimensions.empty()) {
+  if (not dimensions.empty()) {
     /* We are in a torus cluster
      * Parse attribute dimensions="dim1,dim2,dim3,...,dimN" and safe it in a vector.
      * Additionally, we need to know how many ranks we have in total
index 79a5d19..e2ec817 100644 (file)
@@ -22,7 +22,7 @@ simgrid::xbt::Extension<NetPoint, Coords> Coords::EXTENSION_ID;
 
 Coords::Coords(NetPoint* netpoint, const char* coordStr)
 {
-  if (!Coords::EXTENSION_ID.valid())
+  if (not Coords::EXTENSION_ID.valid())
     Coords::EXTENSION_ID = NetPoint::extension_create<Coords>();
 
   std::vector<std::string> string_values;
index 86043a0..fe55a37 100644 (file)
@@ -73,7 +73,7 @@ void execute(
         int register_id = simgrid::dwarf::dwarf_register_to_libunwind(
           op->atom - DW_OP_breg0);
         unw_word_t res;
-        if (!context.cursor)
+        if (not context.cursor)
           throw evaluation_error("Missing stack context");
         unw_get_reg(context.cursor, register_id, &res);
         stack.push(res + op->number);
@@ -95,7 +95,7 @@ void execute(
          * Warning: the CFA returned by libunwind (UNW_X86_64_RSP, etc.)
          * is the SP of the *current* frame. */
 
-        if (!context.cursor)
+        if (not context.cursor)
           throw evaluation_error("Missint cursor");
 
         // Get frame:
@@ -156,7 +156,7 @@ void execute(
       // Address from the base address of this ELF object.
       // Push the address on the stack (base_address + argument).
     case DW_OP_addr: {
-      if (!context.object_info)
+      if (not context.object_info)
         throw evaluation_error("No base address");
       Dwarf_Off addr = (Dwarf_Off) (std::uintptr_t)
         context.object_info->base_address() + op->number;
@@ -269,7 +269,7 @@ void execute(
 
     case DW_OP_deref:
       // Computed address:
-      if (!context.address_space)
+      if (not context.address_space)
         throw evaluation_error("Missing address space");
       context.address_space->read_bytes(
         &stack.top(), sizeof(uintptr_t), remote(stack.top()),
index eca8641..039bd2d 100644 (file)
@@ -35,9 +35,7 @@ Location resolve(
   context.object_info = object_info;
   context.process_index = process_index;
 
-  if (!expression.empty()
-      && expression[0].atom >= DW_OP_reg0
-      && expression[0].atom <= DW_OP_reg31) {
+  if (not expression.empty() && expression[0].atom >= DW_OP_reg0 && expression[0].atom <= DW_OP_reg31) {
     int dwarf_register = expression[0].atom - DW_OP_reg0;
     xbt_assert(c, "Missing frame context for register operation DW_OP_reg%i", dwarf_register);
     return Location(dwarf_register_to_libunwind(dwarf_register));
@@ -71,7 +69,7 @@ Location resolve(
     xbt_die("Could not resolve IP");
   simgrid::dwarf::DwarfExpression const* expression =
     find_expression(locations, ip);
-  if (!expression)
+  if (not expression)
     xbt_die("Could not resolve location");
   return simgrid::dwarf::resolve(
           *expression, object_info, c,
index f160216..bfbd45b 100644 (file)
@@ -92,7 +92,7 @@ void ModelChecker::start()
 
   // The model-checked process SIGSTOP itself to signal it's ready:
   pid_t res = waitpid(pid, &status, WAITPID_CHECKED_FLAGS);
-  if (res < 0 || !WIFSTOPPED(status) || WSTOPSIG(status) != SIGSTOP)
+  if (res < 0 || not WIFSTOPPED(status) || WSTOPSIG(status) != SIGSTOP)
     xbt_die("Could not wait model-checked process");
 
   process_->init();
@@ -306,7 +306,7 @@ void ModelChecker::handle_events(int fd, short events)
     ssize_t size = process_->getChannel().receive(buffer, sizeof(buffer), false);
     if (size == -1 && errno != EAGAIN)
       throw simgrid::xbt::errno_error();
-    if (!handle_message(buffer, size)) {
+    if (not handle_message(buffer, size)) {
       event_base_loopbreak(base_);
     }
   }
index 3a7b828..64fc01e 100644 (file)
@@ -150,10 +150,8 @@ static void remove_local_variable(simgrid::mc::Frame& scope,
   typedef std::vector<Variable>::size_type size_type;
 
   // If the current subprogram matches the given name:
-  if ((subprogram_name == nullptr ||
-      (!subprogram.name.empty()
-        && subprogram.name == subprogram_name))
-      && !scope.variables.empty()) {
+  if ((subprogram_name == nullptr || (not subprogram.name.empty() && subprogram.name == subprogram_name)) &&
+      not scope.variables.empty()) {
 
     // Try to find the variable and remove it:
     size_type start = 0;
index 5b1f3c9..c7f3643 100644 (file)
@@ -103,7 +103,7 @@ static const char* const filtered_libraries[] = {
 
 static bool is_simgrid_lib(const char* libname)
 {
-  return !strcmp(libname, "libsimgrid");
+  return not strcmp(libname, "libsimgrid");
 }
 
 static bool is_filtered_lib(const char* libname)
@@ -134,7 +134,7 @@ static char* get_lib_name(const char* pathname, struct s_mc_memory_map_re* res)
   map_basename = nullptr;
 
   // Strip the version suffix:
-  if(libname && !regexec(&res->version_re, libname, 1, &match, 0)) {
+  if (libname && not regexec(&res->version_re, libname, 1, &match, 0)) {
     char* temp = libname;
     libname = strndup(temp, match.rm_so);
     free(temp);
@@ -226,9 +226,9 @@ void Process::init()
 
   // Read std_heap (is a struct mdesc*):
   simgrid::mc::Variable* std_heap_var = this->find_variable("__mmalloc_default_mdp");
-  if (!std_heap_var)
+  if (not std_heap_var)
     xbt_die("No heap information in the target process");
-  if(!std_heap_var->address)
+  if (not std_heap_var->address)
     xbt_die("No constant address for this variable");
   this->read_bytes(&this->heap_address, sizeof(struct mdesc*),
     remote(std_heap_var->address),
@@ -265,7 +265,7 @@ Process::~Process()
 void Process::refresh_heap()
 {
   // Read/dereference/refresh the std_heap pointer:
-  if (!this->heap)
+  if (not this->heap)
     this->heap = std::unique_ptr<s_xbt_mheap_t>(new s_xbt_mheap_t());
   this->read_bytes(this->heap.get(), sizeof(struct mdesc),
     remote(this->heap_address), simgrid::mc::ProcessIndexDisabled);
@@ -323,7 +323,7 @@ void Process::init_memory_map_info()
 
     // [stack], [vvar], [vsyscall], [vdso] ...
     if (pathname[0] == '[') {
-      if ((reg.prot & PROT_WRITE) && !memcmp(pathname, "[stack]", 7)) {
+      if ((reg.prot & PROT_WRITE) && not memcmp(pathname, "[stack]", 7)) {
         this->maestro_stack_start_ = remote(reg.start_addr);
         this->maestro_stack_end_ = remote(reg.end_addr);
       }
@@ -338,11 +338,11 @@ void Process::init_memory_map_info()
     if (!(reg.prot & PROT_READ) && (reg.prot & PROT_EXEC))
       continue;
 
-    const bool is_executable = !i;
+    const bool is_executable = not i;
     char* libname = nullptr;
-    if (!is_executable) {
+    if (not is_executable) {
       libname = get_lib_name(pathname, &res);
-      if(!libname)
+      if (not libname)
         continue;
       if (is_filtered_lib(libname)) {
         free(libname);
@@ -442,7 +442,7 @@ void Process::read_variable(const char* name, void* target, size_t size) const
 
 std::string Process::read_string(RemotePtr<char> address) const
 {
-  if (!address)
+  if (not address)
     return {};
 
   // TODO, use std::vector with .data() in C++17 to avoid useless copies
index 3bdf2a4..4d13234 100644 (file)
@@ -128,7 +128,7 @@ void CommunicationDeterminismChecker::deterministic_comm_pattern(int process, si
   simgrid::mc::PatternCommunicationList* list =
     xbt_dynar_get_as(initial_communications_pattern, process, simgrid::mc::PatternCommunicationList*);
 
-  if(!backtracking){
+  if (not backtracking) {
     e_mc_comm_pattern_difference_t diff = compare_comm_pattern(list->list[list->index_comm].get(), comm);
 
     if (diff != NONE_DIFF) {
@@ -143,7 +143,7 @@ void CommunicationDeterminismChecker::deterministic_comm_pattern(int process, si
           xbt_free(this->recv_diff);
         this->recv_diff = print_determinism_result(diff, process, comm, list->index_comm + 1);
       }
-      if(_sg_mc_send_determinism && !this->send_deterministic){
+      if (_sg_mc_send_determinism && not this->send_deterministic) {
         XBT_INFO("*********************************************************");
         XBT_INFO("***** Non-send-deterministic communications pattern *****");
         XBT_INFO("*********************************************************");
@@ -152,8 +152,7 @@ void CommunicationDeterminismChecker::deterministic_comm_pattern(int process, si
         this->send_diff = nullptr;
         simgrid::mc::session->logState();
         mc_model_checker->exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
-      }else if(_sg_mc_comms_determinism
-          && (!this->send_deterministic && !this->recv_deterministic)) {
+      } else if (_sg_mc_comms_determinism && (not this->send_deterministic && not this->recv_deterministic)) {
         XBT_INFO("****************************************************");
         XBT_INFO("***** Non-deterministic communications pattern *****");
         XBT_INFO("****************************************************");
@@ -209,7 +208,7 @@ void CommunicationDeterminismChecker::get_comm_pattern(xbt_dynar_t list, smx_sim
       mc_model_checker->process().read_bytes(pattern->data.data(), pattern->data.size(), remote(synchro->src_buff));
     }
     if(mpi_request.detached()){
-      if (!this->initial_communications_pattern_done) {
+      if (not this->initial_communications_pattern_done) {
         /* Store comm pattern */
         simgrid::mc::PatternCommunicationList* list =
             xbt_dynar_get_as(initial_communications_pattern, pattern->src_proc, simgrid::mc::PatternCommunicationList*);
@@ -271,13 +270,13 @@ void CommunicationDeterminismChecker::complete_comm_pattern(
       break;
     }
 
-  if(!completed)
+  if (not completed)
     xbt_die("Corresponding communication not found!");
 
   simgrid::mc::PatternCommunicationList* pattern =
       xbt_dynar_get_as(initial_communications_pattern, issuer, simgrid::mc::PatternCommunicationList*);
 
-  if (!this->initial_communications_pattern_done)
+  if (not this->initial_communications_pattern_done)
     /* Store comm pattern */
     pattern->list.push_back(std::move(comm_pattern));
   else {
@@ -316,12 +315,12 @@ std::vector<std::string> CommunicationDeterminismChecker::getTextualTrace() // o
 void CommunicationDeterminismChecker::logState() // override
 {
   Checker::logState();
-  if (_sg_mc_comms_determinism && !this->recv_deterministic && this->send_deterministic) {
+  if (_sg_mc_comms_determinism && not this->recv_deterministic && this->send_deterministic) {
     XBT_INFO("******************************************************");
     XBT_INFO("**** Only-send-deterministic communication pattern ****");
     XBT_INFO("******************************************************");
     XBT_INFO("%s", this->recv_diff);
-  } else if (_sg_mc_comms_determinism && !this->send_deterministic && this->recv_deterministic) {
+  } else if (_sg_mc_comms_determinism && not this->send_deterministic && this->recv_deterministic) {
     XBT_INFO("******************************************************");
     XBT_INFO("**** Only-recv-deterministic communication pattern ****");
     XBT_INFO("******************************************************");
@@ -330,9 +329,9 @@ void CommunicationDeterminismChecker::logState() // override
   XBT_INFO("Expanded states = %lu", expandedStatesCount_);
   XBT_INFO("Visited states = %lu", mc_model_checker->visited_states);
   XBT_INFO("Executed transitions = %lu", mc_model_checker->executed_transitions);
-  XBT_INFO("Send-deterministic : %s", !this->send_deterministic ? "No" : "Yes");
+  XBT_INFO("Send-deterministic : %s", not this->send_deterministic ? "No" : "Yes");
   if (_sg_mc_comms_determinism)
-    XBT_INFO("Recv-deterministic : %s", !this->recv_deterministic ? "No" : "Yes");
+    XBT_INFO("Recv-deterministic : %s", not this->recv_deterministic ? "No" : "Yes");
 }
 
 void CommunicationDeterminismChecker::prepare()
@@ -370,7 +369,7 @@ static inline bool all_communications_are_finished()
 {
   for (size_t current_actor = 1; current_actor < MC_smx_get_maxpid(); current_actor++) {
     xbt_dynar_t pattern = xbt_dynar_get_as(incomplete_communications_pattern, current_actor, xbt_dynar_t);
-    if (!xbt_dynar_is_empty(pattern)) {
+    if (not xbt_dynar_is_empty(pattern)) {
       XBT_DEBUG("Some communications are not finished, cannot stop the exploration ! State not visited.");
       return false;
     }
@@ -432,7 +431,7 @@ void CommunicationDeterminismChecker::main(void)
   std::unique_ptr<simgrid::mc::VisitedState> visited_state = nullptr;
   smx_simcall_t req = nullptr;
 
-  while (!stack_.empty()) {
+  while (not stack_.empty()) {
     /* Get current state */
     simgrid::mc::State* state = stack_.back().get();
 
@@ -465,7 +464,7 @@ void CommunicationDeterminismChecker::main(void)
       mc_model_checker->handle_simcall(state->transition);
       /* After this call req is no longer useful */
 
-      if (!this->initial_communications_pattern_done)
+      if (not this->initial_communications_pattern_done)
         MC_handle_comm_pattern(call, req, req_num, initial_communications_pattern, 0);
       else
         MC_handle_comm_pattern(call, req, req_num, nullptr, 0);
@@ -511,7 +510,7 @@ void CommunicationDeterminismChecker::main(void)
       else
         XBT_DEBUG("There are no more processes to interleave. (depth %zi)", stack_.size());
 
-      if (!this->initial_communications_pattern_done)
+      if (not this->initial_communications_pattern_done)
         this->initial_communications_pattern_done = 1;
 
       /* Trash the current state, no longer needed */
@@ -526,7 +525,7 @@ void CommunicationDeterminismChecker::main(void)
         throw new simgrid::mc::DeadlockError();
       }
 
-      while (!stack_.empty()) {
+      while (not stack_.empty()) {
         std::unique_ptr<simgrid::mc::State> state = std::move(stack_.back());
         stack_.pop_back();
         if (state->interleaveSize() && stack_.size() < (std::size_t)_sg_mc_max_depth) {
index 3a24b36..a0016e1 100644 (file)
@@ -72,7 +72,7 @@ static bool evaluate_label(xbt_automaton_exp_label_t l, std::vector<int> const&
     return evaluate_label(l->u.or_and.left_exp, values)
       && evaluate_label(l->u.or_and.right_exp, values);
   case xbt_automaton_exp_label::AUT_NOT:
-    return !evaluate_label(l->u.exp_not, values);
+    return not evaluate_label(l->u.exp_not, values);
   case xbt_automaton_exp_label::AUT_PREDICAT:{
       unsigned int cursor = 0;
       xbt_automaton_propositional_symbol_t p = nullptr;
@@ -331,7 +331,7 @@ void LivenessChecker::backtrack()
 {
   /* Traverse the stack backwards until a pair with a non empty interleave
      set is found, deleting all the pairs that have it empty in the way. */
-  while (!explorationStack_.empty()) {
+  while (not explorationStack_.empty()) {
     std::shared_ptr<simgrid::mc::Pair> current_pair = explorationStack_.back();
     explorationStack_.pop_back();
     if (current_pair->requests > 0) {
@@ -371,7 +371,7 @@ void LivenessChecker::run()
       explorationStack_.push_back(this->newPair(nullptr, automaton_state, propos));
 
   /* Actually run the double DFS search for counter-examples */
-  while (!explorationStack_.empty()){
+  while (not explorationStack_.empty()) {
     std::shared_ptr<Pair> current_pair = explorationStack_.back();
 
     /* Update current state in buchi automaton */
@@ -389,17 +389,16 @@ void LivenessChecker::run()
     }
 
     std::shared_ptr<VisitedPair> reached_pair;
-    if (current_pair->automaton_state->type == 1 && !current_pair->exploration_started
-        && (reached_pair = this->insertAcceptancePair(current_pair.get())) == nullptr) {
+    if (current_pair->automaton_state->type == 1 && not current_pair->exploration_started &&
+        (reached_pair = this->insertAcceptancePair(current_pair.get())) == nullptr) {
       this->showAcceptanceCycle(current_pair->depth);
       throw simgrid::mc::LivenessError();
     }
 
     /* Pair already visited ? stop the exploration on the current path */
     int visited_num = -1;
-    if ((!current_pair->exploration_started)
-      && (visited_num = this->insertVisitedPair(
-        reached_pair, current_pair.get())) != -1) {
+    if ((not current_pair->exploration_started) &&
+        (visited_num = this->insertVisitedPair(reached_pair, current_pair.get())) != -1) {
       if (dot_output != nullptr){
         fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n",
           this->previousPair_, visited_num,
@@ -435,7 +434,7 @@ void LivenessChecker::run()
 
     /* Update stats */
     mc_model_checker->executed_transitions++;
-    if (!current_pair->exploration_started)
+    if (not current_pair->exploration_started)
       visitedPairsCount_++;
 
     /* Answer the request */
index 708f69b..44612d5 100644 (file)
@@ -95,7 +95,7 @@ void SafetyChecker::run()
    * We do so iteratively instead of recursively, dealing with the call stack manually.
    * This allows to explore the call stack at wish. */
 
-  while (!stack_.empty()) {
+  while (not stack_.empty()) {
 
     /* Get current state */
     simgrid::mc::State* state = stack_.back().get();
@@ -205,7 +205,7 @@ void SafetyChecker::backtrack()
      executed before it. If it does then add it to the interleave set of the
      state that executed that previous request. */
 
-  while (!stack_.empty()) {
+  while (not stack_.empty()) {
     std::unique_ptr<simgrid::mc::State> state = std::move(stack_.back());
     stack_.pop_back();
     if (reductionMode_ == simgrid::mc::ReductionMode::dpor) {
@@ -233,7 +233,7 @@ void SafetyChecker::backtrack()
               state->num);
           }
 
-          if (!prev_state->actorStates[issuer->pid].isDone())
+          if (not prev_state->actorStates[issuer->pid].isDone())
             prev_state->interleave(issuer);
           else
             XBT_DEBUG("Process %p is in done set", req->issuer);
index 0905aee..334e3b8 100644 (file)
@@ -405,7 +405,7 @@ int mmalloc_compare_heap(
         }
       }
 
-      while (i2 < state.heaplimit && !equal) {
+      while (i2 < state.heaplimit && not equal) {
 
         addr_block2 = (ADDR2UINT(i2) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
 
@@ -442,7 +442,7 @@ int mmalloc_compare_heap(
         i2++;
       }
 
-      if (!equal) {
+      if (not equal) {
         XBT_DEBUG("Block %zu not found (size_used = %zu, addr = %p)", i1, heapinfo1->busy_block.busy_size, addr_block1);
         i1 = state.heaplimit + 1;
         nb_diff1++;
@@ -465,8 +465,7 @@ int mmalloc_compare_heap(
         equal = 0;
 
         /* Try first to associate to same fragment in the other heap */
-        if (heapinfo2->type == heapinfo1->type
-            && !state.equals_to2_(i1, j1).valid) {
+        if (heapinfo2->type == heapinfo1->type && not state.equals_to2_(i1, j1).valid) {
           addr_block2 = (ADDR2UINT(i1) - 1) * BLOCKSIZE +
                          (char *) state.std_heap_copy.heapbase;
           addr_frag2 =
@@ -478,7 +477,7 @@ int mmalloc_compare_heap(
             equal = 1;
         }
 
-        while (i2 < state.heaplimit && !equal) {
+        while (i2 < state.heaplimit && not equal) {
 
           const malloc_info* heapinfo2b = (const malloc_info*) MC_region_read(
             heap_region2, &heapinfo_temp2b, &heapinfos2[i2],
@@ -523,7 +522,7 @@ int mmalloc_compare_heap(
           i2++;
         }
 
-        if (!equal) {
+        if (not equal) {
           XBT_DEBUG("Block %zu, fragment %zu not found (size_used = %zd, address = %p)\n", i1, j1,
                     heapinfo1->busy_frag.frag_size[j1], addr_frag1);
           i2 = state.heaplimit + 1;
@@ -546,7 +545,7 @@ int mmalloc_compare_heap(
       heap_region1, &heapinfo_temp1, &heapinfos1[i], sizeof(malloc_info));
 
     if (heapinfo1->type == MMALLOC_TYPE_UNFRAGMENTED && i1 == state.heaplimit && heapinfo1->busy_block.busy_size > 0 &&
-        !state.equals_to1_(i, 0).valid) {
+        not state.equals_to1_(i, 0).valid) {
       XBT_DEBUG("Block %zu not found (size used = %zu)", i, heapinfo1->busy_block.busy_size);
       nb_diff1++;
     }
@@ -554,7 +553,7 @@ int mmalloc_compare_heap(
     if (heapinfo1->type <= 0)
       continue;
     for (j = 0; j < (size_t) (BLOCKSIZE >> heapinfo1->type); j++)
-      if (i1 == state.heaplimit && heapinfo1->busy_frag.frag_size[j] > 0 && !state.equals_to1_(i, j).valid) {
+      if (i1 == state.heaplimit && heapinfo1->busy_frag.frag_size[j] > 0 && not state.equals_to1_(i, j).valid) {
         XBT_DEBUG("Block %zu, Fragment %zu not found (size used = %zd)", i, j, heapinfo1->busy_frag.frag_size[j]);
         nb_diff1++;
       }
@@ -566,10 +565,8 @@ int mmalloc_compare_heap(
   for (i=1; i < state.heaplimit; i++) {
     const malloc_info* heapinfo2 = (const malloc_info*) MC_region_read(
       heap_region2, &heapinfo_temp2, &heapinfos2[i], sizeof(malloc_info));
-    if (heapinfo2->type == MMALLOC_TYPE_UNFRAGMENTED
-        && i1 == state.heaplimit
-        && heapinfo2->busy_block.busy_size > 0
-        && !state.equals_to2_(i, 0).valid) {
+    if (heapinfo2->type == MMALLOC_TYPE_UNFRAGMENTED && i1 == state.heaplimit && heapinfo2->busy_block.busy_size > 0 &&
+        not state.equals_to2_(i, 0).valid) {
       XBT_DEBUG("Block %zu not found (size used = %zu)", i,
                 heapinfo2->busy_block.busy_size);
       nb_diff2++;
@@ -579,9 +576,7 @@ int mmalloc_compare_heap(
       continue;
 
     for (j = 0; j < (size_t) (BLOCKSIZE >> heapinfo2->type); j++)
-      if (i1 == state.heaplimit
-          && heapinfo2->busy_frag.frag_size[j] > 0
-          && !state.equals_to2_(i, j).valid) {
+      if (i1 == state.heaplimit && heapinfo2->busy_frag.frag_size[j] > 0 && not state.equals_to2_(i, j).valid) {
         XBT_DEBUG("Block %zu, Fragment %zu not found (size used = %zd)",
           i, j, heapinfo2->busy_frag.frag_size[j]);
         nb_diff2++;
@@ -737,7 +732,7 @@ top:
     return 1;
 
   case DW_TAG_base_type:
-    if (!type->name.empty() && type->name == "char") {        /* String, hence random (arbitrary ?) size */
+    if (not type->name.empty() && type->name == "char") { /* String, hence random (arbitrary ?) size */
       if (real_area1 == real_area2)
         return -1;
       else
@@ -1042,7 +1037,7 @@ int compare_heap_area(simgrid::mc::StateComparator& state, int process_index,
 
     // Find type_size:
     if (type->type == DW_TAG_pointer_type ||
-        (type->type == DW_TAG_base_type && !type->name.empty() && type->name == "char"))
+        (type->type == DW_TAG_base_type && not type->name.empty() && type->name == "char"))
       type_size = -1;
     else
       type_size = type->byte_size;
@@ -1094,7 +1089,7 @@ int compare_heap_area(simgrid::mc::StateComparator& state, int process_index,
     if (heapinfo1->busy_block.busy_size != heapinfo2->busy_block.busy_size)
       return 1;
 
-    if (!previous->insert(simgrid::mc::makeHeapLocationPair(block1, -1, block2, -1)).second) {
+    if (not previous->insert(simgrid::mc::makeHeapLocationPair(block1, -1, block2, -1)).second) {
       if (match_pairs)
         state.match_equals(previous);
       return 0;
@@ -1233,7 +1228,7 @@ int compare_heap_area(simgrid::mc::StateComparator& state, int process_index,
     }
 
     if (offset1 == 0 && offset2 == 0 &&
-        !previous->insert(simgrid::mc::makeHeapLocationPair(block1, frag1, block2, frag2)).second) {
+        not previous->insert(simgrid::mc::makeHeapLocationPair(block1, frag1, block2, frag2)).second) {
       if (match_pairs)
         state.match_equals(previous);
       return 0;
@@ -1357,8 +1352,7 @@ static int compare_areas_with_type(simgrid::mc::StateComparator& state,
       return 0;
     if (addr_pointed1 == nullptr || addr_pointed2 == nullptr)
       return 1;
-    if (!state.compared_pointers.insert(
-        std::make_pair(addr_pointed1, addr_pointed2)).second)
+    if (not state.compared_pointers.insert(std::make_pair(addr_pointed1, addr_pointed2)).second)
       return 0;
 
     pointer_level++;
@@ -1382,9 +1376,9 @@ static int compare_areas_with_type(simgrid::mc::StateComparator& state,
 
       // The pointers are both in the current object R/W segment:
       else if (region1->contain(simgrid::mc::remote(addr_pointed1))) {
-        if (!region2->contain(simgrid::mc::remote(addr_pointed2)))
+        if (not region2->contain(simgrid::mc::remote(addr_pointed2)))
           return 1;
-        if (!type->type_id)
+        if (not type->type_id)
           return (addr_pointed1 != addr_pointed2);
         else
           return compare_areas_with_type(state, process_index,
@@ -1728,8 +1722,7 @@ int snapshot_compare(int num1, simgrid::mc::Snapshot* s1, int num2, simgrid::mc:
     // * There MUST not be any false negative.
 
     XBT_VERB("(%d - %d) State equality hash test is %s %s", num1, num2,
-             (hash_result != 0) == (errors != 0) ? "true" : "false",
-             !hash_result ? "positive" : "negative");
+             (hash_result != 0) == (errors != 0) ? "true" : "false", not hash_result ? "positive" : "negative");
   }
 #endif
 
index 681efc3..396db1c 100644 (file)
@@ -40,11 +40,11 @@ void wait_for_requests(void)
   smx_simcall_t req;
   unsigned int iter;
 
-  while (!xbt_dynar_is_empty(simix_global->process_to_run)) {
+  while (not xbt_dynar_is_empty(simix_global->process_to_run)) {
     SIMIX_process_runall();
     xbt_dynar_foreach(simix_global->process_that_ran, iter, process) {
       req = &process->simcall;
-      if (req->call != SIMCALL_NONE && !simgrid::mc::request_is_visible(req))
+      if (req->call != SIMCALL_NONE && not simgrid::mc::request_is_visible(req))
         SIMIX_simcall_handle(req, 0);
     }
   }
@@ -177,7 +177,7 @@ bool request_is_enabled(smx_simcall_t req)
 
     case SIMCALL_SEM_ACQUIRE: {
       static int warned = 0;
-      if (!warned)
+      if (not warned)
         XBT_INFO("Using semaphore in model-checked code is still experimental. Use at your own risk");
       warned = 1;
       return true;
@@ -185,7 +185,7 @@ bool request_is_enabled(smx_simcall_t req)
 
     case SIMCALL_COND_WAIT: {
       static int warned = 0;
-      if (!warned)
+      if (not warned)
         XBT_INFO("Using condition variables in model-checked code is still experimental. Use at your own risk");
       warned = 1;
       return true;
@@ -235,7 +235,7 @@ static int prng_random(int min, int max)
 
 int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max)
 {
-  if (!MC_is_active() && !MC_record_path)
+  if (not MC_is_active() && not MC_record_path)
     return prng_random(min, max);
   return simcall->mc_value;
 }
index 17c5872..cc77840 100644 (file)
@@ -122,7 +122,7 @@ void add_region(int index, simgrid::mc::Snapshot* snapshot,
   if (type == simgrid::mc::RegionType::Data)
     xbt_assert(object_info, "Missing object info for object.");
   else if (type == simgrid::mc::RegionType::Heap)
-    xbt_assert(!object_info, "Unexpected object info for heap region.");
+    xbt_assert(not object_info, "Unexpected object info for heap region.");
 
   simgrid::mc::RegionSnapshot region;
 #if HAVE_SMPI
@@ -201,9 +201,7 @@ void find_object_address(
 
     // This is the non-GNU_RELRO-part of the data segment:
     if (reg.prot == PROT_RW) {
-      xbt_assert(!result->start_rw,
-                 "Multiple read-write segments for %s, not supported",
-                 maps[i].pathname.c_str());
+      xbt_assert(not result->start_rw, "Multiple read-write segments for %s, not supported", maps[i].pathname.c_str());
       result->start_rw = (char*) reg.start_addr;
       result->end_rw = (char*) reg.end_addr;
 
@@ -217,8 +215,7 @@ void find_object_address(
 
     // This is the text segment:
     else if (reg.prot == PROT_RX) {
-      xbt_assert(!result->start_exec,
-                 "Multiple executable segments for %s, not supported",
+      xbt_assert(not result->start_exec, "Multiple executable segments for %s, not supported",
                  maps[i].pathname.c_str());
       result->start_exec = (char*) reg.start_addr;
       result->end_exec = (char*) reg.end_addr;
@@ -235,9 +232,7 @@ void find_object_address(
 
     // This is the GNU_RELRO-part of the data segment:
     else if (reg.prot == PROT_READ) {
-      xbt_assert(!result->start_ro,
-                 "Multiple read only segments for %s, not supported",
-                 maps[i].pathname.c_str());
+      xbt_assert(not result->start_ro, "Multiple read only segments for %s, not supported", maps[i].pathname.c_str());
       result->start_ro = (char*) reg.start_addr;
       result->end_ro = (char*) reg.end_addr;
     }
@@ -290,13 +285,13 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame,
 {
   simgrid::mc::Process* process = &mc_model_checker->process();
 
-  if (!scope || !scope->range.contain(stack_frame->ip))
+  if (not scope || not scope->range.contain(stack_frame->ip))
     return;
 
   for(simgrid::mc::Variable& current_variable :
       scope->variables) {
 
-    if (!valid_variable(&current_variable, scope, (void *) stack_frame->ip))
+    if (not valid_variable(&current_variable, scope, (void*)stack_frame->ip))
       continue;
 
     int region_type;
@@ -316,7 +311,7 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame,
 
     if (current_variable.address != nullptr)
       new_var.address = current_variable.address;
-    else if (!current_variable.location_list.empty()) {
+    else if (not current_variable.location_list.empty()) {
       simgrid::dwarf::Location location =
         simgrid::dwarf::resolve(
           current_variable.location_list,
@@ -325,7 +320,7 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame,
           (void *) stack_frame->frame_base,
           &mc_model_checker->process(), process_index);
 
-      if (!location.in_memory())
+      if (not location.in_memory())
         xbt_die("Cannot handle non-address variable");
       new_var.address = location.address();
 
index 7fd76d2..470e06f 100644 (file)
@@ -29,14 +29,14 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_client_api, mc,
 void MC_assert(int prop)
 {
   xbt_assert(mc_model_checker == nullptr);
-  if (MC_is_active() && !prop)
+  if (MC_is_active() && not prop)
     simgrid::mc::Client::get()->reportAssertionFailure();
 }
 
 void MC_cut(void)
 {
   xbt_assert(mc_model_checker == nullptr);
-  if (!MC_is_active())
+  if (not MC_is_active())
     return;
   // FIXME, We want to do this in the model-checker:
   xbt_die("MC_cut() not implemented");
@@ -45,7 +45,7 @@ void MC_cut(void)
 void MC_ignore(void* addr, size_t size)
 {
   xbt_assert(mc_model_checker == nullptr);
-  if (!MC_is_active())
+  if (not MC_is_active())
     return;
   simgrid::mc::Client::get()->ignoreMemory(addr, size);
 }
@@ -53,7 +53,7 @@ void MC_ignore(void* addr, size_t size)
 void MC_automaton_new_propositional_symbol(const char *id, int(*fct)(void))
 {
   xbt_assert(mc_model_checker == nullptr);
-  if (!MC_is_active())
+  if (not MC_is_active())
     return;
   xbt_die("Support for client-side function proposition is not implemented: "
     "use MC_automaton_new_propositional_symbol_pointer instead.");
@@ -62,7 +62,7 @@ void MC_automaton_new_propositional_symbol(const char *id, int(*fct)(void))
 void MC_automaton_new_propositional_symbol_pointer(const char *name, int* value)
 {
   xbt_assert(mc_model_checker == nullptr);
-  if (!MC_is_active())
+  if (not MC_is_active())
     return;
   simgrid::mc::Client::get()->declareSymbol(name, value);
 }
@@ -81,7 +81,7 @@ void MC_automaton_new_propositional_symbol_pointer(const char *name, int* value)
 void MC_register_stack_area(void *stack, smx_actor_t process, ucontext_t* context, size_t size)
 {
   xbt_assert(mc_model_checker == nullptr);
-  if (!MC_is_active())
+  if (not MC_is_active())
     return;
   simgrid::mc::Client::get()->declareStack(stack, size, process, context);
 }
@@ -89,7 +89,7 @@ void MC_register_stack_area(void *stack, smx_actor_t process, ucontext_t* contex
 void MC_ignore_global_variable(const char *name)
 {
   xbt_assert(mc_model_checker == nullptr);
-  if (!MC_is_active())
+  if (not MC_is_active())
     return;
   // TODO, send a message to the model_checker
   xbt_die("Unimplemented");
@@ -98,7 +98,7 @@ void MC_ignore_global_variable(const char *name)
 void MC_ignore_heap(void *address, size_t size)
 {
   xbt_assert(mc_model_checker == nullptr);
-  if (!MC_is_active())
+  if (not MC_is_active())
     return;
   simgrid::mc::Client::get()->ignoreHeap(address, size);
 }
@@ -106,7 +106,7 @@ void MC_ignore_heap(void *address, size_t size)
 void MC_remove_ignore_heap(void *address, size_t size)
 {
   xbt_assert(mc_model_checker == nullptr);
-  if (!MC_is_active())
+  if (not MC_is_active())
     return;
   simgrid::mc::Client::get()->unignoreHeap(address, size);
 }
index 621f502..a288a17 100644 (file)
@@ -69,9 +69,9 @@ void _mc_cfg_cb_reduce(const char *name)
         ("You are specifying a reduction strategy after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
   char *val = xbt_cfg_get_string(name);
-  if (!strcasecmp(val, "none"))
+  if (not strcasecmp(val, "none"))
     simgrid::mc::reduction_mode = simgrid::mc::ReductionMode::none;
-  else if (!strcasecmp(val, "dpor"))
+  else if (not strcasecmp(val, "dpor"))
     simgrid::mc::reduction_mode = simgrid::mc::ReductionMode::dpor;
   else
     xbt_die("configuration option %s can only take 'none' or 'dpor' as a value",
index 7ccd1ea..5fd061a 100644 (file)
@@ -260,7 +260,7 @@ static const char *MC_dwarf_attr_integrate_string(Dwarf_Die * die,
                                                   int attribute)
 {
   Dwarf_Attribute attr;
-  if (!dwarf_attr_integrate(die, attribute, &attr))
+  if (not dwarf_attr_integrate(die, attribute, &attr))
     return nullptr;
   else
     return dwarf_formstring(&attr);
@@ -279,7 +279,7 @@ static const char *MC_dwarf_attr_integrate_string(Dwarf_Die * die,
 static const char *MC_dwarf_at_linkage_name(Dwarf_Die * die)
 {
   const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_linkage_name);
-  if (!name)
+  if (not name)
     name = MC_dwarf_attr_integrate_string(die, DW_AT_MIPS_linkage_name);
   return name;
 }
@@ -416,7 +416,7 @@ static uint64_t MC_dwarf_subrange_element_count(Dwarf_Die * die,
     return MC_dwarf_attr_integrate_uint(die, DW_AT_count, 0);
   // Otherwise compute DW_TAG_upper_bound-DW_TAG_lower_bound + 1:
 
-  if (!dwarf_hasattr_integrate(die, DW_AT_upper_bound))
+  if (not dwarf_hasattr_integrate(die, DW_AT_upper_bound))
     // This is not really 0, but the code expects this (we do not know):
     return 0;
 
@@ -492,7 +492,7 @@ static void MC_dwarf_fill_member_location(
   if (dwarf_hasattr(child, DW_AT_data_bit_offset))
     xbt_die("Can't groke DW_AT_data_bit_offset.");
 
-  if (!dwarf_hasattr_integrate(child, DW_AT_data_member_location)) {
+  if (not dwarf_hasattr_integrate(child, DW_AT_data_member_location)) {
     if (type->type == DW_TAG_union_type)
       return;
     xbt_die
@@ -524,7 +524,7 @@ static void MC_dwarf_fill_member_location(
     // Offset from the base address of the object:
     {
       Dwarf_Word offset;
-      if (!dwarf_formudata(&attr, &offset))
+      if (not dwarf_formudata(&attr, &offset))
         member->offset(offset);
       else
         xbt_die("Cannot get %s location <%" PRIx64 ">%s",
@@ -611,7 +611,7 @@ static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* info, Dwarf_Die
 
       MC_dwarf_fill_member_location(type, &member, &child);
 
-      if (!member.type_id)
+      if (not member.type_id)
         xbt_die("Missing type for member %s of <%" PRIx64 ">%s",
                 member.name.c_str(),
                 (uint64_t) type->id, type->name.c_str());
@@ -714,7 +714,7 @@ static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf
 {
   simgrid::mc::Type type = MC_dwarf_die_to_type(info, die, unit, frame, ns);
   auto& t = (info->types[type.id] = std::move(type));
-  if (!t.name.empty() && type.byte_size != 0)
+  if (not t.name.empty() && type.byte_size != 0)
     info->full_types_by_name[t.name] = &t;
 }
 
@@ -839,7 +839,7 @@ static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, D
 {
   std::unique_ptr<simgrid::mc::Variable> variable =
     MC_die_to_variable(info, die, unit, frame, ns);
-  if (!variable)
+  if (not variable)
     return;
   // Those arrays are sorted later:
   else if (variable->global)
@@ -893,7 +893,7 @@ static void MC_dwarf_handle_scope_die(simgrid::mc::ObjectInformation* info, Dwar
   if (low_pc) {
     // DW_AT_high_pc:
     Dwarf_Attribute attr;
-    if (!dwarf_attr_integrate(die, DW_AT_high_pc, &attr))
+    if (not dwarf_attr_integrate(die, DW_AT_high_pc, &attr))
       xbt_die("Missing DW_AT_high_pc matching with DW_AT_low_pc");
 
     Dwarf_Sword offset;
@@ -1202,7 +1202,7 @@ void MC_load_dwarf(simgrid::mc::ObjectInformation* info)
   // Try with NT_GNU_BUILD_ID: we find the build ID in the ELF file and then
   // use this ID to find the file in some known locations in the filesystem.
   std::vector<char> build_id = get_build_id(elf);
-  if (!build_id.empty()) {
+  if (not build_id.empty()) {
     elf_end(elf);
     close(fd);
 
@@ -1316,7 +1316,7 @@ static
 simgrid::mc::Type* MC_resolve_type(
   simgrid::mc::ObjectInformation* info, unsigned type_id)
 {
-  if (!type_id)
+  if (not type_id)
     return nullptr;
   simgrid::mc::Type* type = simgrid::util::find_map_ptr(info->types, type_id);
   if (type == nullptr)
@@ -1386,11 +1386,10 @@ void postProcessObjectInformation(simgrid::mc::Process* process, simgrid::mc::Ob
         break;
 
     // Resolve full_type:
-    if (!subtype->name.empty() && subtype->byte_size == 0)
+    if (not subtype->name.empty() && subtype->byte_size == 0)
       for (auto const& object_info : process->object_infos) {
         auto i = object_info->full_types_by_name.find(subtype->name);
-        if (i != object_info->full_types_by_name.end()
-            && !i->second->name.empty() && i->second->byte_size) {
+        if (i != object_info->full_types_by_name.end() && not i->second->name.empty() && i->second->byte_size) {
           type->full_type = i->second;
           break;
         }
index b3140e1..4647325 100644 (file)
@@ -134,7 +134,7 @@ void dumpStack(FILE* file, unw_cursor_t cursor)
 
   unw_word_t off;
   do {
-    const char * name = !unw_get_proc_name(&cursor, buffer, 100, &off) ? buffer : "?";
+    const char* name = not unw_get_proc_name(&cursor, buffer, 100, &off) ? buffer : "?";
 
     int status;
 
index 866015f..d60d282 100644 (file)
@@ -22,7 +22,7 @@ extern "C" {
 /* It creates the two heap regions: std_heap and mc_heap */
 void MC_memory_init()
 {
-  if (!malloc_use_mmalloc())
+  if (not malloc_use_mmalloc())
     xbt_die("Model-checking support is not enabled: run with simgrid-mc.");
 }
 
index 2881f48..7896df8 100644 (file)
@@ -53,13 +53,12 @@ void replay(RecordTrace const& trace)
 
     // Choose a request:
     smx_actor_t process = SIMIX_process_from_PID(transition.pid);
-    if (!process)
+    if (not process)
       xbt_die("Unexpected process.");
     smx_simcall_t simcall = &(process->simcall);
-    if(!simcall || simcall->call == SIMCALL_NONE)
+    if (not simcall || simcall->call == SIMCALL_NONE)
       xbt_die("No simcall for this process.");
-    if (!simgrid::mc::request_is_visible(simcall)
-        || !simgrid::mc::request_is_enabled(simcall))
+    if (not simgrid::mc::request_is_visible(simcall) || not simgrid::mc::request_is_enabled(simcall))
       xbt_die("Unexpected simcall.");
 
     // Execute the request:
index 1d3b8c6..bdc6b32 100644 (file)
@@ -332,7 +332,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
     s_xbt_dynar_t comms;
     mc_model_checker->process().read_bytes(
       &comms, sizeof(comms), remote(simcall_comm_waitany__get__comms(req)));
-    if (!xbt_dynar_is_empty(&comms)) {
+    if (not xbt_dynar_is_empty(&comms)) {
       smx_activity_t remote_sync;
       read_element(mc_model_checker->process(),
         &remote_sync, remote(simcall_comm_waitany__get__comms(req)), value,
index 0dff797..784f672 100644 (file)
@@ -132,7 +132,7 @@ int MC_snapshot_region_memcmp(
     res = 0;
   else
     res = memcmp(buffer1, buffer2, size);
-  if (!stack_alloc) {
+  if (not stack_alloc) {
     free(buffer1a);
     free(buffer2a);
   }
@@ -260,15 +260,14 @@ static void test_snapshot(bool sparse_checkpoint) {
 
     xbt_test_add("Reading whole region data for %i page(s)", n);
     const void* read = MC_region_read(&region, destination, source, byte_size);
-    xbt_test_assert(!memcmp(source, read, byte_size), "Mismatch in MC_region_read()");
+    xbt_test_assert(not memcmp(source, read, byte_size), "Mismatch in MC_region_read()");
 
     xbt_test_add("Reading parts of region data for %i page(s)", n);
     for(int j=0; j!=100; ++j) {
       size_t offset = rand() % byte_size;
       size_t size = rand() % (byte_size - offset);
       const void* read = MC_region_read(&region, destination, (const char*) source+offset, size);
-      xbt_test_assert(!memcmp((char*) source+offset, read, size),
-        "Mismatch in MC_region_read()");
+      xbt_test_assert(not memcmp((char*)source + offset, read, size), "Mismatch in MC_region_read()");
     }
 
     xbt_test_add("Compare whole region data for %i page(s)", n);
@@ -280,8 +279,9 @@ static void test_snapshot(bool sparse_checkpoint) {
     for(int j=0; j!=100; ++j) {
       size_t offset = rand() % byte_size;
       size_t size = rand() % (byte_size - offset);
-      xbt_test_assert(!MC_snapshot_region_memcmp((char*) source+offset, &region, (char*) source+offset, &region, size),
-        "Mismatch in MC_snapshot_region_memcmp()");
+      xbt_test_assert(
+          not MC_snapshot_region_memcmp((char*)source + offset, &region, (char*)source + offset, &region, size),
+          "Mismatch in MC_snapshot_region_memcmp()");
     }
 
     if (n==1) {
index c0b6826..8b04805 100644 (file)
@@ -80,9 +80,9 @@ static inline smx_simcall_t MC_state_get_request_for_process(
   state->transition.argument           = -1;
   state->executed_req.call             = SIMCALL_NONE;
 
-  if (!procstate->isTodo())
+  if (not procstate->isTodo())
     return nullptr; // Not considered by the checker algorithm
-  if (!simgrid::mc::actor_is_enabled(actor))
+  if (not simgrid::mc::actor_is_enabled(actor))
     return nullptr; // Not executable in the application
 
   smx_simcall_t req = nullptr;
@@ -162,7 +162,7 @@ static inline smx_simcall_t MC_state_get_request_for_process(
         req = &actor->simcall;
         break;
   }
-  if (!req)
+  if (not req)
     return nullptr;
 
   state->transition.pid = actor->pid;
index a48ab17..f172da7 100644 (file)
@@ -154,7 +154,7 @@ int UnwindContext::access_reg(unw_addr_space_t as,
   if (write)
     return -UNW_EREADONLYREG;
   greg_t* preg = (greg_t*) get_reg(context, regnum);
-  if (!preg)
+  if (not preg)
     return -UNW_EBADREG;
   *valp = *preg;
   return 0;
@@ -192,7 +192,7 @@ int UnwindContext::get_proc_name(unw_addr_space_t as,
 {
   simgrid::mc::UnwindContext* context = (simgrid::mc::UnwindContext*) arg;
   simgrid::mc::Frame* frame = context->process_->find_function(remote(addr));
-  if (!frame)
+  if (not frame)
     return - UNW_ENOINFO;
   *offp = (unw_word_t) frame->range.begin() - addr;
 
index 00cbe6c..86c0144 100644 (file)
@@ -30,7 +30,7 @@ void read_element(AddressSpace const& as,
 
 std::size_t read_length(AddressSpace const& as, RemotePtr<s_xbt_dynar_t> addr)
 {
-  if (!addr)
+  if (not addr)
     return 0;
   unsigned long res;
   as.read_bytes(&res, sizeof(res),
index b4a8aed..cd4a2c3 100644 (file)
@@ -39,7 +39,7 @@ Client* Client::initialize()
 {
   // We are not in MC mode:
   // TODO, handle this more gracefully.
-  if (!std::getenv(MC_ENV_SOCKET_FD))
+  if (not std::getenv(MC_ENV_SOCKET_FD))
     return nullptr;
 
   // Do not break if we are called multiple times:
@@ -50,7 +50,7 @@ Client* Client::initialize()
 
   // Fetch socket from MC_ENV_SOCKET_FD:
   char* fd_env = std::getenv(MC_ENV_SOCKET_FD);
-  if (!fd_env)
+  if (not fd_env)
     xbt_die("No MC socket passed in the environment");
   int fd =
       xbt_str_parse_int(fd_env, bprintf("Variable %s should contain a number but contains '%%s'", MC_ENV_SOCKET_FD));
@@ -103,7 +103,7 @@ void Client::handleMessages()
       case MC_MESSAGE_DEADLOCK_CHECK: {
         // Check deadlock:
         bool deadlock = false;
-        if (!simix_global->process_list.empty()) {
+        if (not simix_global->process_list.empty()) {
           deadlock = true;
           for (auto kv : simix_global->process_list)
             if (simgrid::mc::actor_is_enabled(kv.second)) {
@@ -128,7 +128,7 @@ void Client::handleMessages()
           xbt_die("Unexpected size for SIMCALL_HANDLE");
         memcpy(&message, message_buffer, sizeof(message));
         smx_actor_t process = SIMIX_process_from_PID(message.pid);
-        if (!process)
+        if (not process)
           xbt_die("Invalid pid %lu", (unsigned long)message.pid);
         SIMIX_simcall_handle(&process->simcall, message.value);
         if (channel_.send(MC_MESSAGE_WAITING))
index 4d9d7ef..b5d171a 100644 (file)
@@ -36,7 +36,7 @@ msg_error_t MSG_action_trace_run(char *path)
 
   msg_error_t res = MSG_main();
 
-  if (!simgrid::xbt::action_queues.empty()) {
+  if (not simgrid::xbt::action_queues.empty()) {
     XBT_WARN("Not all actions got consumed. If the simulation ended successfully (without deadlock),"
              " you may want to add new processes to your deployment file.");
 
index a75e536..fce5d4c 100644 (file)
@@ -36,7 +36,7 @@ void MSG_init_nocheck(int *argc, char **argv) {
   TRACE_global_init(argc, argv);
 
   xbt_getpid = &MSG_process_self_PID;
-  if (!msg_global) {
+  if (not msg_global) {
 
     msg_global = new s_MSG_Global_t();
 
index 7d50008..daf0f1d 100644 (file)
@@ -52,11 +52,12 @@ msg_error_t MSG_parallel_task_execute_with_timeout(msg_task_t task, double timeo
 
   TRACE_msg_task_execute_start(task);
 
-  xbt_assert((!simdata->compute) && !task->simdata->isused, "This task is executed somewhere else. Go fix your code!");
+  xbt_assert((not simdata->compute) && not task->simdata->isused,
+             "This task is executed somewhere else. Go fix your code!");
 
   XBT_DEBUG("Computing on %s", MSG_process_get_name(MSG_process_self()));
 
-  if (simdata->flops_amount <= 0.0 && !simdata->host_nb) {
+  if (simdata->flops_amount <= 0.0 && not simdata->host_nb) {
     TRACE_msg_task_execute_end(task);
     return MSG_OK;
   }
@@ -864,7 +865,7 @@ int MSG_task_listen_from(const char *alias)
   simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(alias);
   simgrid::kernel::activity::Comm* comm = static_cast<simgrid::kernel::activity::Comm*>(mbox->front());
 
-  if (!comm)
+  if (not comm)
     return -1;
 
   return MSG_process_get_PID( static_cast<msg_task_t>(comm->src_data)->simdata->sender );
index 4bbfb46..2331428 100644 (file)
@@ -40,7 +40,7 @@ static int MSG_host_get_file_descriptor_id(msg_host_t host)
     priv->file_descriptor_table = new std::vector<int>(sg_storage_max_file_descriptors);
     std::iota(priv->file_descriptor_table->rbegin(), priv->file_descriptor_table->rend(), 0); // Fill with ..., 1, 0.
   }
-  xbt_assert(!priv->file_descriptor_table->empty(), "Too much files are opened! Some have to be closed.");
+  xbt_assert(not priv->file_descriptor_table->empty(), "Too much files are opened! Some have to be closed.");
   int desc = priv->file_descriptor_table->back();
   priv->file_descriptor_table->pop_back();
   return desc;
@@ -326,7 +326,7 @@ msg_error_t MSG_file_rcopy (msg_file_t file, msg_host_t host, const char* fullpa
     strncpy(file_mount_name, fullpath, strlen(mount_name) + 1);
     file_mount_name[strlen(mount_name)] = '\0';
 
-    if (!strcmp(file_mount_name, mount_name) && strlen(mount_name) > longest_prefix_length) {
+    if (not strcmp(file_mount_name, mount_name) && strlen(mount_name) > longest_prefix_length) {
       /* The current mount name is found in the full path and is bigger than the previous*/
       longest_prefix_length = strlen(mount_name);
       storage_dest          = (msg_storage_t)xbt_lib_get_elm_or_null(storage_lib, storage_name);
index f000746..eda8149 100644 (file)
@@ -140,7 +140,7 @@ msg_process_t MSG_process_create_from_stdfunc(const char* name, std::function<vo
 
   smx_actor_t process = simcall_process_create(name, std::move(code), msgExt, host, properties);
 
-  if (!process) { /* Undo everything */
+  if (not process) { /* Undo everything */
     delete msgExt;
     return nullptr;
   }
@@ -164,7 +164,7 @@ msg_process_t MSG_process_attach(const char *name, void *data, msg_host_t host,
 
   /* Let's create the process: SIMIX may decide to start it right now, even before returning the flow control to us */
   smx_actor_t process = SIMIX_process_attach(name, new simgrid::MsgActorExt(data), host->cname(), properties, nullptr);
-  if (!process)
+  if (not process)
     xbt_die("Could not attach");
   simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process);
   return process->ciface();
index c166b5f..4ba7663 100644 (file)
@@ -187,7 +187,7 @@ void MSG_vm_start(msg_vm_t vm)
     int pm_overcommit = pm->extension<simgrid::vm::VmHostExt>()->overcommit;
     long vm_ramsize   = typedVM->getRamsize();
 
-    if (pm_ramsize && !pm_overcommit) { /* Only verify that we don't overcommit on need */
+    if (pm_ramsize && not pm_overcommit) { /* Only verify that we don't overcommit on need */
       /* Retrieve the memory occupied by the VMs on that host. Yep, we have to traverse all VMs of all hosts for that */
       long total_ramsize_of_vms = 0;
       for (simgrid::s4u::VirtualMachine* ws_vm : simgrid::vm::VirtualMachineImpl::allVms_)
@@ -268,7 +268,7 @@ static int migration_rx_fun(int argc, char *argv[])
   bool received_finalize = false;
 
   char *finalize_task_name = get_mig_task_name(ms->vm, ms->src_pm, ms->dst_pm, 3);
-  while (!received_finalize) {
+  while (not received_finalize) {
     msg_task_t task = nullptr;
     int ret         = MSG_task_recv(&task, ms->mbox);
 
@@ -361,7 +361,7 @@ static void start_dirty_page_tracking(msg_vm_t vm)
   simgrid::vm::VirtualMachineImpl* pimpl = static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_;
 
   pimpl->dp_enabled = 1;
-  if (!pimpl->dp_objs)
+  if (not pimpl->dp_objs)
     return;
 
   char *key = nullptr;
@@ -441,7 +441,7 @@ void MSG_host_add_task(msg_host_t host, msg_task_t task)
     dp->prev_clock = MSG_get_clock();
     dp->prev_remaining = remaining;
   }
-  if (!pimpl->dp_objs)
+  if (not pimpl->dp_objs)
     pimpl->dp_objs = xbt_dict_new_homogeneous(nullptr);
   xbt_assert(xbt_dict_get_or_null(pimpl->dp_objs, key) == nullptr);
   xbt_dict_set(pimpl->dp_objs, key, dp, nullptr);
@@ -581,7 +581,7 @@ static int migration_tx_fun(int argc, char *argv[])
   start_dirty_page_tracking(ms->vm);
 
   double computed_during_stage1 = 0;
-  if (!skip_stage1) {
+  if (not skip_stage1) {
     double clock_prev_send = MSG_get_clock();
 
     try {
@@ -621,7 +621,7 @@ static int migration_tx_fun(int argc, char *argv[])
 
 
   /* Stage2: send update pages iteratively until the size of remaining states becomes smaller than threshold value. */
-  if (!skip_stage2) {
+  if (not skip_stage2) {
 
     int stage2_round = 0;
     for (;;) {
@@ -742,7 +742,7 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t dst_pm)
     THROWF(vm_error, 0, "Cannot migrate VM '%s' from host '%s', which is offline.", vm->cname(), src_pm->cname());
   if (dst_pm->isOff())
     THROWF(vm_error, 0, "Cannot migrate VM '%s' to host '%s', which is offline.", vm->cname(), dst_pm->cname());
-  if (!MSG_vm_is_running(vm))
+  if (not MSG_vm_is_running(vm))
     THROWF(vm_error, 0, "Cannot migrate VM '%s' that is not running yet.", vm->cname());
   if (typedVm->isMigrating())
     THROWF(vm_error, 0, "Cannot migrate VM '%s' that is already migrating.", vm->cname());
index 02f74dc..6b27d8c 100644 (file)
@@ -124,7 +124,7 @@ VirtualMachineImpl::~VirtualMachineImpl()
   /* dirty page tracking */
   unsigned int size          = xbt_dict_size(dp_objs);
   static bool already_warned = false;
-  if (size > 0 && !already_warned) {
+  if (size > 0 && not already_warned) {
     xbt_dict_cursor_t cursor = nullptr;
     xbt_dict_cursor_first(dp_objs, &cursor);
     XBT_WARN("Dirty page tracking: %u pending task(s) on a destroyed VM (first one is %s).\n"
index 14d524b..0adfb1b 100644 (file)
@@ -14,7 +14,7 @@ simgrid::xbt::Extension<s4u::Host, VmHostExt> VmHostExt::EXTENSION_ID;
 
 void VmHostExt::ensureVmExtInstalled()
 {
-  if (!EXTENSION_ID.valid())
+  if (not EXTENSION_ID.valid())
     EXTENSION_ID = simgrid::s4u::Host::extension_create<VmHostExt>();
 }
 }
index 7c1d47d..d895beb 100644 (file)
@@ -107,7 +107,7 @@ s4u::NetZone* Engine::netRoot()
 
 static s4u::NetZone* netzoneByNameRecursive(s4u::NetZone* current, const char* name)
 {
-  if(!strcmp(current->name(), name))
+  if (not strcmp(current->name(), name))
     return current;
 
   for (auto elem : *(current->children())) {
index 7846f76..c36d9ec 100644 (file)
@@ -69,7 +69,7 @@ Host::~Host()
  */
 void Host::destroy()
 {
-  if (!currentlyDestroying_) {
+  if (not currentlyDestroying_) {
     currentlyDestroying_ = true;
     onDestruction(*this);
     host_list.erase(name_);
index 2e6ad2c..2882051 100644 (file)
@@ -43,7 +43,7 @@ bool Mailbox::empty()
 
 bool Mailbox::listen()
 {
-  return !this->empty() || (pimpl_->permanent_receiver && !pimpl_->done_comm_queue.empty());
+  return not this->empty() || (pimpl_->permanent_receiver && not pimpl_->done_comm_queue.empty());
 }
 
 smx_activity_t Mailbox::front()
index 543cb63..b4a9a93 100644 (file)
@@ -67,7 +67,7 @@ bool acyclic_graph_detail(xbt_dynar_t dag){
         current.push_back(task);
     }
   }
-  while(!current.empty()){
+  while (not current.empty()) {
     std::vector<SD_task_t> next;
     for (auto t: current){
       //Mark task
@@ -98,7 +98,7 @@ bool acyclic_graph_detail(xbt_dynar_t dag){
     }
   }
 
-  if(!all_marked){
+  if (not all_marked) {
     XBT_VERB("there is at least one cycle in your task graph");
     xbt_dynar_foreach(dag,count,task){
       if(task->kind != SD_TASK_COMM_E2E && task->predecessors->empty() && task->inputs->empty()){
@@ -107,7 +107,7 @@ bool acyclic_graph_detail(xbt_dynar_t dag){
       }
     }
     //test if something has to be done for the next iteration
-    while(!current.empty()){
+    while (not current.empty()) {
       std::vector<SD_task_t> next;
       //test if the current iteration is done
       for (auto t: current){
@@ -248,7 +248,7 @@ xbt_dynar_t SD_daxload(const char *filename)
     }
   }
 
-  if (!acyclic_graph_detail(result)) {
+  if (not acyclic_graph_detail(result)) {
     char* base = xbt_basename(filename);
     XBT_ERROR("The DAX described in %s is not a DAG. It contains a cycle.", base);
     free(base);
index f74c93e..2fbb3d3 100644 (file)
@@ -99,8 +99,8 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
         char *char_performer = agget(node, (char *) "performer");
         char *char_order = agget(node, (char *) "order");
         /* Tasks will execute on in a given "order" on a given set of "performer" hosts */
-        int performer = ((!char_performer || !strcmp(char_performer,"")) ? -1:atoi(char_performer));
-        int order = ((!char_order || !strcmp(char_order, ""))? -1:atoi(char_order));
+        int performer = ((not char_performer || not strcmp(char_performer, "")) ? -1 : atoi(char_performer));
+        int order     = ((not char_order || not strcmp(char_order, "")) ? -1 : atoi(char_order));
 
         if ((performer != -1 && order != -1) && performer < static_cast<int>(sg_host_count())) {
           /* required parameters are given and less performers than hosts are required */
@@ -219,7 +219,7 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
         xbt_dynar_foreach(computer, i, task){
           /* add dependency between the previous and the task to avoid parallel execution */
           if(task){
-            if(previous_task && !SD_task_dependency_exists(previous_task, task))
+            if (previous_task && not SD_task_dependency_exists(previous_task, task))
               SD_task_dependency_add(nullptr, nullptr, previous_task, task);
 
             SD_task_schedulel(task, 1, workstations[atoi(computer_name)]);
@@ -239,7 +239,7 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
 
   xbt_dict_free(&computers);
 
-  if (result && !acyclic_graph_detail(result)) {
+  if (result && not acyclic_graph_detail(result)) {
     char* base = xbt_basename(filename);
     XBT_ERROR("The DOT described in %s is not a DAG. It contains a cycle.", base);
     free(base);
index cb9f44a..f44d4ad 100644 (file)
@@ -38,13 +38,14 @@ std::set<SD_task_t>* simulate(double how_long){
   sd_global->return_set->clear();
 
   /* explore the runnable tasks */
-  while(!sd_global->runnable_tasks->empty())
+  while (not sd_global->runnable_tasks->empty())
     SD_task_run(*(sd_global->runnable_tasks->begin()));
 
   double elapsed_time = 0.0;
   double total_time = 0.0;
   /* main loop */
-  while (elapsed_time >= 0 && (how_long < 0 || 0.00001 < (how_long -total_time)) && !sd_global->watch_point_reached) {
+  while (elapsed_time >= 0 && (how_long < 0 || 0.00001 < (how_long - total_time)) &&
+         not sd_global->watch_point_reached) {
 
     XBT_DEBUG("Total time: %f", total_time);
 
@@ -78,7 +79,7 @@ std::set<SD_task_t>* simulate(double how_long){
           if (SD_task_get_state(succ) == SD_SCHEDULED && succ->predecessors->empty() && succ->inputs->empty())
             SD_task_set_state(succ, SD_RUNNABLE);
 
-          if (SD_task_get_state(succ) == SD_RUNNABLE && !sd_global->watch_point_reached)
+          if (SD_task_get_state(succ) == SD_RUNNABLE && not sd_global->watch_point_reached)
             SD_task_run(succ);
         }
         task->successors->clear();
@@ -97,7 +98,7 @@ std::set<SD_task_t>* simulate(double how_long){
                 SD_task_get_name(output), SD_task_get_name(comm_dst), comm_dst->predecessors->size());
             SD_task_set_state(comm_dst, SD_SCHEDULABLE);
           }
-          if (SD_task_get_state(output) == SD_RUNNABLE && !sd_global->watch_point_reached)
+          if (SD_task_get_state(output) == SD_RUNNABLE && not sd_global->watch_point_reached)
             SD_task_run(output);
         }
         task->outputs->clear();
@@ -116,7 +117,7 @@ std::set<SD_task_t>* simulate(double how_long){
     }
   }
 
-  if (!sd_global->watch_point_reached && how_long < 0 && !sd_global->initial_tasks->empty()) {
+  if (not sd_global->watch_point_reached && how_long < 0 && not sd_global->initial_tasks->empty()) {
     XBT_WARN("Simulation is finished but %zu tasks are still not done", sd_global->initial_tasks->size());
     for (const auto& t : *sd_global->initial_tasks)
       XBT_WARN("%s is in %s state", SD_task_get_name(t), __get_state_name(SD_task_get_state(t)));
index e6ee5cf..e57a89d 100644 (file)
@@ -166,14 +166,14 @@ void SD_task_destroy(SD_task_t task)
   XBT_DEBUG("Destroying task %s...", SD_task_get_name(task));
 
   /* First Remove all dependencies associated with the task. */
-  while (!task->predecessors->empty())
+  while (not task->predecessors->empty())
     SD_task_dependency_remove(*(task->predecessors->begin()), task);
-  while (!task->inputs->empty())
+  while (not task->inputs->empty())
     SD_task_dependency_remove(*(task->inputs->begin()), task);
-  while (!task->successors->empty())
+  while (not task->successors->empty())
     SD_task_dependency_remove(task, *(task->successors->begin()));
-  while (!task->outputs->empty())
-   SD_task_dependency_remove(task, *(task->outputs->begin()));
+  while (not task->outputs->empty())
+    SD_task_dependency_remove(task, *(task->outputs->begin()));
 
   if (task->state == SD_SCHEDULED || task->state == SD_RUNNABLE)
     __SD_task_destroy_scheduling_data(task);
@@ -911,7 +911,7 @@ void SD_task_schedulev(SD_task_t task, int count, const sg_host_t * list)
   XBT_VERB("Schedule computation task %s on %zu host(s)", task->name, task->allocation->size());
 
   if (task->kind == SD_TASK_COMP_SEQ) {
-    if (!task->flops_amount){ /*This task has failed and is rescheduled. Reset the flops_amount*/
+    if (not task->flops_amount) { /*This task has failed and is rescheduled. Reset the flops_amount*/
       task->flops_amount = xbt_new0(double, 1);
       task->flops_amount[0] = task->amount;
     }
index 919fb94..52e1ab7 100644 (file)
@@ -242,7 +242,7 @@ void sg_host_dump(sg_host_t host)
   XBT_INFO("  - available speed: %.2f", sg_host_get_available_speed(host));
   props = host->properties();
 
-  if (!xbt_dict_is_empty(props)){
+  if (not xbt_dict_is_empty(props)) {
     XBT_INFO("  - properties:");
     xbt_dict_cursor_t cursor = nullptr;
     char* key;
index 6de9f2f..22ac710 100644 (file)
@@ -49,16 +49,16 @@ static void sg_config_cmd_line(int *argc, char **argv)
   int j;
 
   for (j = i = 1; i < *argc; i++) {
-    if (!strncmp(argv[i], "--cfg=", strlen("--cfg="))) {
+    if (not strncmp(argv[i], "--cfg=", strlen("--cfg="))) {
       char *opt = strchr(argv[i], '=');
       opt++;
 
       xbt_cfg_set_parse(opt);
       XBT_DEBUG("Did apply '%s' as config setting", opt);
-    } else if (!strcmp(argv[i], "--version")) {
+    } else if (not strcmp(argv[i], "--version")) {
       printf("%s\n", SIMGRID_VERSION_STRING);
       shall_exit = 1;
-    } else if (!strcmp(argv[i], "--cfg-help") || !strcmp(argv[i], "--help")) {
+    } else if (not strcmp(argv[i], "--cfg-help") || not strcmp(argv[i], "--help")) {
       printf("Description of the configuration accepted by this simulator:\n");
       xbt_cfg_help();
       printf(
@@ -76,12 +76,12 @@ static void sg_config_cmd_line(int *argc, char **argv)
           "\n"
         );
       shall_exit = 1;
-    } else if (!strcmp(argv[i], "--help-aliases")) {
+    } else if (not strcmp(argv[i], "--help-aliases")) {
       printf("Here is a list of all deprecated option names, with their replacement.\n");
       xbt_cfg_aliases();
       printf("Please consider using the recent names\n");
       shall_exit = 1;
-    } else if (!strcmp(argv[i], "--help-models")) {
+    } else if (not strcmp(argv[i], "--help-models")) {
       model_help("host", surf_host_model_description);
       printf("\n");
       model_help("CPU", surf_cpu_model_description);
@@ -94,7 +94,7 @@ static void sg_config_cmd_line(int *argc, char **argv)
                surf_optimization_mode_description[k].description);
       printf("Both network and CPU models have 'Lazy' as default optimization level\n\n");
       shall_exit = 1;
-    } else if (!strcmp(argv[i], "--help-tracing")) {
+    } else if (not strcmp(argv[i], "--help-tracing")) {
       TRACE_help (1);
       shall_exit = 1;
     } else {
@@ -118,7 +118,7 @@ static void _sg_cfg_cb__plugin(const char *name)
   if (val==nullptr || val[0] == '\0')
     return;
 
-  if (!strcmp(val, "help")) {
+  if (not strcmp(val, "help")) {
     model_help("plugin", surf_plugin_description);
     sg_cfg_exit_early();
   }
@@ -133,7 +133,7 @@ static void _sg_cfg_cb__host_model(const char *name)
   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
   char *val = xbt_cfg_get_string(name);
-  if (!strcmp(val, "help")) {
+  if (not strcmp(val, "help")) {
     model_help("host", surf_host_model_description);
     sg_cfg_exit_early();
   }
@@ -148,7 +148,7 @@ static void _sg_cfg_cb__cpu_model(const char *name)
   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
   char *val = xbt_cfg_get_string(name);
-  if (!strcmp(val, "help")) {
+  if (not strcmp(val, "help")) {
     model_help("CPU", surf_cpu_model_description);
     sg_cfg_exit_early();
   }
@@ -163,7 +163,7 @@ static void _sg_cfg_cb__optimization_mode(const char *name)
   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
   char *val = xbt_cfg_get_string(name);
-  if (!strcmp(val, "help")) {
+  if (not strcmp(val, "help")) {
     model_help("optimization", surf_optimization_mode_description);
     sg_cfg_exit_early();
   }
@@ -178,7 +178,7 @@ static void _sg_cfg_cb__storage_mode(const char *name)
   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
   char *val = xbt_cfg_get_string(name);
-  if (!strcmp(val, "help")) {
+  if (not strcmp(val, "help")) {
     model_help("storage", surf_storage_model_description);
     sg_cfg_exit_early();
   }
@@ -192,7 +192,7 @@ static void _sg_cfg_cb__network_model(const char *name)
   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
   char *val = xbt_cfg_get_string(name);
-  if (!strcmp(val, "help")) {
+  if (not strcmp(val, "help")) {
     model_help("network", surf_network_model_description);
     sg_cfg_exit_early();
   }
@@ -253,13 +253,11 @@ static void _sg_cfg_cb_contexts_parallel_threshold(const char *name)
 static void _sg_cfg_cb_contexts_parallel_mode(const char *name)
 {
   const char* mode_name = xbt_cfg_get_string(name);
-  if (!strcmp(mode_name, "posix")) {
+  if (not strcmp(mode_name, "posix")) {
     SIMIX_context_set_parallel_mode(XBT_PARMAP_POSIX);
-  }
-  else if (!strcmp(mode_name, "futex")) {
+  } else if (not strcmp(mode_name, "futex")) {
     SIMIX_context_set_parallel_mode(XBT_PARMAP_FUTEX);
-  }
-  else if (!strcmp(mode_name, "busy_wait")) {
+  } else if (not strcmp(mode_name, "busy_wait")) {
     SIMIX_context_set_parallel_mode(XBT_PARMAP_BUSY_WAIT);
   }
   else {
index b16b66d..758d26d 100644 (file)
@@ -95,7 +95,7 @@ void SIMIX_process_cleanup(smx_actor_t process)
 
   /* cancel non-blocking communications */
   smx_activity_t synchro = static_cast<smx_activity_t>(process->comms.front());
-  while (!process->comms.empty()) {
+  while (not process->comms.empty()) {
     simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
 
     /* make sure no one will finish the comm after this process is destroyed,
@@ -183,7 +183,7 @@ static int dying_daemon(void* exit_status, void* data)
 /** This process will be terminated automatically when the last non-daemon process finishes */
 void ActorImpl::daemonize()
 {
-  if (!daemon) {
+  if (not daemon) {
     daemon = true;
     simix_global->daemons.push_back(this);
     SIMIX_process_on_exit(this, dying_daemon, this);
@@ -205,10 +205,10 @@ void create_maestro(std::function<void()> code)
   maestro->name = "";
   maestro->data = nullptr;
 
-  if (!code) {
+  if (not code) {
     maestro->context = SIMIX_context_new(std::function<void()>(), nullptr, maestro);
   } else {
-    if (!simix_global)
+    if (not simix_global)
       xbt_die("simix is not initialized, please call MSG_init first");
     maestro->context =
       simix_global->context_factory->create_maestro(code, maestro);
@@ -340,7 +340,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
   process->code = nullptr;
 
   XBT_VERB("Create context %s", process->name.c_str());
-  if (!simix_global)
+  if (not simix_global)
     xbt_die("simix is not initialized, please call MSG_init first");
   process->context = simix_global->context_factory->attach(
     simix_global->cleanup_process_function, process);
@@ -360,7 +360,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
   TRACE_msg_process_create(process->cname(), process->pid, process->host);
 
   auto context = dynamic_cast<simgrid::kernel::context::AttachContext*>(process->context);
-  if (!context)
+  if (not context)
     xbt_die("Not a suitable context");
 
   context->attach_start();
@@ -370,7 +370,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
 void SIMIX_process_detach()
 {
   auto context = dynamic_cast<simgrid::kernel::context::AttachContext*>(SIMIX_context_self());
-  if (!context)
+  if (not context)
     xbt_die("Not a suitable context");
 
   simix_global->cleanup_process_function(context->process());
@@ -470,7 +470,7 @@ void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) {
 
     process->waiting_synchro = nullptr;
   }
-  if(!xbt_dynar_member(simix_global->process_to_run, &(process)) && process != issuer) {
+  if (not xbt_dynar_member(simix_global->process_to_run, &(process)) && process != issuer) {
     XBT_DEBUG("Inserting %s in the to_run list", process->name.c_str());
     xbt_dynar_push_as(simix_global->process_to_run, smx_actor_t, process);
   }
@@ -506,7 +506,7 @@ void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const
     simgrid::kernel::activity::Sleep *sleep = dynamic_cast<simgrid::kernel::activity::Sleep*>(process->waiting_synchro);
     if (sleep != nullptr) {
       SIMIX_process_sleep_destroy(process->waiting_synchro);
-      if (!xbt_dynar_member(simix_global->process_to_run, &(process)) && process != SIMIX_process_self()) {
+      if (not xbt_dynar_member(simix_global->process_to_run, &(process)) && process != SIMIX_process_self()) {
         XBT_DEBUG("Inserting %s in the to_run list", process->name.c_str());
         xbt_dynar_push_as(simix_global->process_to_run, smx_actor_t, process);
       }
@@ -606,7 +606,7 @@ void SIMIX_process_resume(smx_actor_t process)
     return;
   }
 
-  if (!process->suspended)
+  if (not process->suspended)
     return;
   process->suspended = 0;
 
@@ -638,7 +638,7 @@ void* SIMIX_process_self_get_data()
 {
   smx_actor_t self = SIMIX_process_self();
 
-  if (!self) {
+  if (not self) {
     return nullptr;
   }
   return self->data;
@@ -704,7 +704,7 @@ static int SIMIX_process_join_finish(smx_process_exit_status_t status, smx_activ
   if (sleep->surf_sleep) {
     sleep->surf_sleep->cancel();
 
-    while (!sleep->simcalls.empty()) {
+    while (not sleep->simcalls.empty()) {
       smx_simcall_t simcall = sleep->simcalls.front();
       sleep->simcalls.pop_front();
       simcall_process_sleep__set__result(simcall, SIMIX_DONE);
@@ -885,7 +885,7 @@ xbt_dynar_t SIMIX_processes_as_dynar() {
 void SIMIX_process_on_exit_runall(smx_actor_t process) {
   s_smx_process_exit_fun_t exit_fun;
   smx_process_exit_status_t exit_status = (process->context->iwannadie) ? SMX_EXIT_FAILURE : SMX_EXIT_SUCCESS;
-  while (!process->on_exit.empty()) {
+  while (not process->on_exit.empty()) {
     exit_fun = process->on_exit.back();
     (exit_fun.fun)((void*)exit_status, exit_fun.arg);
     process->on_exit.pop_back();
index 098085a..ccf2f8c 100644 (file)
@@ -524,7 +524,7 @@ int simcall_comm_test(smx_activity_t comm)
  */
 smx_mutex_t simcall_mutex_init()
 {
-  if(!simix_global) {
+  if (not simix_global) {
     fprintf(stderr,"You must run MSG_init before using MSG\n"); // We can't use xbt_die since we may get there before the initialization
     xbt_abort();
   }
index c488326..5a6957d 100644 (file)
@@ -28,7 +28,7 @@ void SIMIX_simcall_answer(smx_simcall_t simcall)
 /*    This check should be useless and slows everyone. Reactivate if you see something
  *    weird in process scheduling.
  */
-/*    if(!xbt_dynar_member(simix_global->process_to_run, &(simcall->issuer))) */
+    /*    if(not xbt_dynar_member(simix_global->process_to_run, &(simcall->issuer))) */
     xbt_dynar_push_as(simix_global->process_to_run, smx_actor_t, simcall->issuer);
 /*    else DIE_IMPOSSIBLE; */
   }
index 712ab9c..b9911d1 100644 (file)
@@ -100,7 +100,7 @@ void SIMIX_context_mod_init()
 {
   xbt_assert(simix_global->context_factory == nullptr);
 
-#if HAVE_THREAD_CONTEXTS && !HAVE_THREAD_LOCAL_STORAGE
+#if HAVE_THREAD_CONTEXTS && not HAVE_THREAD_LOCAL_STORAGE
   /* the __thread storage class is not available on this platform:
    * use getspecific/setspecific instead to store the current context in each thread */
   xbt_os_thread_key_create(&smx_current_context_key);
@@ -171,11 +171,11 @@ void *SIMIX_context_stack_new()
    * growing downward (PTH_STACKGROWTH == -1).  Protected pages need to be put
    * after the stack when PTH_STACKGROWTH == 1. */
 
-  if (smx_context_guard_size > 0 && !MC_is_active()) {
+  if (smx_context_guard_size > 0 && not MC_is_active()) {
 
 #if !defined(PTH_STACKGROWTH) || (PTH_STACKGROWTH != -1)
     static int warned_once = 0;
-    if (!warned_once) {
+    if (not warned_once) {
       XBT_WARN("Stack overflow protection is known to be broken on your system.  Either stack grows upwards, or it was not even tested properly.");
       warned_once = 1;
     }
@@ -221,7 +221,7 @@ void *SIMIX_context_stack_new()
 
 void SIMIX_context_stack_delete(void *stack)
 {
-  if (!stack)
+  if (not stack)
     return;
 
 #if HAVE_VALGRIND_H
@@ -231,7 +231,7 @@ void SIMIX_context_stack_delete(void *stack)
 #endif
 
 #ifndef _WIN32
-  if (smx_context_guard_size > 0 && !MC_is_active()) {
+  if (smx_context_guard_size > 0 && not MC_is_active()) {
     stack = (char *)stack - smx_context_guard_size;
     if (mprotect(stack, smx_context_guard_size, PROT_READ | PROT_WRITE) == -1) {
       XBT_WARN("Failed to remove page protection: %s", strerror(errno));
@@ -274,7 +274,7 @@ void SIMIX_context_set_nthreads(int nb_threads) {
   if (nb_threads<=0) {  
      nb_threads = xbt_os_get_numcores();
      XBT_INFO("Auto-setting contexts/nthreads to %d",nb_threads);
-  }   
+  }
 #if !HAVE_THREAD_CONTEXTS
   xbt_assert(nb_threads == 1, "Parallel runs are impossible when the pthreads are missing.");
 #endif
index daa1b11..946f64b 100644 (file)
@@ -46,7 +46,7 @@ void SIMIX_launch_application(const char *file)
   try {
     parse_status = surf_parse();
     surf_parse_close();
-    xbt_assert(!parse_status, "Parse error at %s:%d", file,surf_parse_lineno);
+    xbt_assert(not parse_status, "Parse error at %s:%d", file, surf_parse_lineno);
   }
   catch (xbt_ex& e) {
     XBT_ERROR("Unrecoverable error at %s:%d. The full exception stack follows, in case it helps you to diagnose the problem.",
@@ -124,7 +124,7 @@ void SIMIX_process_set_function(const char *process_host,
   memset(&process,0,sizeof(process));
 
   sg_host_t host = sg_host_by_name(process_host);
-  if (!host)
+  if (not host)
     THROWF(arg_error, 0, "Host '%s' unknown", process_host);
   process.host = host->cname();
 
index 9292bf6..25c861e 100644 (file)
@@ -199,7 +199,7 @@ void SIMIX_global_init(int *argc, char **argv)
   simgrid::mc::Client::initialize();
 #endif
 
-  if (!simix_global) {
+  if (not simix_global) {
     simix_global = std::unique_ptr<simgrid::simix::Global>(new simgrid::simix::Global());
 
     simgrid::simix::ActorImpl proc;
@@ -240,7 +240,7 @@ void SIMIX_global_init(int *argc, char **argv)
       xbt_assert(s != nullptr, "Storage not found for name %s", name);
     });
   }
-  if (!simix_timers)
+  if (not simix_timers)
     simix_timers = xbt_heap_new(8, [](void* p) {
       delete static_cast<smx_timer_t>(p);
     });
@@ -277,7 +277,7 @@ void SIMIX_clean()
 
   smx_cleaned = 1;
   XBT_DEBUG("SIMIX_clean called. Simulation's over.");
-  if (!xbt_dynar_is_empty(simix_global->process_to_run) && SIMIX_get_clock() <= 0.0) {
+  if (not xbt_dynar_is_empty(simix_global->process_to_run) && SIMIX_get_clock() <= 0.0) {
     XBT_CRITICAL("   ");
     XBT_CRITICAL("The time is still 0, and you still have processes ready to run.");
     XBT_CRITICAL("It seems that you forgot to run the simulation that you setup.");
@@ -410,7 +410,7 @@ static bool SIMIX_execute_tasks()
       task();
 
     simix_global->tasksTemp.clear();
-  } while (!simix_global->tasks.empty());
+  } while (not simix_global->tasks.empty());
 
   return true;
 }
@@ -433,7 +433,7 @@ void SIMIX_run()
 
     SIMIX_execute_tasks();
 
-    while (!xbt_dynar_is_empty(simix_global->process_to_run)) {
+    while (not xbt_dynar_is_empty(simix_global->process_to_run)) {
       XBT_DEBUG("New Sub-Schedule Round; size(queue)=%lu", xbt_dynar_length(simix_global->process_to_run));
 
       /* Run all processes that are ready to run, possibly in parallel */
@@ -551,12 +551,10 @@ void SIMIX_run()
     XBT_DEBUG("### time %f, #processes %zu, #to_run %lu", time, simix_global->process_list.size(),
               xbt_dynar_length(simix_global->process_to_run));
 
+    if (xbt_dynar_is_empty(simix_global->process_to_run) && not simix_global->process_list.empty())
+      simgrid::simix::onDeadlock();
 
-    if (xbt_dynar_is_empty(simix_global->process_to_run) &&
-        !simix_global->process_list.empty())
-    simgrid::simix::onDeadlock();
-
-  } while (time > -1.0 || !xbt_dynar_is_empty(simix_global->process_to_run));
+  } while (time > -1.0 || not xbt_dynar_is_empty(simix_global->process_to_run));
 
   if (simix_global->process_list.size() != 0) {
 
index eca8a19..11e3235 100644 (file)
@@ -19,7 +19,7 @@ namespace simgrid {
 
     Host::Host()
     {
-      if (!Host::EXTENSION_ID.valid())
+      if (not Host::EXTENSION_ID.valid())
         Host::EXTENSION_ID = s4u::Host::extension_create<simix::Host>();
 
       simgrid::simix::ActorImpl act;
@@ -129,7 +129,7 @@ void SIMIX_host_add_auto_restart_process(
   arg->properties = properties;
   arg->auto_restart = auto_restart;
 
-  if (host->isOff() && !xbt_dict_get_or_null(watched_hosts_lib, host->cname())) {
+  if (host->isOff() && not xbt_dict_get_or_null(watched_hosts_lib, host->cname())) {
     xbt_dict_set(watched_hosts_lib, host->cname(), host, nullptr);
     XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF", host->cname());
   }
@@ -165,7 +165,7 @@ smx_activity_t SIMIX_execution_start(smx_actor_t issuer, const char *name, doubl
   simgrid::kernel::activity::Exec *exec = new simgrid::kernel::activity::Exec(name, issuer->host);
 
   /* set surf's action */
-  if (!MC_is_active() && !MC_record_replay_is_active()) {
+  if (not MC_is_active() && not MC_record_replay_is_active()) {
 
     exec->surf_exec = issuer->host->pimpl_cpu->execution_start(flops_amount);
     exec->surf_exec->setData(exec);
@@ -200,7 +200,7 @@ smx_activity_t SIMIX_execution_parallel_start(const char* name, int host_nb, sg_
   }
 
   /* set surf's synchro */
-  if (!MC_is_active() && !MC_record_replay_is_active()) {
+  if (not MC_is_active() && not MC_record_replay_is_active()) {
     exec->surf_exec = surf_host_model->executeParallelTask(host_nb, host_list_cpy, flops_amount, bytes_amount, rate);
     exec->surf_exec->setData(exec);
     if (timeout > 0) {
index 2da73fd..b10306a 100644 (file)
@@ -52,9 +52,8 @@ _find_matching_comm(boost::circular_buffer_space_optimized<smx_activity_t>* dequ
     } else if (comm->type == SIMIX_COMM_RECEIVE) {
       other_user_data = comm->dst_data;
     }
-    if (comm->type == type &&
-        (!      match_fun ||       match_fun(this_user_data,  other_user_data, synchro)) &&
-        (!comm->match_fun || comm->match_fun(other_user_data, this_user_data,  my_synchro))) {
+    if (comm->type == type && (!match_fun || match_fun(this_user_data, other_user_data, synchro)) &&
+        (not comm->match_fun || comm->match_fun(other_user_data, this_user_data, my_synchro))) {
       XBT_DEBUG("Found a matching communication synchro %p", comm);
       if (remove_matching)
         deque->erase(it);
@@ -108,7 +107,7 @@ XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx
   simgrid::kernel::activity::Comm* other_comm =
       _find_matching_comm(&mbox->comm_queue, SIMIX_COMM_RECEIVE, match_fun, data, this_comm, /*remove_matching*/ true);
 
-  if (!other_comm) {
+  if (not other_comm) {
     other_comm = this_comm;
 
     if (mbox->permanent_receiver!=nullptr){
@@ -197,7 +196,7 @@ smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void *
     other_comm = _find_matching_comm(&mbox->done_comm_queue, SIMIX_COMM_SEND, match_fun, data, this_synchro,
                                      /*remove_matching*/ true);
     //if not found, assume the receiver came first, register it to the mailbox in the classical way
-    if (!other_comm) {
+    if (not other_comm) {
       XBT_DEBUG("We have messages in the permanent receive list, but not the one we are looking for, pushing request into list");
       other_comm = this_synchro;
       mbox->push(this_synchro);
@@ -221,7 +220,7 @@ smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void *
     other_comm = _find_matching_comm(&mbox->comm_queue, SIMIX_COMM_SEND, match_fun, data, this_synchro,
                                      /*remove_matching*/ true);
 
-    if (!other_comm) {
+    if (not other_comm) {
       XBT_DEBUG("Receive pushed first %zu", mbox->comm_queue.size());
       other_comm = this_synchro;
       mbox->push(this_synchro);
@@ -276,12 +275,12 @@ smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int t
     smx_type = SIMIX_COMM_SEND;
   } 
   smx_activity_t other_synchro=nullptr;
-  if (mbox->permanent_receiver != nullptr && !mbox->done_comm_queue.empty()) {
+  if (mbox->permanent_receiver != nullptr && not mbox->done_comm_queue.empty()) {
     XBT_DEBUG("first check in the permanent recv mailbox, to see if we already got something");
     other_synchro = _find_matching_comm(&mbox->done_comm_queue,
       (e_smx_comm_type_t) smx_type, match_fun, data, this_comm,/*remove_matching*/false);
   }
-  if (!other_synchro){
+  if (not other_synchro) {
     XBT_DEBUG("check if we have more luck in the normal mailbox");
     other_synchro = _find_matching_comm(&mbox->comm_queue,
       (e_smx_comm_type_t) smx_type, match_fun, data, this_comm,/*remove_matching*/false);
@@ -504,7 +503,7 @@ void SIMIX_comm_finish(smx_activity_t synchro)
   simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
   unsigned int destroy_count = 0;
 
-  while (!synchro->simcalls.empty()) {
+  while (not synchro->simcalls.empty()) {
     smx_simcall_t simcall = synchro->simcalls.front();
     synchro->simcalls.pop_front();
 
@@ -521,7 +520,7 @@ void SIMIX_comm_finish(smx_activity_t synchro)
         SIMIX_timer_remove(simcall->timer);
         simcall->timer = nullptr;
       }
-      if (!MC_is_active() && !MC_record_replay_is_active())
+      if (not MC_is_active() && not MC_record_replay_is_active())
         simcall_comm_waitany__set__result(simcall, xbt_dynar_search(simcall_comm_waitany__get__comms(simcall), &synchro));
     }
 
@@ -696,7 +695,7 @@ void SIMIX_comm_copy_data(smx_activity_t synchro)
 
   size_t buff_size = comm->src_buff_size;
   /* If there is no data to copy then return */
-  if (!comm->src_buff || !comm->dst_buff || comm->copied)
+  if (not comm->src_buff || not comm->dst_buff || comm->copied)
     return;
 
   XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)", comm,
index f2a98c7..113f85f 100644 (file)
@@ -164,7 +164,7 @@ bool Mutex::try_lock(smx_actor_t issuer)
 void Mutex::unlock(smx_actor_t issuer)
 {
   XBT_IN("(%p, %p)", this, issuer);
-  if(!this->locked)
+  if (not this->locked)
     THROWF(mismatch_error, 0, "Cannot release that mutex: it was not locked.");
 
   /* If the mutex is not owned by the issuer, that's not good */
index 9f0e626..c7b8dba 100644 (file)
@@ -88,7 +88,7 @@ double SmpiHost::oisend(size_t size)
 
 SmpiHost::SmpiHost(simgrid::s4u::Host *ptr) : host(ptr)
 {
-  if (!SmpiHost::EXTENSION_ID.valid())
+  if (not SmpiHost::EXTENSION_ID.valid())
     SmpiHost::EXTENSION_ID = simgrid::s4u::Host::extension_create<SmpiHost>();
 
   const char* orecv_string = host->property("smpi/or");
index e7cd1f7..786b0af 100644 (file)
@@ -130,7 +130,7 @@ Coll_allgather_2dmesh::allgather(void *send_buff, int send_count, MPI_Datatype
 
   block_size = extent * send_count;
 
-  if (!is_2dmesh(num_procs, &X, &Y))
+  if (not is_2dmesh(num_procs, &X, &Y))
     THROWF(arg_error,0, "allgather_2dmesh algorithm can't be used with this number of processes! ");
 
   my_row_base = (rank / Y) * Y;
index 35c2d1b..b97d22a 100644 (file)
@@ -113,7 +113,7 @@ int Coll_allgather_3dmesh::allgather(void *send_buff, int send_count,
   num_procs = comm->size();
   extent = send_type->get_extent();
 
-  if (!is_3dmesh(num_procs, &X, &Y, &Z))
+  if (not is_3dmesh(num_procs, &X, &Y, &Z))
     THROWF(arg_error,0, "allgather_3dmesh algorithm can't be used with this number of processes! ");
 
 
index 6054049..740c911 100644 (file)
@@ -52,8 +52,8 @@ int Coll_allgather_mvapich2_smp::allgather(void *sendbuf,int sendcnt, MPI_Dataty
   if(comm->get_leaders_comm()==MPI_COMM_NULL){
     comm->init_smp();
   }
-  
-    if(!comm->is_uniform() || !comm->is_blocked())
+
+  if (not comm->is_uniform() || not comm->is_blocked())
     THROWF(arg_error,0, "allgather MVAPICH2 smp algorithm can't be used with irregular deployment. Please insure that processes deployed on the same node are contiguous and that each node has the same number of processes");
   
     if (recvcnt == 0) {
@@ -114,8 +114,8 @@ int Coll_allgather_mvapich2_smp::allgather(void *sendbuf,int sendcnt, MPI_Dataty
 
             displs =  static_cast<int *>(xbt_malloc(sizeof (int) * leader_comm_size));
             recvcnts =  static_cast<int *>(xbt_malloc(sizeof (int) * leader_comm_size));
-            if (!displs || !recvcnts) {
-                return MPI_ERR_OTHER;
+            if (not displs || not recvcnts) {
+              return MPI_ERR_OTHER;
             }
             recvcnts[0] = node_sizes[0] * recvcnt;
             displs[0] = 0;
index fb7f12f..df47969 100644 (file)
@@ -91,7 +91,7 @@ Coll_allgather_spreading_simple::allgather(void *send_buff, int send_count,
 
   num_reqs = (2 * num_procs) - 2;
   reqs = (MPI_Request *) xbt_malloc(num_reqs * sizeof(MPI_Request));
-  if (!reqs) {
+  if (not reqs) {
     printf("allgather-spreading-simple.c:40: cannot allocate memory\n");
     MPI_Finalize();
     exit(0);
index 4af5cd8..e2e973a 100644 (file)
@@ -72,7 +72,7 @@ Coll_allgatherv_mpich_ring::allgatherv(void *sendbuf, int sendcount,
     min = 32768*8 / recvtype_extent;
   /* Handle the case where the datatype extent is larger than
    * the pipeline size. */
-  if (!min)
+  if (not min)
     min = 1;
 
   sidx = rank;
@@ -86,25 +86,23 @@ Coll_allgatherv_mpich_ring::allgatherv(void *sendbuf, int sendcount,
       rbuf = (char *)recvbuf + ((displs[ridx] + roffset) * recvtype_extent);
 
       /* Protect against wrap-around of indices */
-      if (!tosend)
+      if (not tosend)
         sendnow = 0;
-      if (!torecv)
+      if (not torecv)
         recvnow = 0;
 
       /* Communicate */
-      if (!sendnow && !recvnow) {
-          /* Don't do anything. This case is possible if two
-           * consecutive processes contribute 0 bytes each. */
-      }
-      else if (!sendnow) { /* If there's no data to send, just do a recv call */
-          Request::recv(rbuf, recvnow, recvtype, left, COLL_TAG_ALLGATHERV, comm, &status);
+      if (not sendnow && not recvnow) {
+        /* Don't do anything. This case is possible if two
+         * consecutive processes contribute 0 bytes each. */
+      } else if (not sendnow) { /* If there's no data to send, just do a recv call */
+        Request::recv(rbuf, recvnow, recvtype, left, COLL_TAG_ALLGATHERV, comm, &status);
 
-          torecv -= recvnow;
-      }
-      else if (!recvnow) { /* If there's no data to receive, just do a send call */
-          Request::send(sbuf, sendnow, recvtype, right, COLL_TAG_ALLGATHERV, comm);
+        torecv -= recvnow;
+      } else if (not recvnow) { /* If there's no data to receive, just do a send call */
+        Request::send(sbuf, sendnow, recvtype, right, COLL_TAG_ALLGATHERV, comm);
 
-          tosend -= sendnow;
+        tosend -= sendnow;
       }
       else { /* There's data to be sent and received */
           Request::sendrecv(sbuf, sendnow, recvtype, right, COLL_TAG_ALLGATHERV,
index ca2d0f9..afc21e8 100644 (file)
@@ -56,7 +56,7 @@ int Coll_allreduce_smp_rsag_lr::allreduce(void *send_buf, void *recv_buf,
 
   int inter_comm_size = (comm_size + num_core - 1) / num_core;
 
-  if (!rank) {
+  if (not rank) {
     //printf("intra com size = %d\n",num_core);
     //printf("inter com size = %d\n",inter_comm_size);
   }
index fe9a81a..ea08353 100644 (file)
@@ -55,7 +55,7 @@ int Coll_allreduce_smp_rsag::allreduce(void *send_buf, void *recv_buf,
 
   int inter_comm_size = (comm_size + num_core - 1) / num_core;
 
-  if (!rank) {
+  if (not rank) {
     //printf("intra com size = %d\n",num_core);
     //printf("inter com size = %d\n",inter_comm_size);
   }
index 6b6c841..7c476a3 100644 (file)
@@ -74,7 +74,7 @@ int Coll_alltoall_2dmesh::alltoall(void *send_buff, int send_count,
   num_procs = comm->size();
   extent = send_type->get_extent();
 
-  if (!alltoall_check_is_2dmesh(num_procs, &X, &Y))
+  if (not alltoall_check_is_2dmesh(num_procs, &X, &Y))
     return MPI_ERR_OTHER;
 
   my_row_base = (rank / Y) * Y;
index 24c6b35..bb8ca3d 100644 (file)
@@ -65,7 +65,7 @@ int Coll_alltoall_3dmesh::alltoall(void *send_buff, int send_count,
   num_procs = comm->size();
   extent = send_type->get_extent();
 
-  if (!alltoall_check_is_3dmesh(num_procs, &X, &Y, &Z))
+  if (not alltoall_check_is_3dmesh(num_procs, &X, &Y, &Z))
     return MPI_ERR_OTHER;
 
   num_reqs = X;
index b457fcb..8ac87db 100644 (file)
@@ -318,24 +318,22 @@ int Coll_bcast_mvapich2_intra_node::bcast(void *buffer,
 #endif
         ) {
 
-        if (!is_contig || !is_homogeneous) {
-            tmp_buf=(void *)smpi_get_tmp_sendbuffer(nbytes);
-
-            /* TODO: Pipeline the packing and communication */
-           // position = 0;
-/*            if (rank == root) {*/
-/*                mpi_errno =*/
-/*                    MPIR_Pack_impl(buffer, count, datatype, tmp_buf, nbytes, &position);*/
-/*                if (mpi_errno)*/
-/*                    MPIU_ERR_POP(mpi_errno);*/
-/*            }*/
+      if (not is_contig || not is_homogeneous) {
+        tmp_buf = (void*)smpi_get_tmp_sendbuffer(nbytes);
+
+        /* TODO: Pipeline the packing and communication */
+        // position = 0;
+        /*            if (rank == root) {*/
+        /*                mpi_errno =*/
+        /*                    MPIR_Pack_impl(buffer, count, datatype, tmp_buf, nbytes, &position);*/
+        /*                if (mpi_errno)*/
+        /*                    MPIU_ERR_POP(mpi_errno);*/
+        /*            }*/
         }
 
         shmem_comm = comm->get_intra_comm();
-        if (!is_contig || !is_homogeneous) {
-            mpi_errno =
-                MPIR_Bcast_inter_node_helper_MV2(tmp_buf, nbytes, MPI_BYTE,
-                                                 root, comm);
+        if (not is_contig || not is_homogeneous) {
+          mpi_errno = MPIR_Bcast_inter_node_helper_MV2(tmp_buf, nbytes, MPI_BYTE, root, comm);
         } else {
             mpi_errno =
                 MPIR_Bcast_inter_node_helper_MV2(buffer, count, datatype, root,
@@ -344,20 +342,15 @@ int Coll_bcast_mvapich2_intra_node::bcast(void *buffer,
 
         /* We are now done with the inter-node phase */
             if (nbytes <= mv2_knomial_intra_node_threshold) {
-                if (!is_contig || !is_homogeneous) {
-                    mpi_errno = MPIR_Shmem_Bcast_MV2(tmp_buf, nbytes, MPI_BYTE,
-                                                     root, shmem_comm);
+              if (not is_contig || not is_homogeneous) {
+                mpi_errno = MPIR_Shmem_Bcast_MV2(tmp_buf, nbytes, MPI_BYTE, root, shmem_comm);
                 } else {
                     mpi_errno = MPIR_Shmem_Bcast_MV2(buffer, count, datatype,
                                                      root, shmem_comm);
                 }
             } else {
-                if (!is_contig || !is_homogeneous) {
-                    mpi_errno =
-                        MPIR_Knomial_Bcast_intra_node_MV2(tmp_buf, nbytes,
-                                                          MPI_BYTE,
-                                                          INTRA_NODE_ROOT,
-                                                          shmem_comm);
+              if (not is_contig || not is_homogeneous) {
+                mpi_errno = MPIR_Knomial_Bcast_intra_node_MV2(tmp_buf, nbytes, MPI_BYTE, INTRA_NODE_ROOT, shmem_comm);
                 } else {
                     mpi_errno =
                         MPIR_Knomial_Bcast_intra_node_MV2(buffer, count,
index 1a1fe1a..775b82e 100644 (file)
@@ -324,15 +324,13 @@ Coll_bcast_scatter_rdb_allgather::bcast (
       xbt_die("we didn't receive enough !");
     }
 
-    if (!is_contig || !is_homogeneous)
-    {
-        if (rank != root)
-        {
-            position = 0;
-            mpi_errno = MPI_Unpack(tmp_buf, nbytes, &position, buffer,
-                                         count, datatype, comm);
-            if (mpi_errno) xbt_die("error when unpacking %d", mpi_errno);
-        }
+    if (not is_contig || not is_homogeneous) {
+      if (rank != root) {
+        position  = 0;
+        mpi_errno = MPI_Unpack(tmp_buf, nbytes, &position, buffer, count, datatype, comm);
+        if (mpi_errno)
+          xbt_die("error when unpacking %d", mpi_errno);
+      }
     }
 
 fn_exit:
index 4d8cf57..dc28407 100644 (file)
@@ -99,9 +99,9 @@ ompi_coll_tuned_topo_build_tree( int fanout,
     rank = comm->rank();
 
     tree = (ompi_coll_tree_t*)malloc(sizeof(ompi_coll_tree_t));
-    if (!tree) {
-        XBT_DEBUG("coll:tuned:topo_build_tree PANIC::out of memory");
-        return NULL;
+    if (not tree) {
+      XBT_DEBUG("coll:tuned:topo_build_tree PANIC::out of memory");
+      return NULL;
     }
 
     tree->tree_root     = MPI_UNDEFINED;
@@ -199,10 +199,9 @@ ompi_coll_tuned_topo_build_in_order_bintree( MPI_Comm comm )
     rank = comm->rank();
 
     tree = (ompi_coll_tree_t*)malloc(sizeof(ompi_coll_tree_t));
-    if (!tree) {
-        XBT_DEBUG(
-                     "coll:tuned:topo_build_tree PANIC::out of memory");
-        return NULL;
+    if (not tree) {
+      XBT_DEBUG("coll:tuned:topo_build_tree PANIC::out of memory");
+      return NULL;
     }
 
     tree->tree_root     = MPI_UNDEFINED;
@@ -296,8 +295,8 @@ int ompi_coll_tuned_topo_destroy_tree( ompi_coll_tree_t** tree )
 {
     ompi_coll_tree_t *ptr;
 
-    if ((!tree)||(!*tree)) {
-        return MPI_SUCCESS;
+    if ((not tree) || (!*tree)) {
+      return MPI_SUCCESS;
     }
 
     ptr = *tree;
@@ -344,9 +343,9 @@ ompi_coll_tuned_topo_build_bmtree( MPI_Comm comm,
     index = rank -root;
 
     bmtree = (ompi_coll_tree_t*)malloc(sizeof(ompi_coll_tree_t));
-    if (!bmtree) {
-        XBT_DEBUG("coll:tuned:topo:build_bmtree PANIC out of memory");
-        return NULL;
+    if (not bmtree) {
+      XBT_DEBUG("coll:tuned:topo:build_bmtree PANIC out of memory");
+      return NULL;
     }
 
     bmtree->tree_bmtree   = 1;
@@ -425,9 +424,9 @@ ompi_coll_tuned_topo_build_in_order_bmtree( MPI_Comm comm,
     vrank = (rank - root + size) % size;
 
     bmtree = (ompi_coll_tree_t*)xbt_malloc(sizeof(ompi_coll_tree_t));
-    if (!bmtree) {
-        XBT_DEBUG("coll:tuned:topo:build_bmtree PANIC out of memory");
-        return NULL;
+    if (not bmtree) {
+      XBT_DEBUG("coll:tuned:topo:build_bmtree PANIC out of memory");
+      return NULL;
     }
 
     bmtree->tree_bmtree   = 1;
@@ -497,10 +496,10 @@ ompi_coll_tuned_topo_build_chain( int fanout,
      * Allocate space for topology arrays if needed 
      */
     chain = (ompi_coll_tree_t*)malloc( sizeof(ompi_coll_tree_t) );
-    if (!chain) {
-        XBT_DEBUG("coll:tuned:topo:build_chain PANIC out of memory");
-        fflush(stdout);
-        return NULL;
+    if (not chain) {
+      XBT_DEBUG("coll:tuned:topo:build_chain PANIC out of memory");
+      fflush(stdout);
+      return NULL;
     }
     chain->tree_root     = MPI_UNDEFINED;
     chain->tree_nextsize = -1;
index 21c2142..407a3b3 100644 (file)
@@ -278,89 +278,80 @@ int Coll_gather_mvapich2_two_level::gather(void *sendbuf,
     /* leader_root is the rank of the leader of the root in leader_comm. 
      * leader_root is to be used as the root of the inter-leader gather ops 
      */
-    if (!comm->is_uniform()) {
-        if (local_rank == 0) {
-            int *displs = NULL;
-            int *recvcnts = NULL;
-            int *node_sizes;
-            int i = 0;
-            /* Node leaders have all the data. But, different nodes can have
-             * different number of processes. Do a Gather first to get the 
-             * buffer lengths at each leader, followed by a Gatherv to move
-             * the actual data */
+    if (not comm->is_uniform()) {
+      if (local_rank == 0) {
+        int* displs   = NULL;
+        int* recvcnts = NULL;
+        int* node_sizes;
+        int i = 0;
+        /* Node leaders have all the data. But, different nodes can have
+         * different number of processes. Do a Gather first to get the
+         * buffer lengths at each leader, followed by a Gatherv to move
+         * the actual data */
+
+        if (leader_comm_rank == leader_root && root != leader_of_root) {
+          /* The root of the Gather operation is not a node-level
+           * leader and this process's rank in the leader_comm
+           * is the same as leader_root */
+          if (rank == root) {
+            leader_gather_buf =
+                smpi_get_tmp_recvbuffer(recvcnt * MAX(recvtype_extent, recvtype_true_extent) * comm_size);
+          } else {
+            leader_gather_buf =
+                smpi_get_tmp_sendbuffer(sendcnt * MAX(sendtype_extent, sendtype_true_extent) * comm_size);
+          }
+          if (leader_gather_buf == NULL) {
+            mpi_errno = MPI_ERR_OTHER;
+            return mpi_errno;
+          }
+        }
 
-            if (leader_comm_rank == leader_root && root != leader_of_root) {
-                /* The root of the Gather operation is not a node-level 
-                 * leader and this process's rank in the leader_comm 
-                 * is the same as leader_root */
-                if(rank == root) { 
-                    leader_gather_buf = smpi_get_tmp_recvbuffer(recvcnt *
-                                                MAX(recvtype_extent,
-                                                recvtype_true_extent) *
-                                                comm_size);
-                } else { 
-                    leader_gather_buf = smpi_get_tmp_sendbuffer(sendcnt *
-                                                MAX(sendtype_extent,
-                                                sendtype_true_extent) *
-                                                comm_size);
-                } 
-                if (leader_gather_buf == NULL) {
-                    mpi_errno =  MPI_ERR_OTHER;
-                    return mpi_errno;
-                }
-            }
+        node_sizes = comm->get_non_uniform_map();
 
-            node_sizes = comm->get_non_uniform_map();
+        if (leader_comm_rank == leader_root) {
+          displs   = static_cast<int*>(xbt_malloc(sizeof(int) * leader_comm_size));
+          recvcnts = static_cast<int*>(xbt_malloc(sizeof(int) * leader_comm_size));
+          if (not displs || not recvcnts) {
+            mpi_errno = MPI_ERR_OTHER;
+            return mpi_errno;
+          }
+        }
 
-            if (leader_comm_rank == leader_root) {
-                displs =  static_cast<int *>(xbt_malloc(sizeof (int) * leader_comm_size));
-                recvcnts =  static_cast<int *>(xbt_malloc(sizeof (int) * leader_comm_size));
-                if (!displs || !recvcnts) {
-                    mpi_errno = MPI_ERR_OTHER;
-                    return mpi_errno;
-                }
-            }
+        if (root == leader_of_root) {
+          /* The root of the gather operation is also the node
+           * leader. Receive into recvbuf and we are done */
+          if (leader_comm_rank == leader_root) {
+            recvcnts[0] = node_sizes[0] * recvcnt;
+            displs[0]   = 0;
 
-            if (root == leader_of_root) {
-                /* The root of the gather operation is also the node 
-                 * leader. Receive into recvbuf and we are done */
-                if (leader_comm_rank == leader_root) {
-                    recvcnts[0] = node_sizes[0] * recvcnt;
-                    displs[0] = 0;
-
-                    for (i = 1; i < leader_comm_size; i++) {
-                        displs[i] = displs[i - 1] + node_sizes[i - 1] * recvcnt;
-                        recvcnts[i] = node_sizes[i] * recvcnt;
-                    }
-                } 
-                Colls::gatherv(tmp_buf,
-                                         local_size * nbytes,
-                                         MPI_BYTE, recvbuf, recvcnts,
-                                         displs, recvtype,
-                                         leader_root, leader_comm);
-            } else {
-                /* The root of the gather operation is not the node leader. 
-                 * Receive into leader_gather_buf and then send 
-                 * to the root */
-                if (leader_comm_rank == leader_root) {
-                    recvcnts[0] = node_sizes[0] * nbytes;
-                    displs[0] = 0;
-
-                    for (i = 1; i < leader_comm_size; i++) {
-                        displs[i] = displs[i - 1] + node_sizes[i - 1] * nbytes;
-                        recvcnts[i] = node_sizes[i] * nbytes;
-                    }
-                } 
-                Colls::gatherv(tmp_buf, local_size * nbytes,
-                                         MPI_BYTE, leader_gather_buf,
-                                         recvcnts, displs, MPI_BYTE,
-                                         leader_root, leader_comm);
+            for (i = 1; i < leader_comm_size; i++) {
+              displs[i]   = displs[i - 1] + node_sizes[i - 1] * recvcnt;
+              recvcnts[i] = node_sizes[i] * recvcnt;
             }
-            if (leader_comm_rank == leader_root) {
-                xbt_free(displs);
-                xbt_free(recvcnts);
+          }
+          Colls::gatherv(tmp_buf, local_size * nbytes, MPI_BYTE, recvbuf, recvcnts, displs, recvtype, leader_root,
+                         leader_comm);
+        } else {
+          /* The root of the gather operation is not the node leader.
+           * Receive into leader_gather_buf and then send
+           * to the root */
+          if (leader_comm_rank == leader_root) {
+            recvcnts[0] = node_sizes[0] * nbytes;
+            displs[0]   = 0;
+
+            for (i = 1; i < leader_comm_size; i++) {
+              displs[i]   = displs[i - 1] + node_sizes[i - 1] * nbytes;
+              recvcnts[i] = node_sizes[i] * nbytes;
             }
+          }
+          Colls::gatherv(tmp_buf, local_size * nbytes, MPI_BYTE, leader_gather_buf, recvcnts, displs, MPI_BYTE,
+                         leader_root, leader_comm);
+        }
+        if (leader_comm_rank == leader_root) {
+          xbt_free(displs);
+          xbt_free(recvcnts);
         }
+      }
     } else {
         /* All nodes have the same number of processes. 
          * Just do one Gather to get all 
index e7dfd60..82a5fe2 100644 (file)
@@ -77,7 +77,7 @@ int Coll_reduce_binomial::reduce(void *sendbuf, void *recvbuf, int count,
     mask <<= 1;
   }
 
-  if (!is_commutative && (root != 0)){
+  if (not is_commutative && (root != 0)) {
     if (rank == 0){
       Request::send(recvbuf, count, datatype, root,tag, comm);
     }else if (rank == root){
index 47fac6e..b476889 100644 (file)
@@ -93,10 +93,8 @@ int smpi_coll_tuned_ompi_reduce_generic( void* sendbuf, void* recvbuf, int origi
 
         /* If this is a non-commutative operation we must copy
            sendbuf to the accumbuf, in order to simplfy the loops */
-        if ( (op!=MPI_OP_NULL && !op->is_commutative())) {
-            Datatype::copy(
-                                                (char*)sendtmpbuf, original_count, datatype,
-                                                (char*)accumbuf, original_count, datatype);
+        if ((op != MPI_OP_NULL && not op->is_commutative())) {
+          Datatype::copy((char*)sendtmpbuf, original_count, datatype, (char*)accumbuf, original_count, datatype);
         }
         /* Allocate two buffers for incoming segments */
         real_segment_size = true_extent + (count_by_segment - 1) * extent;
index b5e2fbe..cc0eb11 100644 (file)
@@ -40,7 +40,7 @@ int Coll_reduce_scatter_gather::reduce(void *sendbuf, void *recvbuf,
   extent = datatype->get_extent();
   /* If I'm not the root, then my recvbuf may not be valid, therefore
   I have to allocate a temporary one */
-  if (rank != root && !recvbuf) {
+  if (rank != root && not recvbuf) {
     temporary_buffer=1;
     recvbuf = (void *)smpi_get_tmp_recvbuffer(count * extent);
   }
index 2693c2c..0b786b9 100644 (file)
@@ -245,7 +245,7 @@ int Coll_reduce_scatter_mpich_noncomm::reduce_scatter(void *sendbuf, void *recvb
                     outgoing_data + recv_offset*true_extent,
                      incoming_data + recv_offset*true_extent,
                      &size, datatype);
-            buf0_was_inout = !buf0_was_inout;
+            buf0_was_inout = not buf0_was_inout;
         }
 
         /* the next round of send/recv needs to happen within the block (of size
index 6eea9d6..84fd737 100644 (file)
@@ -63,7 +63,7 @@ Coll_reduce_scatter_ompi_basic_recursivehalving::reduce_scatter(void *sbuf,
     size = comm->size();
    
     XBT_DEBUG("coll:tuned:reduce_scatter_ompi_basic_recursivehalving, rank %d", rank);
-    if( (op!=MPI_OP_NULL && !op->is_commutative()))
+    if ((op != MPI_OP_NULL && not op->is_commutative()))
       THROWF(arg_error,0, " reduce_scatter ompi_basic_recursivehalving can only be used for commutative operations! ");
 
     /* Find displacements and the like */
index 8d4dd5f..cff366c 100644 (file)
@@ -141,51 +141,46 @@ int Coll_scatter_mvapich2_two_level_direct::scatter(void *sendbuf,
         }
 
         if (leader_comm_size > 1 && local_rank == 0) {
-            if (!comm->is_uniform()) {
-                int *displs = NULL;
-                int *sendcnts = NULL;
-                int *node_sizes;
-                int i = 0;
-                node_sizes = comm->get_non_uniform_map();
-
-                if (root != leader_of_root) {
-                    if (leader_comm_rank == leader_root) {
-                        displs = static_cast<int*>(xbt_malloc(sizeof (int) * leader_comm_size));
-                        sendcnts = static_cast<int*>(xbt_malloc(sizeof (int) * leader_comm_size));
-                        sendcnts[0] = node_sizes[0] * nbytes;
-                        displs[0] = 0;
-
-                        for (i = 1; i < leader_comm_size; i++) {
-                            displs[i] =
-                                displs[i - 1] + node_sizes[i - 1] * nbytes;
-                            sendcnts[i] = node_sizes[i] * nbytes;
-                        }
-                    }
-                        Colls::scatterv(leader_scatter_buf, sendcnts, displs,
-                                      MPI_BYTE, tmp_buf, nbytes * local_size,
-                                      MPI_BYTE, leader_root, leader_comm);
-                } else {
-                    if (leader_comm_rank == leader_root) {
-                        displs = static_cast<int*>(xbt_malloc(sizeof (int) * leader_comm_size));
-                        sendcnts = static_cast<int*>(xbt_malloc(sizeof (int) * leader_comm_size));
-                        sendcnts[0] = node_sizes[0] * sendcnt;
-                        displs[0] = 0;
-
-                        for (i = 1; i < leader_comm_size; i++) {
-                            displs[i] =
-                                displs[i - 1] + node_sizes[i - 1] * sendcnt;
-                            sendcnts[i] = node_sizes[i] * sendcnt;
-                        }
-                    }
-                    Colls::scatterv(sendbuf, sendcnts, displs,
-                                              sendtype, tmp_buf,
-                                              nbytes * local_size, MPI_BYTE,
-                                              leader_root, leader_comm);
+          if (not comm->is_uniform()) {
+            int* displs   = NULL;
+            int* sendcnts = NULL;
+            int* node_sizes;
+            int i      = 0;
+            node_sizes = comm->get_non_uniform_map();
+
+            if (root != leader_of_root) {
+              if (leader_comm_rank == leader_root) {
+                displs      = static_cast<int*>(xbt_malloc(sizeof(int) * leader_comm_size));
+                sendcnts    = static_cast<int*>(xbt_malloc(sizeof(int) * leader_comm_size));
+                sendcnts[0] = node_sizes[0] * nbytes;
+                displs[0]   = 0;
+
+                for (i = 1; i < leader_comm_size; i++) {
+                  displs[i]   = displs[i - 1] + node_sizes[i - 1] * nbytes;
+                  sendcnts[i] = node_sizes[i] * nbytes;
                 }
-                if (leader_comm_rank == leader_root) {
-                    xbt_free(displs);
-                    xbt_free(sendcnts);
+              }
+              Colls::scatterv(leader_scatter_buf, sendcnts, displs, MPI_BYTE, tmp_buf, nbytes * local_size, MPI_BYTE,
+                              leader_root, leader_comm);
+            } else {
+              if (leader_comm_rank == leader_root) {
+                displs      = static_cast<int*>(xbt_malloc(sizeof(int) * leader_comm_size));
+                sendcnts    = static_cast<int*>(xbt_malloc(sizeof(int) * leader_comm_size));
+                sendcnts[0] = node_sizes[0] * sendcnt;
+                displs[0]   = 0;
+
+                for (i = 1; i < leader_comm_size; i++) {
+                  displs[i]   = displs[i - 1] + node_sizes[i - 1] * sendcnt;
+                  sendcnts[i] = node_sizes[i] * sendcnt;
                 }
+              }
+              Colls::scatterv(sendbuf, sendcnts, displs, sendtype, tmp_buf, nbytes * local_size, MPI_BYTE, leader_root,
+                              leader_comm);
+            }
+            if (leader_comm_rank == leader_root) {
+              xbt_free(displs);
+              xbt_free(sendcnts);
+            }
             } else {
                 if (leader_of_root != root) {
                     mpi_errno =
@@ -322,51 +317,46 @@ int Coll_scatter_mvapich2_two_level_binomial::scatter(void *sendbuf,
         }
 
         if (leader_comm_size > 1 && local_rank == 0) {
-            if (!comm->is_uniform()) {
-                int *displs = NULL;
-                int *sendcnts = NULL;
-                int *node_sizes;
-                int i = 0;
-                node_sizes = comm->get_non_uniform_map();
-
-                if (root != leader_of_root) {
-                    if (leader_comm_rank == leader_root) {
-                        displs = static_cast<int*>(xbt_malloc(sizeof (int) * leader_comm_size));
-                        sendcnts = static_cast<int*>(xbt_malloc(sizeof (int) * leader_comm_size));
-                        sendcnts[0] = node_sizes[0] * nbytes;
-                        displs[0] = 0;
-
-                        for (i = 1; i < leader_comm_size; i++) {
-                            displs[i] =
-                                displs[i - 1] + node_sizes[i - 1] * nbytes;
-                            sendcnts[i] = node_sizes[i] * nbytes;
-                        }
-                    }
-                        Colls::scatterv(leader_scatter_buf, sendcnts, displs,
-                                      MPI_BYTE, tmp_buf, nbytes * local_size,
-                                      MPI_BYTE, leader_root, leader_comm);
-                } else {
-                    if (leader_comm_rank == leader_root) {
-                        displs = static_cast<int*>(xbt_malloc(sizeof (int) * leader_comm_size));
-                        sendcnts = static_cast<int*>(xbt_malloc(sizeof (int) * leader_comm_size));
-                        sendcnts[0] = node_sizes[0] * sendcnt;
-                        displs[0] = 0;
-
-                        for (i = 1; i < leader_comm_size; i++) {
-                            displs[i] =
-                                displs[i - 1] + node_sizes[i - 1] * sendcnt;
-                            sendcnts[i] = node_sizes[i] * sendcnt;
-                        }
-                    }
-                    Colls::scatterv(sendbuf, sendcnts, displs,
-                                              sendtype, tmp_buf,
-                                              nbytes * local_size, MPI_BYTE,
-                                              leader_root, leader_comm);
+          if (not comm->is_uniform()) {
+            int* displs   = NULL;
+            int* sendcnts = NULL;
+            int* node_sizes;
+            int i      = 0;
+            node_sizes = comm->get_non_uniform_map();
+
+            if (root != leader_of_root) {
+              if (leader_comm_rank == leader_root) {
+                displs      = static_cast<int*>(xbt_malloc(sizeof(int) * leader_comm_size));
+                sendcnts    = static_cast<int*>(xbt_malloc(sizeof(int) * leader_comm_size));
+                sendcnts[0] = node_sizes[0] * nbytes;
+                displs[0]   = 0;
+
+                for (i = 1; i < leader_comm_size; i++) {
+                  displs[i]   = displs[i - 1] + node_sizes[i - 1] * nbytes;
+                  sendcnts[i] = node_sizes[i] * nbytes;
                 }
-                if (leader_comm_rank == leader_root) {
-                    xbt_free(displs);
-                    xbt_free(sendcnts);
+              }
+              Colls::scatterv(leader_scatter_buf, sendcnts, displs, MPI_BYTE, tmp_buf, nbytes * local_size, MPI_BYTE,
+                              leader_root, leader_comm);
+            } else {
+              if (leader_comm_rank == leader_root) {
+                displs      = static_cast<int*>(xbt_malloc(sizeof(int) * leader_comm_size));
+                sendcnts    = static_cast<int*>(xbt_malloc(sizeof(int) * leader_comm_size));
+                sendcnts[0] = node_sizes[0] * sendcnt;
+                displs[0]   = 0;
+
+                for (i = 1; i < leader_comm_size; i++) {
+                  displs[i]   = displs[i - 1] + node_sizes[i - 1] * sendcnt;
+                  sendcnts[i] = node_sizes[i] * sendcnt;
                 }
+              }
+              Colls::scatterv(sendbuf, sendcnts, displs, sendtype, tmp_buf, nbytes * local_size, MPI_BYTE, leader_root,
+                              leader_comm);
+            }
+            if (leader_comm_rank == leader_root) {
+              xbt_free(displs);
+              xbt_free(sendcnts);
+            }
             } else {
                 if (leader_of_root != root) {
                     mpi_errno =
index 9640369..9fc81d4 100644 (file)
@@ -159,7 +159,7 @@ Coll_scatter_ompi_binomial::scatter(void *sbuf, int scount,
 
     if (NULL != tempbuf)
       smpi_free_tmp_buffer(tempbuf);
-    //!FIXME : store the tree, as done in ompi, instead of calculating it each time ?
+    // not FIXME : store the tree, as done in ompi, instead of calculating it each time ?
     xbt_free(bmtree);
 
     return MPI_SUCCESS;
index cac0ea2..9afee14 100644 (file)
 
 //attempt to do a quick autotuning version of the collective,
 
-#define TRACE_AUTO_COLL(cat) if (TRACE_is_enabled()){\
-        type_t type = PJ_type_get_or_null (#cat, PJ_type_get_root());\
-         if (!type){\
-             type=PJ_type_event_new(#cat, PJ_type_get_root());\
-         }\
-         char cont_name[25];\
-         snprintf(cont_name,25, "rank-%d", smpi_process()->index());\
-         val_t value = PJ_value_get_or_new(Colls::mpi_coll_##cat##_description[i].name,"1.0 1.0 1.0", type);\
-         new NewEvent (SIMIX_get_clock(), PJ_container_get(cont_name), type, value);\
-      }
+#define TRACE_AUTO_COLL(cat)                                                                                           \
+  if (TRACE_is_enabled()) {                                                                                            \
+    type_t type = PJ_type_get_or_null(#cat, PJ_type_get_root());                                                       \
+    if (not type) {                                                                                                    \
+      type = PJ_type_event_new(#cat, PJ_type_get_root());                                                              \
+    }                                                                                                                  \
+    char cont_name[25];                                                                                                \
+    snprintf(cont_name, 25, "rank-%d", smpi_process()->index());                                                       \
+    val_t value = PJ_value_get_or_new(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0", type);               \
+    new NewEvent(SIMIX_get_clock(), PJ_container_get(cont_name), type, value);                                         \
+  }
 
-#define AUTOMATIC_COLL_BENCH(cat, ret, args, args2)\
-    ret Coll_ ## cat ## _automatic:: cat (COLL_UNPAREN args)\
-{\
-  double time1, time2, time_min=DBL_MAX;\
-  int min_coll=-1, global_coll=-1;\
-  int i;\
-  double buf_in, buf_out, max_min=DBL_MAX;\
-  for (i = 0; Colls::mpi_coll_##cat##_description[i].name; i++){\
-      if(!strcmp(Colls::mpi_coll_##cat##_description[i].name, "automatic"))continue;\
-      if(!strcmp(Colls::mpi_coll_##cat##_description[i].name, "default"))continue;\
-      Coll_barrier_default::barrier(comm);\
-      TRACE_AUTO_COLL(cat)\
-      time1 = SIMIX_get_clock();\
-      try {\
-      ((int (*) args)\
-          Colls::mpi_coll_##cat##_description[i].coll) args2 ;\
-      }\
-      catch (std::exception& ex) {\
-        continue;\
-      }\
-      time2 = SIMIX_get_clock();\
-      buf_out=time2-time1;\
-      Coll_reduce_default::reduce((void*)&buf_out,(void*)&buf_in, 1, MPI_DOUBLE, MPI_MAX, 0,comm );\
-      if(time2-time1<time_min){\
-          min_coll=i;\
-          time_min=time2-time1;\
-      }\
-      if(comm->rank()==0){\
-          if(buf_in<max_min){\
-              max_min=buf_in;\
-              global_coll=i;\
-          }\
-      }\
-  }\
-  if(comm->rank()==0){\
-      XBT_WARN("For rank 0, the quickest was %s : %f , but global was %s : %f at max",Colls::mpi_coll_##cat##_description[min_coll].name, time_min,Colls::mpi_coll_##cat##_description[global_coll].name, max_min);\
-  }else\
-  XBT_WARN("The quickest %s was %s on rank %d and took %f",#cat,Colls::mpi_coll_##cat##_description[min_coll].name, comm->rank(), time_min);\
-  return (min_coll!=-1)?MPI_SUCCESS:MPI_ERR_INTERN;\
-}
+#define AUTOMATIC_COLL_BENCH(cat, ret, args, args2)                                                                    \
+  ret Coll_##cat##_automatic::cat(COLL_UNPAREN args)                                                                   \
+  {                                                                                                                    \
+    double time1, time2, time_min = DBL_MAX;                                                                           \
+    int min_coll = -1, global_coll = -1;                                                                               \
+    int i;                                                                                                             \
+    double buf_in, buf_out, max_min = DBL_MAX;                                                                         \
+    for (i = 0; Colls::mpi_coll_##cat##_description[i].name; i++) {                                                    \
+      if (not strcmp(Colls::mpi_coll_##cat##_description[i].name, "automatic"))                                        \
+        continue;                                                                                                      \
+      if (not strcmp(Colls::mpi_coll_##cat##_description[i].name, "default"))                                          \
+        continue;                                                                                                      \
+      Coll_barrier_default::barrier(comm);                                                                             \
+      TRACE_AUTO_COLL(cat)                                                                                             \
+      time1 = SIMIX_get_clock();                                                                                       \
+      try {                                                                                                            \
+        ((int(*) args)Colls::mpi_coll_##cat##_description[i].coll) args2;                                              \
+      } catch (std::exception & ex) {                                                                                  \
+        continue;                                                                                                      \
+      }                                                                                                                \
+      time2   = SIMIX_get_clock();                                                                                     \
+      buf_out = time2 - time1;                                                                                         \
+      Coll_reduce_default::reduce((void*)&buf_out, (void*)&buf_in, 1, MPI_DOUBLE, MPI_MAX, 0, comm);                   \
+      if (time2 - time1 < time_min) {                                                                                  \
+        min_coll = i;                                                                                                  \
+        time_min = time2 - time1;                                                                                      \
+      }                                                                                                                \
+      if (comm->rank() == 0) {                                                                                         \
+        if (buf_in < max_min) {                                                                                        \
+          max_min     = buf_in;                                                                                        \
+          global_coll = i;                                                                                             \
+        }                                                                                                              \
+      }                                                                                                                \
+    }                                                                                                                  \
+    if (comm->rank() == 0) {                                                                                           \
+      XBT_WARN("For rank 0, the quickest was %s : %f , but global was %s : %f at max",                                 \
+               Colls::mpi_coll_##cat##_description[min_coll].name, time_min,                                           \
+               Colls::mpi_coll_##cat##_description[global_coll].name, max_min);                                        \
+    } else                                                                                                             \
+      XBT_WARN("The quickest %s was %s on rank %d and took %f", #cat,                                                  \
+               Colls::mpi_coll_##cat##_description[min_coll].name, comm->rank(), time_min);                            \
+    return (min_coll != -1) ? MPI_SUCCESS : MPI_ERR_INTERN;                                                            \
+  }
 
 namespace simgrid{
 namespace smpi{
index 546c2b7..6c48761 100644 (file)
@@ -214,7 +214,7 @@ int Coll_reduce_default::reduce(void *sendbuf, void *recvbuf, int count, MPI_Dat
   int rank = comm->rank();
   int size = comm->size();
   //non commutative case, use a working algo from openmpi
-  if(op != MPI_OP_NULL && !op->is_commutative()){
+  if (op != MPI_OP_NULL && not op->is_commutative()) {
     return Coll_reduce_ompi_basic_linear::reduce(sendtmpbuf, recvbuf, count, datatype, op, root, comm);
   }
 
@@ -237,7 +237,7 @@ int Coll_reduce_default::reduce(void *sendbuf, void *recvbuf, int count, MPI_Dat
     int index = 0;
     for (int src = 0; src < size; src++) {
       if (src != root) {
-         if (!smpi_process()->replaying())
+        if (not smpi_process()->replaying())
           tmpbufs[index] = xbt_malloc(count * dataext);
          else
            tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
index cc9cf96..7fd3910 100644 (file)
@@ -360,9 +360,8 @@ int Coll_reduce_mpich::reduce( void *sendbuf, void *recvbuf,
     while (pof2 <= communicator_size) pof2 <<= 1;
     pof2 >>= 1;
 
-
-    if ((count < pof2) || (message_size < 2048) || (op!=MPI_OP_NULL && !op->is_commutative())) {
-        return Coll_reduce_binomial::reduce (sendbuf, recvbuf, count, datatype, op, root, comm); 
+    if ((count < pof2) || (message_size < 2048) || (op != MPI_OP_NULL && not op->is_commutative())) {
+      return Coll_reduce_binomial::reduce(sendbuf, recvbuf, count, datatype, op, root, comm); 
     }
         return Coll_reduce_scatter_gather::reduce(sendbuf, recvbuf, count, datatype, op, root, comm/*, module,
                                                      segsize, max_requests*/);
@@ -442,26 +441,27 @@ int Coll_reduce_scatter_mpich::reduce_scatter( void *sbuf, void *rbuf,
     if( (op==MPI_OP_NULL || op->is_commutative()) &&  total_message_size > 524288) { 
         return Coll_reduce_scatter_mpich_pair::reduce_scatter (sbuf, rbuf, rcounts, 
                                                                     dtype, op, 
-                                                                    comm); 
-    }else if ((op!=MPI_OP_NULL && !op->is_commutative())) {
-        int is_block_regular = 1;
-        for (i = 0; i < (comm_size - 1); ++i) {
-            if (rcounts[i] != rcounts[i+1]) {
-                is_block_regular = 0;
-                break;
-            }
+                                                                    comm);
+    } else if ((op != MPI_OP_NULL && not op->is_commutative())) {
+      int is_block_regular = 1;
+      for (i = 0; i < (comm_size - 1); ++i) {
+        if (rcounts[i] != rcounts[i + 1]) {
+          is_block_regular = 0;
+          break;
         }
+      }
 
-        /* slightly retask pof2 to mean pof2 equal or greater, not always greater as it is above */
-        int pof2 = 1;
-        while (pof2 < comm_size) pof2 <<= 1;
+      /* slightly retask pof2 to mean pof2 equal or greater, not always greater as it is above */
+      int pof2 = 1;
+      while (pof2 < comm_size)
+        pof2 <<= 1;
 
-        if (pof2 == comm_size && is_block_regular) {
-            /* noncommutative, pof2 size, and block regular */
-            return Coll_reduce_scatter_mpich_noncomm::reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm);
-        }
+      if (pof2 == comm_size && is_block_regular) {
+        /* noncommutative, pof2 size, and block regular */
+        return Coll_reduce_scatter_mpich_noncomm::reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm);
+      }
 
-       return Coll_reduce_scatter_mpich_rdb::reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm);
+      return Coll_reduce_scatter_mpich_rdb::reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm);
     }else{      
        return Coll_reduce_scatter_mpich_rdb::reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm);
     }
index f9722a9..69b8625 100644 (file)
@@ -500,7 +500,7 @@ int Coll_bcast_mvapich2::bcast(void *buffer,
     if(comm->get_leaders_comm()==MPI_COMM_NULL){
       comm->init_smp();
     }
-    if(!mv2_bcast_thresholds_table)
+    if (not mv2_bcast_thresholds_table)
       init_mv2_bcast_tables_stampede();
     comm_size = comm->size();
     //rank = comm->rank();
@@ -601,23 +601,22 @@ int Coll_bcast_mvapich2::bcast(void *buffer,
         mv2_bcast_thresholds_table[range].is_two_level_bcast[range_threshold];
 #endif
      if (two_level_bcast == 1) {
-        if (!is_contig || !is_homogeneous) {
-            tmp_buf=(void *)smpi_get_tmp_sendbuffer(nbytes);
-
-/*            position = 0;*/
-/*            if (rank == root) {*/
-/*                mpi_errno =*/
-/*                    MPIR_Pack_impl(buffer, count, datatype, tmp_buf, nbytes, &position);*/
-/*                if (mpi_errno)*/
-/*                    MPIU_ERR_POP(mpi_errno);*/
-/*            }*/
+       if (not is_contig || not is_homogeneous) {
+         tmp_buf = (void*)smpi_get_tmp_sendbuffer(nbytes);
+
+         /*            position = 0;*/
+         /*            if (rank == root) {*/
+         /*                mpi_errno =*/
+         /*                    MPIR_Pack_impl(buffer, count, datatype, tmp_buf, nbytes, &position);*/
+         /*                if (mpi_errno)*/
+         /*                    MPIU_ERR_POP(mpi_errno);*/
+         /*            }*/
         }
 #ifdef CHANNEL_MRAIL_GEN2
         if ((mv2_enable_zcpy_bcast == 1) &&
-              (&MPIR_Pipelined_Bcast_Zcpy_MV2 == MV2_Bcast_function)) {  
-            if (!is_contig || !is_homogeneous) {
-                mpi_errno = MPIR_Pipelined_Bcast_Zcpy_MV2(tmp_buf, nbytes, MPI_BYTE,
-                                                 root, comm);
+              (&MPIR_Pipelined_Bcast_Zcpy_MV2 == MV2_Bcast_function)) {
+          if (not is_contig || not is_homogeneous) {
+            mpi_errno = MPIR_Pipelined_Bcast_Zcpy_MV2(tmp_buf, nbytes, MPI_BYTE, root, comm);
             } else { 
                 mpi_errno = MPIR_Pipelined_Bcast_Zcpy_MV2(buffer, count, datatype,
                                                  root, comm);
@@ -626,10 +625,8 @@ int Coll_bcast_mvapich2::bcast(void *buffer,
 #endif /* defined(CHANNEL_MRAIL_GEN2) */
         { 
             shmem_comm = comm->get_intra_comm();
-            if (!is_contig || !is_homogeneous) {
-                mpi_errno =
-                    MPIR_Bcast_tune_inter_node_helper_MV2(tmp_buf, nbytes, MPI_BYTE,
-                                                          root, comm);
+            if (not is_contig || not is_homogeneous) {
+              mpi_errno = MPIR_Bcast_tune_inter_node_helper_MV2(tmp_buf, nbytes, MPI_BYTE, root, comm);
             } else {
                 mpi_errno =
                     MPIR_Bcast_tune_inter_node_helper_MV2(buffer, count, datatype, root,
@@ -640,24 +637,22 @@ int Coll_bcast_mvapich2::bcast(void *buffer,
 
 
                     root = INTRA_NODE_ROOT;
-   
 
-                if (!is_contig || !is_homogeneous) {
-                    mpi_errno = MV2_Bcast_intra_node_function(tmp_buf, nbytes,
-                                                              MPI_BYTE, root, shmem_comm);
+                    if (not is_contig || not is_homogeneous) {
+                      mpi_errno = MV2_Bcast_intra_node_function(tmp_buf, nbytes, MPI_BYTE, root, shmem_comm);
                 } else {
                     mpi_errno = MV2_Bcast_intra_node_function(buffer, count,
                                                               datatype, root, shmem_comm);
 
                 }
-        } 
-/*        if (!is_contig || !is_homogeneous) {*/
-/*            if (rank != root) {*/
-/*                position = 0;*/
-/*                mpi_errno = MPIR_Unpack_impl(tmp_buf, nbytes, &position, buffer,*/
-/*                                             count, datatype);*/
-/*            }*/
-/*        }*/
+        }
+        /*        if (not is_contig || not is_homogeneous) {*/
+        /*            if (rank != root) {*/
+        /*                position = 0;*/
+        /*                mpi_errno = MPIR_Unpack_impl(tmp_buf, nbytes, &position, buffer,*/
+        /*                                             count, datatype);*/
+        /*            }*/
+        /*        }*/
     } else {
         /* We use Knomial for intra node */
         MV2_Bcast_intra_node_function = &MPIR_Knomial_Bcast_intra_node_MV2;
index 5c6bb3d..509f007 100644 (file)
@@ -255,11 +255,11 @@ int Coll_reduce_ompi::reduce( void *sendbuf, void *recvbuf,
      * If the operation is non commutative we currently have choice of linear 
      * or in-order binary tree algorithm.
      */
-    if(  (op!=MPI_OP_NULL) && !op->is_commutative() ) {
-        if ((communicator_size < 12) && (message_size < 2048)) {
-            return Coll_reduce_ompi_basic_linear::reduce (sendbuf, recvbuf, count, datatype, op, root, comm/*, module*/); 
-        } 
-        return Coll_reduce_ompi_in_order_binary::reduce (sendbuf, recvbuf, count, datatype, op, root, comm/*, module,
+    if ((op != MPI_OP_NULL) && not op->is_commutative()) {
+      if ((communicator_size < 12) && (message_size < 2048)) {
+        return Coll_reduce_ompi_basic_linear::reduce(sendbuf, recvbuf, count, datatype, op, root, comm /*, module*/);
+      }
+      return Coll_reduce_ompi_in_order_binary::reduce(sendbuf, recvbuf, count, datatype, op, root, comm /*, module,
                                                              0, max_requests*/); 
     }
 
@@ -355,11 +355,9 @@ int Coll_reduce_scatter_ompi::reduce_scatter( void *sbuf, void *rbuf,
         }
     }
 
-    if(  ((op!=MPI_OP_NULL) && !op->is_commutative()) || (zerocounts)) {
-        Coll_reduce_scatter_default::reduce_scatter (sbuf, rbuf, rcounts, 
-                                                                    dtype, op, 
-                                                                    comm); 
-        return MPI_SUCCESS;
+    if (((op != MPI_OP_NULL) && not op->is_commutative()) || (zerocounts)) {
+      Coll_reduce_scatter_default::reduce_scatter(sbuf, rbuf, rcounts, dtype, op, comm);
+      return MPI_SUCCESS;
     }
    
     total_message_size *= dsize;
index b589dc7..3a7525e 100644 (file)
@@ -151,7 +151,7 @@ static void cleanup_extra_data (instr_extra_data extra){
 
 void TRACE_internal_smpi_set_category (const char *category)
 {
-  if (!TRACE_smpi_is_enabled())
+  if (not TRACE_smpi_is_enabled())
     return;
 
   //declare category
@@ -167,7 +167,7 @@ void TRACE_internal_smpi_set_category (const char *category)
 
 const char *TRACE_internal_smpi_get_category ()
 {
-  if (!TRACE_smpi_is_enabled())
+  if (not TRACE_smpi_is_enabled())
     return nullptr;
 
   char processid[INSTR_DEFAULT_STR_SIZE];
@@ -189,7 +189,7 @@ void TRACE_smpi_release()
 
 void TRACE_smpi_init(int rank)
 {
-  if (!TRACE_smpi_is_enabled())
+  if (not TRACE_smpi_is_enabled())
     return;
 
   char str[INSTR_DEFAULT_STR_SIZE];
@@ -224,7 +224,7 @@ void TRACE_smpi_init(int rank)
 
 void TRACE_smpi_finalize(int rank)
 {
-  if (!TRACE_smpi_is_enabled())
+  if (not TRACE_smpi_is_enabled())
     return;
 
   char str[INSTR_DEFAULT_STR_SIZE];
@@ -235,9 +235,9 @@ void TRACE_smpi_finalize(int rank)
 
 void TRACE_smpi_collective_in(int rank, int root, const char *operation, instr_extra_data extra)
 {
-  if (!TRACE_smpi_is_enabled()) {
-      cleanup_extra_data(extra);
-      return;
+  if (not TRACE_smpi_is_enabled()) {
+    cleanup_extra_data(extra);
+    return;
   }
 
   char str[INSTR_DEFAULT_STR_SIZE];
@@ -251,7 +251,7 @@ void TRACE_smpi_collective_in(int rank, int root, const char *operation, instr_e
 
 void TRACE_smpi_collective_out(int rank, int root, const char *operation)
 {
-  if (!TRACE_smpi_is_enabled()) 
+  if (not TRACE_smpi_is_enabled())
     return;
 
   char str[INSTR_DEFAULT_STR_SIZE];
@@ -265,24 +265,24 @@ void TRACE_smpi_collective_out(int rank, int root, const char *operation)
 void TRACE_smpi_computing_init(int rank)
 {
  //first use, initialize the color in the trace
-  if (!TRACE_smpi_is_enabled() || !TRACE_smpi_is_computing()) 
-    return;
-
 char str[INSTR_DEFAULT_STR_SIZE];
 smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
 container_t container = PJ_container_get (str);
 type_t type = PJ_type_get ("MPI_STATE", container->type);
 const char *color = instr_find_color ("computing");
 val_t value = PJ_value_get_or_new ("computing", color, type);
 new PushStateEvent (SIMIX_get_clock(), container, type, value);
+ if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_computing())
+   return;
+
+ char str[INSTR_DEFAULT_STR_SIZE];
+ smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get(str);
type_t type           = PJ_type_get("MPI_STATE", container->type);
const char* color     = instr_find_color("computing");
val_t value           = PJ_value_get_or_new("computing", color, type);
new PushStateEvent(SIMIX_get_clock(), container, type, value);
 }
 
 void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
 {
   //do not forget to set the color first, otherwise this will explode
-  if (!TRACE_smpi_is_enabled()|| !TRACE_smpi_is_computing()) {
-      cleanup_extra_data(extra);
-      return;
+  if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_computing()) {
+    cleanup_extra_data(extra);
+    return;
   }
 
   char str[INSTR_DEFAULT_STR_SIZE];
@@ -295,7 +295,7 @@ void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
 
 void TRACE_smpi_computing_out(int rank)
 {
-  if (!TRACE_smpi_is_enabled()|| !TRACE_smpi_is_computing())
+  if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_computing())
     return;
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
@@ -307,7 +307,7 @@ void TRACE_smpi_computing_out(int rank)
 void TRACE_smpi_sleeping_init(int rank)
 {
   //first use, initialize the color in the trace
-  if (!TRACE_smpi_is_enabled() || !TRACE_smpi_is_sleeping())
+  if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_sleeping())
     return;
 
   char str[INSTR_DEFAULT_STR_SIZE];
@@ -322,9 +322,9 @@ void TRACE_smpi_sleeping_init(int rank)
 void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra)
 {
   //do not forget to set the color first, otherwise this will explode
-  if (!TRACE_smpi_is_enabled()|| !TRACE_smpi_is_sleeping()) {
-      cleanup_extra_data(extra);
-      return;
+  if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_sleeping()) {
+    cleanup_extra_data(extra);
+    return;
   }
 
   char str[INSTR_DEFAULT_STR_SIZE];
@@ -337,7 +337,7 @@ void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra)
 
 void TRACE_smpi_sleeping_out(int rank)
 {
-  if (!TRACE_smpi_is_enabled()|| !TRACE_smpi_is_sleeping())
+  if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_sleeping())
     return;
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
@@ -349,9 +349,9 @@ void TRACE_smpi_sleeping_out(int rank)
 void TRACE_smpi_testing_in(int rank, instr_extra_data extra)
 {
   //do not forget to set the color first, otherwise this will explode
-  if (!TRACE_smpi_is_enabled()) {
-      cleanup_extra_data(extra);
-      return;
+  if (not TRACE_smpi_is_enabled()) {
+    cleanup_extra_data(extra);
+    return;
   }
 
   char str[INSTR_DEFAULT_STR_SIZE];
@@ -364,7 +364,7 @@ void TRACE_smpi_testing_in(int rank, instr_extra_data extra)
 
 void TRACE_smpi_testing_out(int rank)
 {
-  if (!TRACE_smpi_is_enabled())
+  if (not TRACE_smpi_is_enabled())
     return;
   char str[INSTR_DEFAULT_STR_SIZE];
   smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
@@ -375,9 +375,9 @@ void TRACE_smpi_testing_out(int rank)
 
 void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation, instr_extra_data extra)
 {
-  if (!TRACE_smpi_is_enabled()) {
-      cleanup_extra_data(extra);
-      return;
+  if (not TRACE_smpi_is_enabled()) {
+    cleanup_extra_data(extra);
+    return;
   }
 
   char str[INSTR_DEFAULT_STR_SIZE];
@@ -391,7 +391,7 @@ void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation, instr_
 
 void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation)
 {
-  if (!TRACE_smpi_is_enabled())
+  if (not TRACE_smpi_is_enabled())
     return;
 
   char str[INSTR_DEFAULT_STR_SIZE];
@@ -404,7 +404,7 @@ void TRACE_smpi_ptp_out(int rank, int src, int dst, const char *operation)
 
 void TRACE_smpi_send(int rank, int src, int dst, int tag, int size)
 {
-  if (!TRACE_smpi_is_enabled())
+  if (not TRACE_smpi_is_enabled())
     return;
 
   char key[INSTR_DEFAULT_STR_SIZE] = {0};
@@ -420,7 +420,7 @@ void TRACE_smpi_send(int rank, int src, int dst, int tag, int size)
 
 void TRACE_smpi_recv(int rank, int src, int dst, int tag)
 {
-  if (!TRACE_smpi_is_enabled())
+  if (not TRACE_smpi_is_enabled())
     return;
 
   char key[INSTR_DEFAULT_STR_SIZE] = {0};
index 326f462..eff95bd 100644 (file)
@@ -73,13 +73,13 @@ int Colls::find_coll_description(s_mpi_coll_description_t * table, const char *n
 {
   char *name_list = nullptr;
   for (int i = 0; table[i].name; i++)
-    if (!strcmp(name, table[i].name)) {
+    if (not strcmp(name, table[i].name)) {
       if (strcmp(table[i].name,"default"))
         XBT_INFO("Switch to algorithm %s for collective %s",table[i].name,desc);
       return i;
     }
 
-  if (!table[0].name)
+  if (not table[0].name)
     xbt_die("No collective is valid for '%s'! This is a bug.",name);
   name_list = xbt_strdup(table[0].name);
   for (int i = 1; table[i].name; i++) {
index 213a822..39e5132 100644 (file)
@@ -79,7 +79,7 @@ int Comm::dup(MPI_Comm* newcomm){
   (*newcomm) = new  Comm(cp, this->topo());
   int ret = MPI_SUCCESS;
 
-  if(!attributes()->empty()){
+  if (not attributes()->empty()) {
     int flag;
     void* value_out;
     for(auto it : *attributes()){
index 49cf5a8..00eb043 100644 (file)
@@ -277,7 +277,7 @@ int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     count = sendcount < recvcount ? sendcount : recvcount;
 
     if(!(sendtype->flags() & DT_FLAG_DERIVED) && !(recvtype->flags() & DT_FLAG_DERIVED)) {
-      if(!smpi_process()->replaying()) 
+      if (not smpi_process()->replaying())
         memcpy(recvbuf, sendbuf, count);
     }
     else if (!(sendtype->flags() & DT_FLAG_DERIVED))
@@ -404,7 +404,7 @@ int Datatype::create_indexed(int count, int* block_lengths, int* indices, MPI_Da
   if(old_type->flags_ & DT_FLAG_DERIVED)
     contiguous=false;
 
-  if(!contiguous){
+  if (not contiguous) {
     *new_type = new Type_Indexed(size * old_type->size(),lb,ub,
                                  DT_FLAG_DERIVED|DT_FLAG_DATA, count, block_lengths, indices, old_type);
   }else{
@@ -438,7 +438,7 @@ int Datatype::create_hindexed(int count, int* block_lengths, MPI_Aint* indices,
   if (old_type->flags_ & DT_FLAG_DERIVED || lb!=0)
     contiguous=false;
 
-  if(!contiguous){
+  if (not contiguous) {
     *new_type = new Type_Hindexed(size * old_type->size(),lb,ub,
                                    DT_FLAG_DERIVED|DT_FLAG_DATA, count, block_lengths, indices, old_type);
   }else{
@@ -475,15 +475,15 @@ int Datatype::create_struct(int count, int* block_lengths, MPI_Aint* indices, MP
       forced_ub=true;
     }
 
-    if(!forced_lb && indices[i]+old_types[i]->lb()<lb) 
+    if (not forced_lb && indices[i] + old_types[i]->lb() < lb)
       lb = indices[i];
-    if(!forced_ub &&  indices[i]+block_lengths[i]*old_types[i]->ub()>ub)
+    if (not forced_ub && indices[i] + block_lengths[i] * old_types[i]->ub() > ub)
       ub = indices[i]+block_lengths[i]*old_types[i]->ub();
 
     if ( (i< count -1) && (indices[i]+block_lengths[i]*static_cast<int>(old_types[i]->size()) != indices[i+1]) )
       contiguous=false;
   }
-  if(!contiguous){
+  if (not contiguous) {
     *new_type = new Type_Struct(size, lb,ub, DT_FLAG_DERIVED|DT_FLAG_DATA, 
                                 count, block_lengths, indices, old_types);
   }else{
index 475688f..791b8da 100644 (file)
@@ -58,7 +58,7 @@ void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_
   SIMIX_function_register(name, code);
 
   static int already_called = 0;
-  if (!already_called) {
+  if (not already_called) {
     already_called = 1;
     for (auto& item : simgrid::s4u::host_list) {
       simgrid::s4u::Host* host = item.second;
index ff2da6f..afb5ebc 100644 (file)
@@ -238,7 +238,7 @@ void smpi_global_init()
 {
   MPI_Group group;
 
-  if (!MC_is_active()) {
+  if (not MC_is_active()) {
     global_timer = xbt_os_timer_new();
     xbt_os_walltimer_start(global_timer);
   }
@@ -246,7 +246,7 @@ void smpi_global_init()
   if (xbt_cfg_get_string("smpi/comp-adjustment-file")[0] != '\0') { 
     std::string filename {xbt_cfg_get_string("smpi/comp-adjustment-file")};
     std::ifstream fstream(filename);
-    if (!fstream.is_open()) {
+    if (not fstream.is_open()) {
       xbt_die("Could not open file %s. Does it exist?", filename.c_str());
     }
 
@@ -394,7 +394,7 @@ void smpi_global_destroy()
 
   MPI_COMM_WORLD = MPI_COMM_NULL;
 
-  if (!MC_is_active()) {
+  if (not MC_is_active()) {
     xbt_os_timer_free(global_timer);
   }
 
@@ -471,11 +471,12 @@ static void smpi_init_options(){
       smpi_cpu_threshold = DBL_MAX;
 
     char* val = xbt_cfg_get_string("smpi/shared-malloc");
-    if (!strcasecmp(val, "yes") || !strcmp(val, "1") || !strcasecmp(val, "on") || !strcasecmp(val, "global")) {
+    if (not strcasecmp(val, "yes") || not strcmp(val, "1") || not strcasecmp(val, "on") ||
+        not strcasecmp(val, "global")) {
       smpi_cfg_shared_malloc = shmalloc_global;
-    } else if (!strcasecmp(val, "local")) {
+    } else if (not strcasecmp(val, "local")) {
       smpi_cfg_shared_malloc = shmalloc_local;
-    } else if (!strcasecmp(val, "no") || !strcmp(val, "0") || !strcasecmp(val, "off")) {
+    } else if (not strcasecmp(val, "no") || not strcmp(val, "0") || not strcasecmp(val, "off")) {
       smpi_cfg_shared_malloc = shmalloc_none;
     } else {
       xbt_die("Invalid value '%s' for option smpi/shared-malloc. Possible values: 'on' or 'global', 'local', 'off'",
@@ -611,7 +612,7 @@ int smpi_main(const char* executable, int argc, char *argv[])
         if (handle == nullptr)
           xbt_die("dlopen failed: %s (errno: %d -- %s)", dlerror(), errno, strerror(errno));
         smpi_entry_point_type entry_point = smpi_resolve_function(handle);
-        if (!entry_point)
+        if (not entry_point)
           xbt_die("Could not resolve entry point");
 
         smpi_run_entry_point(entry_point, args);
@@ -626,7 +627,7 @@ int smpi_main(const char* executable, int argc, char *argv[])
     if (handle == nullptr)
       xbt_die("dlopen failed for %s: %s (errno: %d -- %s)", executable, dlerror(), errno, strerror(errno));
     smpi_entry_point_type entry_point = smpi_resolve_function(handle);
-    if (!entry_point)
+    if (not entry_point)
       xbt_die("main not found in %s", executable);
     // TODO, register the executable for SMPI privatization
 
index d371616..4b62f24 100644 (file)
@@ -114,12 +114,7 @@ int smpi_is_privatisation_file(char* file)
 void smpi_initialize_global_memory_segments()
 {
 
-#if !HAVE_PRIVATIZATION
-  smpi_privatize_global_variables=false;
-  xbt_die("You are trying to use privatization on a system that does not support it. Don't.");
-  return;
-#else
-
+#if HAVE_PRIVATIZATION
   smpi_get_executable_global_size();
 
   XBT_DEBUG ("bss+data segment found : size %d starting at %p", smpi_size_data_exe, smpi_start_data_exe );
@@ -182,6 +177,10 @@ Ask the Internet about tutorials on how to increase the files limit such as: htt
     smpi_privatisation_regions[i].file_descriptor = file_descriptor;
     smpi_privatisation_regions[i].address         = address;
   }
+#else /* ! HAVE_PRIVATIZATION */
+  smpi_privatize_global_variables = false;
+  xbt_die("You are trying to use privatization on a system that does not support it. Don't.");
+  return;
 #endif
 }
 
index 599c0c2..5023a2e 100644 (file)
@@ -245,7 +245,7 @@ void Op::apply(void *invec, void *inoutvec, int *len, MPI_Datatype datatype)
     smpi_switch_data_segment(smpi_process()->index());
   }
 
-  if(!smpi_process()->replaying() && *len > 0){
+  if (not smpi_process()->replaying() && *len > 0) {
     if(! is_fortran_op_)
       this->func_(invec, inoutvec, len, &datatype);
     else{
index 1d9a5f3..523d8e6 100644 (file)
@@ -626,8 +626,8 @@ int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag
       retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
       retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if (dst == MPI_PROC_NULL) {
       retval = MPI_SUCCESS;
   } else {
@@ -649,8 +649,8 @@ int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if (src == MPI_PROC_NULL) {
     retval = MPI_SUCCESS;
   } else {
@@ -672,8 +672,8 @@ int PMPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dst, int ta
     retval = MPI_ERR_ARG;
   } else if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if (dst == MPI_PROC_NULL) {
     retval = MPI_SUCCESS;
   } else {
@@ -754,8 +754,8 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MP
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
@@ -804,8 +804,8 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MP
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
@@ -852,8 +852,8 @@ int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, M
     retval = MPI_ERR_RANK;
   } else if ((count < 0)|| (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
@@ -899,8 +899,8 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
-      retval = MPI_ERR_TYPE;
+  } else if (not datatype->is_valid()) {
+    retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
@@ -924,7 +924,7 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI
     // the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
     if (status != MPI_STATUS_IGNORE) {
       src_traced = comm->group()->index(status->MPI_SOURCE);
-      if (!TRACE_smpi_view_internals()) {
+      if (not TRACE_smpi_view_internals()) {
         TRACE_smpi_recv(rank, src_traced, rank, tag);
       }
     }
@@ -949,7 +949,7 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf == nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if(tag < 0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
@@ -968,7 +968,7 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI
     }
     extra->send_size = count*dt_size_send;
     TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
-    if (!TRACE_smpi_view_internals()) {
+    if (not TRACE_smpi_view_internals()) {
       TRACE_smpi_send(rank, rank, dst_traced, tag,count*datatype->size());
     }
 
@@ -995,7 +995,7 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP
     retval = MPI_ERR_RANK;
   } else if ((count < 0) || (buf==nullptr && count > 0)) {
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()){
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
@@ -1035,7 +1035,7 @@ int PMPI_Sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype, int dst,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!sendtype->is_valid() || !recvtype->is_valid()) {
+  } else if (not sendtype->is_valid() || not recvtype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (src == MPI_PROC_NULL || dst == MPI_PROC_NULL) {
     simgrid::smpi::Status::empty(status);
@@ -1089,7 +1089,7 @@ int PMPI_Sendrecv_replace(void* buf, int count, MPI_Datatype datatype, int dst,
                           MPI_Comm comm, MPI_Status* status)
 {
   int retval = 0;
-  if (!datatype->is_valid()) {
+  if (not datatype->is_valid()) {
     return MPI_ERR_TYPE;
   } else if (count < 0) {
     return MPI_ERR_COUNT;
@@ -1388,7 +1388,7 @@ int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm c
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_ARG;
   } else {
     int rank        = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
@@ -1659,8 +1659,8 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (((comm->rank() == root) && (!sendtype->is_valid())) ||
-             ((recvbuf != MPI_IN_PLACE) && (!recvtype->is_valid()))) {
+  } else if (((comm->rank() == root) && (not sendtype->is_valid())) ||
+             ((recvbuf != MPI_IN_PLACE) && (not recvtype->is_valid()))) {
     retval = MPI_ERR_TYPE;
   } else if ((sendbuf == recvbuf) ||
       ((comm->rank()==root) && sendcount>0 && (sendbuf == nullptr))){
@@ -1758,7 +1758,7 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid() || op == MPI_OP_NULL) {
+  } else if (not datatype->is_valid() || op == MPI_OP_NULL) {
     retval = MPI_ERR_ARG;
   } else {
     int rank               = comm != MPI_COMM_NULL ? smpi_process()->index() : -1;
@@ -1789,7 +1789,7 @@ int PMPI_Reduce_local(void *inbuf, void *inoutbuf, int count, MPI_Datatype datat
   int retval = 0;
 
   smpi_bench_end();
-  if (!datatype->is_valid() || op == MPI_OP_NULL) {
+  if (not datatype->is_valid() || op == MPI_OP_NULL) {
     retval = MPI_ERR_ARG;
   } else {
     op->apply(inbuf, inoutbuf, &count, datatype);
@@ -1807,7 +1807,7 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1851,7 +1851,7 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MP
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1884,7 +1884,7 @@ int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1923,7 +1923,7 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datat
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -1976,7 +1976,7 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
 
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -2165,7 +2165,7 @@ int PMPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int *count)
 {
   if (status == nullptr || count == nullptr) {
     return MPI_ERR_ARG;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     return MPI_ERR_TYPE;
   } else {
     size_t size = datatype->size();
@@ -2627,7 +2627,7 @@ int PMPI_Get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else {
     int rank = smpi_process()->index();
@@ -2662,7 +2662,7 @@ int PMPI_Rget( void *origin_addr, int origin_count, MPI_Datatype origin_datatype
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if(request == nullptr){
     retval = MPI_ERR_REQUEST;
@@ -2698,7 +2698,7 @@ int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype,
   } else if ((origin_count < 0 || target_count < 0) ||
             (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else {
     int rank = smpi_process()->index();
@@ -2734,7 +2734,7 @@ int PMPI_Rput( void *origin_addr, int origin_count, MPI_Datatype origin_datatype
   } else if ((origin_count < 0 || target_count < 0) ||
             (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) || (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if(request == nullptr){
     retval = MPI_ERR_REQUEST;
@@ -2771,8 +2771,7 @@ int PMPI_Accumulate( void *origin_addr, int origin_count, MPI_Datatype origin_da
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) ||
-            (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -2809,8 +2808,7 @@ int PMPI_Raccumulate( void *origin_addr, int origin_count, MPI_Datatype origin_d
   } else if ((origin_count < 0 || target_count < 0) ||
              (origin_addr==nullptr && origin_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((!origin_datatype->is_valid()) ||
-            (!target_datatype->is_valid())) {
+  } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -2850,9 +2848,8 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win){
              (origin_addr==nullptr && origin_count > 0 && op != MPI_NO_OP) ||
              (result_addr==nullptr && result_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((origin_datatype!=MPI_DATATYPE_NULL && !origin_datatype->is_valid()) ||
-            (!target_datatype->is_valid())||
-            (!result_datatype->is_valid())) {
+  } else if ((origin_datatype != MPI_DATATYPE_NULL && not origin_datatype->is_valid()) ||
+             (not target_datatype->is_valid()) || (not result_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -2893,9 +2890,8 @@ MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request* request){
              (origin_addr==nullptr && origin_count > 0 && op != MPI_NO_OP) ||
              (result_addr==nullptr && result_count > 0)){
     retval = MPI_ERR_COUNT;
-  } else if ((origin_datatype!=MPI_DATATYPE_NULL && !origin_datatype->is_valid()) ||
-            (!target_datatype->is_valid())||
-            (!result_datatype->is_valid())) {
+  } else if ((origin_datatype != MPI_DATATYPE_NULL && not origin_datatype->is_valid()) ||
+             (not target_datatype->is_valid()) || (not result_datatype->is_valid())) {
     retval = MPI_ERR_TYPE;
   } else if (op == MPI_OP_NULL) {
     retval = MPI_ERR_OP;
@@ -2938,7 +2934,7 @@ int PMPI_Compare_and_swap(void *origin_addr, void *compare_addr,
     retval = MPI_ERR_ARG;
   } else if (origin_addr==nullptr || result_addr==nullptr || compare_addr==nullptr){
     retval = MPI_ERR_COUNT;
-  } else if (!datatype->is_valid()) {
+  } else if (not datatype->is_valid()) {
     retval = MPI_ERR_TYPE;
   } else {
     int rank = smpi_process()->index();
@@ -3503,7 +3499,7 @@ int PMPI_Info_get_valuelen( MPI_Info info, char *key, int *valuelen, int *flag){
 int PMPI_Unpack(void* inbuf, int incount, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
   if(incount<0 || outcount < 0 || inbuf==nullptr || outbuf==nullptr)
     return MPI_ERR_ARG;
-  if(!type->is_valid())
+  if (not type->is_valid())
     return MPI_ERR_TYPE;
   if(comm==MPI_COMM_NULL)
     return MPI_ERR_COMM;
@@ -3513,7 +3509,7 @@ int PMPI_Unpack(void* inbuf, int incount, int* position, void* outbuf, int outco
 int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
   if(incount<0 || outcount < 0|| inbuf==nullptr || outbuf==nullptr)
     return MPI_ERR_ARG;
-  if(!type->is_valid())
+  if (not type->is_valid())
     return MPI_ERR_TYPE;
   if(comm==MPI_COMM_NULL)
     return MPI_ERR_COMM;
@@ -3523,7 +3519,7 @@ int PMPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int out
 int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
   if(incount<0)
     return MPI_ERR_ARG;
-  if(!datatype->is_valid())
+  if (not datatype->is_valid())
     return MPI_ERR_TYPE;
   if(comm==MPI_COMM_NULL)
     return MPI_ERR_COMM;
index 558d0ec..c626761 100644 (file)
@@ -52,7 +52,7 @@ static void set_reqq_self(std::vector<MPI_Request> *mpi_request)
 //allocate a single buffer for all sends, growing it if needed
 void* smpi_get_tmp_sendbuffer(int size)
 {
-  if (!smpi_process()->replaying())
+  if (not smpi_process()->replaying())
     return xbt_malloc(size);
   if (sendbuffer_size<size){
     sendbuffer=static_cast<char*>(xbt_realloc(sendbuffer,size));
@@ -63,7 +63,7 @@ void* smpi_get_tmp_sendbuffer(int size)
 
 //allocate a single buffer for all recv
 void* smpi_get_tmp_recvbuffer(int size){
-  if (!smpi_process()->replaying())
+  if (not smpi_process()->replaying())
     return xbt_malloc(size);
   if (recvbuffer_size<size){
     recvbuffer=static_cast<char*>(xbt_realloc(recvbuffer,size));
@@ -73,7 +73,7 @@ void* smpi_get_tmp_recvbuffer(int size){
 }
 
 void smpi_free_tmp_buffer(void* buf){
-  if (!smpi_process()->replaying())
+  if (not smpi_process()->replaying())
     xbt_free(buf);
 }
 
@@ -236,7 +236,7 @@ static void action_send(const char *const *action)
   extra->dst = dst_traced;
   extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
   TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
-  if (!TRACE_smpi_view_internals())
+  if (not TRACE_smpi_view_internals())
     TRACE_smpi_send(rank, rank, dst_traced, 0, size*MPI_CURRENT_TYPE->size());
 
   Request::send(nullptr, size, MPI_CURRENT_TYPE, to , 0, MPI_COMM_WORLD);
@@ -267,7 +267,7 @@ static void action_Isend(const char *const *action)
   extra->dst = dst_traced;
   extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE, nullptr);
   TRACE_smpi_ptp_in(rank, rank, dst_traced, __FUNCTION__, extra);
-  if (!TRACE_smpi_view_internals())
+  if (not TRACE_smpi_view_internals())
     TRACE_smpi_send(rank, rank, dst_traced, 0, size*MPI_CURRENT_TYPE->size());
 
   MPI_Request request = Request::isend(nullptr, size, MPI_CURRENT_TYPE, to, 0,MPI_COMM_WORLD);
@@ -311,7 +311,7 @@ static void action_recv(const char *const *action) {
   Request::recv(nullptr, size, MPI_CURRENT_TYPE, from, 0, MPI_COMM_WORLD, &status);
 
   TRACE_smpi_ptp_out(rank, src_traced, rank, __FUNCTION__);
-  if (!TRACE_smpi_view_internals()) {
+  if (not TRACE_smpi_view_internals()) {
     TRACE_smpi_recv(rank, src_traced, rank, 0);
   }
 
@@ -964,7 +964,7 @@ void smpi_replay_main(int* argc, char*** argv)
   /* and now, finalize everything */
   /* One active process will stop. Decrease the counter*/
   XBT_DEBUG("There are %zu elements in reqq[*]", get_reqq_self()->size());
-  if (!get_reqq_self()->empty()){
+  if (not get_reqq_self()->empty()) {
     unsigned int count_requests=get_reqq_self()->size();
     MPI_Request requests[count_requests];
     MPI_Status status[count_requests];
index 1838d94..0126847 100644 (file)
@@ -397,7 +397,7 @@ void Request::start()
       refcount_++;
       if(!(old_type_->flags() & DT_FLAG_DERIVED)){
         oldbuf = buf_;
-        if (!process->replaying() && oldbuf != nullptr && size_!=0){
+        if (not process->replaying() && oldbuf != nullptr && size_ != 0) {
           if((smpi_privatize_global_variables != 0)
             && (static_cast<char*>(buf_) >= smpi_start_data_exe)
             && (static_cast<char*>(buf_) < smpi_start_data_exe + smpi_size_data_exe )){
@@ -462,13 +462,12 @@ void Request::start()
 
     // we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later
     real_size_=size_;
-    action_ = simcall_comm_isend(SIMIX_process_from_PID(src_+1), mailbox, size_, -1.0,
-                                         buf, real_size_, &match_send,
-                         &xbt_free_f, // how to free the userdata if a detached send fails
-                         !process->replaying() ? smpi_comm_copy_data_callback
-                         : &smpi_comm_null_copy_buffer_callback, this,
-                         // detach if msg size < eager/rdv switch limit
-                         detached_);
+    action_   = simcall_comm_isend(
+        SIMIX_process_from_PID(src_ + 1), mailbox, size_, -1.0, buf, real_size_, &match_send,
+        &xbt_free_f, // how to free the userdata if a detached send fails
+        not process->replaying() ? smpi_comm_copy_data_callback : &smpi_comm_null_copy_buffer_callback, this,
+        // detach if msg size < eager/rdv switch limit
+        detached_);
     XBT_DEBUG("send simcall posted");
 
     /* FIXME: detached sends are not traceable (action_ == nullptr) */
@@ -559,7 +558,7 @@ int Request::testany(int count, MPI_Request requests[], int *index, MPI_Status *
        map.push_back(i);
     }
   }
-  if(!map.empty()) {
+  if (not map.empty()) {
     //multiplier to the sleeptime, to increase speed of execution, each failed testany will increase it
     static int nsleeps = 1;
     if(smpi_test_sleep > 0) 
@@ -691,9 +690,9 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status)
 
 // FIXME Handle the case of a partial shared malloc.
     if (((req->flags_ & ACCUMULATE) != 0) ||
-        (datatype->flags() & DT_FLAG_DERIVED)) { // && (!smpi_is_shared(req->old_buf_))){
+        (datatype->flags() & DT_FLAG_DERIVED)) { // && (not smpi_is_shared(req->old_buf_))){
 
-      if (!smpi_process()->replaying()){
+      if (not smpi_process()->replaying()) {
         if( smpi_privatize_global_variables != 0 && (static_cast<char*>(req->old_buf_) >= smpi_start_data_exe)
             && ((char*)req->old_buf_ < smpi_start_data_exe + smpi_size_data_exe )){
             XBT_VERB("Privatization : We are unserializing to a zone in global memory  Switch data segment ");
@@ -856,7 +855,7 @@ int Request::waitall(int count, MPI_Request requests[], MPI_Status status[])
     }
   }
 
-  if (!accumulates.empty()) {
+  if (not accumulates.empty()) {
     std::sort(accumulates.begin(), accumulates.end(), sort_accumulates);
     for (auto req : accumulates) {
       finish_wait(&req, status);
index c72dad5..d1b16a3 100644 (file)
@@ -226,8 +226,9 @@ void* smpi_shared_malloc_partial(size_t size, size_t* shared_block_offsets, int
   char *huge_page_mount_point = xbt_cfg_get_string("smpi/shared-malloc-hugepage");
   bool use_huge_page = huge_page_mount_point[0] != '\0';
 #ifndef MAP_HUGETLB /* If the system header don't define that mmap flag */
-    xbt_assert(!use_huge_page, "Huge pages are not available on your system, you cannot use the smpi/shared-malloc-hugepage option.");
-    use_huge_page = 0;
+  xbt_assert(not use_huge_page,
+             "Huge pages are not available on your system, you cannot use the smpi/shared-malloc-hugepage option.");
+  use_huge_page = 0;
 #endif
   smpi_shared_malloc_blocksize = static_cast<unsigned long>(xbt_cfg_get_double("smpi/shared-malloc-blocksize"));
   void *mem, *allocated_ptr;
index 0a8b280..7d26e57 100644 (file)
@@ -24,7 +24,7 @@ void smpi_register_static(void* arg, void_f_pvoid_t free_fn) {
 }
 
 void smpi_free_static() {
-  while (!registered_static_variables_stack.empty()) {
+  while (not registered_static_variables_stack.empty()) {
     s_smpi_static_t elm = registered_static_variables_stack.top();
     elm.free_fn(elm.ptr);
     registered_static_variables_stack.pop();
index 551615a..48e0d36 100644 (file)
@@ -137,7 +137,7 @@ void HostImpl::getAttachedStorageList(std::vector<const char*>* storages)
     if (xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) {
       simgrid::surf::Storage* storage = static_cast<simgrid::surf::Storage*>(
           xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
-      if (!strcmp(static_cast<const char*>(storage->attach_), piface_->cname())) {
+      if (not strcmp(static_cast<const char*>(storage->attach_), piface_->cname())) {
         storages->push_back(storage->cname());
       }
     }
@@ -196,7 +196,7 @@ Action* HostImpl::write(surf_file_t fd, sg_size_t size)
 
 int HostImpl::unlink(surf_file_t fd)
 {
-  if (!fd) {
+  if (not fd) {
     XBT_WARN("No such file descriptor. Impossible to unlink");
     return -1;
   } else {
@@ -267,7 +267,7 @@ int HostImpl::fileSeek(surf_file_t fd, sg_offset_t offset, int origin)
 int HostImpl::fileMove(surf_file_t fd, const char* fullpath)
 {
   /* Check if the new full path is on the same mount point */
-  if (!strncmp((const char*)fd->mount, fullpath, strlen(fd->mount))) {
+  if (not strncmp((const char*)fd->mount, fullpath, strlen(fd->mount))) {
     std::map<std::string, sg_size_t*>* content = findStorageOnMountList(fd->mount)->content_;
     if (content->find(fd->name) != content->end()) { // src file exists
       sg_size_t* psize     = content->at(std::string(fd->name));
index 0683cc3..2eda708 100644 (file)
@@ -24,14 +24,14 @@ const char *PropertyHolder::getProperty(const char*key) {
 
 /** @brief Change the value of a given key in the property set */
 void PropertyHolder::setProperty(const char*key, const char*value) {
-  if (!properties_)
+  if (not properties_)
     properties_ = xbt_dict_new_homogeneous(xbt_free_f);
   xbt_dict_set(properties_, key, xbt_strdup(value), nullptr);
 }
 
 /** @brief Return the whole set of properties. Don't mess with it, dude! */
 xbt_dict_t PropertyHolder::getProperties() {
-  if (!properties_)
+  if (not properties_)
     properties_ = xbt_dict_new_homogeneous(xbt_free_f);
   return properties_;
 }
index 8c11636..5bf8fe0 100644 (file)
@@ -16,11 +16,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu_cas, surf_cpu, "Logging specific to the
  *********/
 void surf_cpu_model_init_Cas01()
 {
-  xbt_assert(!surf_cpu_model_pm);
-  xbt_assert(!surf_cpu_model_vm);
+  xbt_assert(not surf_cpu_model_pm);
+  xbt_assert(not surf_cpu_model_vm);
 
   char *optim = xbt_cfg_get_string("cpu/optim");
-  if (!strcmp(optim, "TI")) {
+  if (not strcmp(optim, "TI")) {
     surf_cpu_model_init_ti();
     return;
   }
@@ -40,10 +40,10 @@ CpuCas01Model::CpuCas01Model() : simgrid::surf::CpuModel()
   char *optim = xbt_cfg_get_string("cpu/optim");
   bool select = xbt_cfg_get_boolean("cpu/maxmin-selective-update");
 
-  if (!strcmp(optim, "Full")) {
+  if (not strcmp(optim, "Full")) {
     updateMechanism_ = UM_FULL;
     selectiveUpdate_ = select;
-  } else if (!strcmp(optim, "Lazy")) {
+  } else if (not strcmp(optim, "Lazy")) {
     updateMechanism_ = UM_LAZY;
     selectiveUpdate_ = true;
     xbt_assert(select || (xbt_cfg_is_default_value("cpu/maxmin-selective-update")),
index e3b612a..16f0c64 100644 (file)
@@ -255,7 +255,7 @@ CpuTiTgmr::CpuTiTgmr(tmgr_trace_t speedTrace, double value) :
   trace_ = 0;
 
 /* no availability file, fixed trace */
-  if (!speedTrace) {
+  if (not speedTrace) {
     type_ = TRACE_FIXED;
     value_ = value;
     XBT_DEBUG("No availability trace. Constant value = %f", value);
@@ -320,8 +320,8 @@ int CpuTiTrace::binarySearch(double *array, double a, int low, int high)
 
 void surf_cpu_model_init_ti()
 {
-  xbt_assert(!surf_cpu_model_pm,"CPU model already initialized. This should not happen.");
-  xbt_assert(!surf_cpu_model_vm,"CPU model already initialized. This should not happen.");
+  xbt_assert(not surf_cpu_model_pm, "CPU model already initialized. This should not happen.");
+  xbt_assert(not surf_cpu_model_vm, "CPU model already initialized. This should not happen.");
 
   surf_cpu_model_pm = new simgrid::surf::CpuTiModel();
   all_existing_models->push_back(surf_cpu_model_pm);
@@ -560,7 +560,7 @@ void CpuTi::updateActionsFinishTime(double now)
 
 bool CpuTi::isUsed()
 {
-  return !actionSet_->empty();
+  return not actionSet_->empty();
 }
 
 double CpuTi::getAvailableSpeed()
@@ -649,7 +649,7 @@ CpuAction *CpuTi::sleep(double duration)
 void CpuTi::modified(bool modified){
   CpuTiList* modifiedCpu = static_cast<CpuTiModel*>(model())->modifiedCpu_;
   if (modified) {
-    if (!cpu_ti_hook.is_linked()) {
+    if (not cpu_ti_hook.is_linked()) {
       modifiedCpu->push_back(*this);
     }
   } else {
@@ -684,7 +684,7 @@ void CpuTiAction::setState(Action::State state)
 int CpuTiAction::unref()
 {
   refcount_--;
-  if (!refcount_) {
+  if (not refcount_) {
     if (action_hook.is_linked())
       getStateSet()->erase(getStateSet()->iterator_to(*this));
     /* remove from action_set */
index 270a399..3555498 100644 (file)
@@ -100,9 +100,9 @@ void bottleneck_solve(lmm_system_t sys)
           nb++;
       }
       XBT_DEBUG("\tThere are %d variables", nb);
-      if (nb > 0 && !cnst->sharing_policy)
+      if (nb > 0 && not cnst->sharing_policy)
         nb = 1;
-      if (!nb) {
+      if (not nb) {
         cnst->remaining = 0.0;
         cnst->usage = cnst->remaining;
         xbt_swag_remove(cnst, cnst_list);
@@ -147,7 +147,7 @@ void bottleneck_solve(lmm_system_t sys)
           cnst->usage = MIN(cnst->usage, elem->value * elem->variable->mu);
         }
       }
-      if (!cnst->sharing_policy) {
+      if (not cnst->sharing_policy) {
         XBT_DEBUG("\tUpdate constraint %p (%g) by %g", cnst, cnst->remaining, cnst->usage);
 
         double_update(&(cnst->remaining), cnst->usage, sg_maxmin_precision);
index 0cac861..d73ddac 100644 (file)
@@ -74,7 +74,7 @@ static void linkContainers (container_t src, container_t dst, xbt_dict_t filter)
 
   //find common father
   container_t father = lowestCommonAncestor (src, dst);
-  if (!father){
+  if (not father) {
     xbt_die ("common father unknown, this is a tracing problem");
   }
 
@@ -127,12 +127,12 @@ static void linkContainers (container_t src, container_t dst, xbt_dict_t filter)
 
 static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t container, xbt_dict_t filter)
 {
-  if (!TRACE_platform_topology()){
+  if (not TRACE_platform_topology()) {
     XBT_DEBUG("Graph extraction disabled by user.");
     return;
   }
   XBT_DEBUG("Graph extraction for NetZone = %s", netzone->name());
-  if (!netzone->children()->empty()) {
+  if (not netzone->children()->empty()) {
     //bottom-up recursion
     for (auto nz_son : *netzone->children()) {
       container_t child_container = static_cast<container_t>(xbt_dict_get(container->children, nz_son->name()));
@@ -176,7 +176,7 @@ void sg_instr_AS_begin(sg_platf_AS_cbarg_t AS)
       type_t mpi = PJ_type_get_or_null ("MPI", root->type);
       if (mpi == nullptr){
         mpi = PJ_type_container_new("MPI", root->type);
-        if (!TRACE_smpi_is_grouped())
+        if (not TRACE_smpi_is_grouped())
           PJ_type_state_new ("MPI_STATE", mpi);
         PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
       }
@@ -318,7 +318,7 @@ void instr_routing_define_callbacks ()
 {
   //always need the call backs to ASes (we need only the root AS),
   //to create the rootContainer and the rootType properly
-  if (!TRACE_is_enabled() || !TRACE_needs_platform())
+  if (not TRACE_is_enabled() || not TRACE_needs_platform())
     return;
   simgrid::s4u::Link::onCreation.connect(instr_routing_parse_start_link);
   simgrid::s4u::onPlatformCreated.connect(instr_routing_parse_end_platform);
@@ -329,17 +329,17 @@ void instr_routing_define_callbacks ()
  */
 static void recursiveNewVariableType (const char *new_typename, const char *color, type_t root)
 {
-  if (!strcmp (root->name, "HOST")){
+  if (not strcmp(root->name, "HOST")) {
     char tnstr[INSTR_DEFAULT_STR_SIZE];
     snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "p%s", new_typename);
     PJ_type_variable_new (tnstr, color, root);
   }
-  if (!strcmp (root->name, "MSG_VM")){
+  if (not strcmp(root->name, "MSG_VM")) {
     char tnstr[INSTR_DEFAULT_STR_SIZE];
     snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "p%s", new_typename);
     PJ_type_variable_new (tnstr, color, root);
   }
if (!strcmp (root->name, "LINK")){
 if (not strcmp(root->name, "LINK")) {
     char tnstr[INSTR_DEFAULT_STR_SIZE];
     snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "b%s", new_typename);
     PJ_type_variable_new (tnstr, color, root);
@@ -359,7 +359,7 @@ void instr_new_variable_type (const char *new_typename, const char *color)
 
 static void recursiveNewUserVariableType (const char *father_type, const char *new_typename, const char *color, type_t root)
 {
-  if (!strcmp (root->name, father_type)){
+  if (not strcmp(root->name, father_type)) {
     PJ_type_variable_new (new_typename, color, root);
   }
   xbt_dict_cursor_t cursor = nullptr;
@@ -377,7 +377,7 @@ void instr_new_user_variable_type  (const char *father_type, const char *new_typ
 
 static void recursiveNewUserStateType (const char *father_type, const char *new_typename, type_t root)
 {
-  if (!strcmp (root->name, father_type)){
+  if (not strcmp(root->name, father_type)) {
     PJ_type_state_new (new_typename, root);
   }
   xbt_dict_cursor_t cursor = nullptr;
@@ -395,7 +395,7 @@ void instr_new_user_state_type (const char *father_type, const char *new_typenam
 
 static void recursiveNewValueForUserStateType (const char *type_name, const char *value, const char *color, type_t root)
 {
-  if (!strcmp (root->name, type_name)){
+  if (not strcmp(root->name, type_name)) {
     PJ_value_new (value, color, root);
   }
   xbt_dict_cursor_t cursor = nullptr;
@@ -421,7 +421,7 @@ int instr_platform_traced ()
 static void recursiveXBTGraphExtraction(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges, sg_netzone_t netzone,
                                         container_t container)
 {
-  if (!netzone->children()->empty()) {
+  if (not netzone->children()->empty()) {
     //bottom-up recursion
     for (auto netzone_child : *netzone->children()) {
       container_t child_container = static_cast<container_t>(xbt_dict_get(container->children, netzone_child->name()));
index 801036a..df986ab 100644 (file)
@@ -39,11 +39,11 @@ void TRACE_surf_link_set_bandwidth(double date, const char *resource, double ban
 
 void TRACE_surf_action(surf_action_t surf_action, const char *category)
 {
-  if (!TRACE_is_enabled())
+  if (not TRACE_is_enabled())
     return;
-  if (!TRACE_categorized ())
+  if (not TRACE_categorized())
     return;
-  if (!category)
+  if (not category)
     return;
 
   surf_action->setCategory(category);
index 90a51f7..edc5cd4 100644 (file)
@@ -68,7 +68,7 @@ static int __check_feasible(xbt_swag_t cnst_list, xbt_swag_t var_list, int warn)
 
   xbt_swag_foreach(_var, var_list) {
     var = static_cast<lmm_variable_t>(_var);
-    if (!var->weight)
+    if (not var->weight)
       break;
     if (var->bound < 0)
       continue;
@@ -124,7 +124,7 @@ static double dual_objective(xbt_swag_t var_list, xbt_swag_t cnst_list)
     var = static_cast<lmm_variable_t>(_var);
     double sigma_i = 0.0;
 
-    if (!var->weight)
+    if (not var->weight)
       break;
 
     for (int j = 0; j < var->cnsts_number; j++)
@@ -202,29 +202,29 @@ void lagrange_solve(lmm_system_t sys)
   i = 0;
   xbt_swag_foreach(_var, var_list) {
   var = static_cast<lmm_variable_t>(_var);
-    if (!var->weight)
-      var->value = 0.0;
-    else {
-      int nb = 0;
-      if (var->bound < 0.0) {
-        XBT_DEBUG("#### NOTE var(%d) is a boundless variable", i);
-        var->mu = -1.0;
-        var->value = new_value(var);
-      } else {
-        var->mu = 1.0;
-        var->new_mu = 2.0;
-        var->value = new_value(var);
-      }
-      XBT_DEBUG("#### var(%p) ->weight :  %e", var, var->weight);
-      XBT_DEBUG("#### var(%p) ->mu :  %e", var, var->mu);
-      XBT_DEBUG("#### var(%p) ->weight: %e", var, var->weight);
-      XBT_DEBUG("#### var(%p) ->bound: %e", var, var->bound);
-      for (i = 0; i < var->cnsts_number; i++) {
-        if (var->cnsts[i].value ==   0.0)
-          nb++;
-      }
-      if (nb == var->cnsts_number)
-        var->value = 1.0;
+  if (not var->weight)
+    var->value = 0.0;
+  else {
+    int nb = 0;
+    if (var->bound < 0.0) {
+      XBT_DEBUG("#### NOTE var(%d) is a boundless variable", i);
+      var->mu    = -1.0;
+      var->value = new_value(var);
+    } else {
+      var->mu     = 1.0;
+      var->new_mu = 2.0;
+      var->value  = new_value(var);
+    }
+    XBT_DEBUG("#### var(%p) ->weight :  %e", var, var->weight);
+    XBT_DEBUG("#### var(%p) ->mu :  %e", var, var->mu);
+    XBT_DEBUG("#### var(%p) ->weight: %e", var, var->weight);
+    XBT_DEBUG("#### var(%p) ->bound: %e", var, var->bound);
+    for (i = 0; i < var->cnsts_number; i++) {
+      if (var->cnsts[i].value == 0.0)
+        nb++;
+    }
+    if (nb == var->cnsts_number)
+      var->value = 1.0;
     }
   }
 
@@ -240,7 +240,7 @@ void lagrange_solve(lmm_system_t sys)
     /* Improve the value of mu_i */
     xbt_swag_foreach(_var, var_list) {
       var = static_cast<lmm_variable_t>(_var);
-      if (!var->weight)
+      if (not var->weight)
         break;
       if (var->bound >= 0) {
         XBT_DEBUG("Working on var (%p)", var);
@@ -294,10 +294,10 @@ void lagrange_solve(lmm_system_t sys)
     if (!__check_feasible(cnst_list, var_list, 0))
       overall_modification = 1.0;
     XBT_DEBUG("Iteration %d: overall_modification : %f", iteration, overall_modification);
-/*     if(!dual_updated) { */
-/*       XBT_WARN("Could not improve the convergence at iteration %d. Drop it!",iteration); */
-/*       break; */
-/*     } */
+    /*     if(not dual_updated) { */
+    /*       XBT_WARN("Could not improve the convergence at iteration %d. Drop it!",iteration); */
+    /*       break; */
+    /*     } */
   }
 
   __check_feasible(cnst_list, var_list, 1);
index 99fc2a1..f92f6e8 100644 (file)
@@ -111,7 +111,7 @@ void lmm_system_free(lmm_system_t sys)
   lmm_variable_t var = nullptr;
   lmm_constraint_t cnst = nullptr;
 
-  if (!sys)
+  if (not sys)
     return;
 
   while ((var = (lmm_variable_t) extract_variable(sys))) {
@@ -149,7 +149,7 @@ static inline void lmm_variable_remove(lmm_system_t sys, lmm_variable_t var)
     xbt_swag_remove(elem, &(elem->constraint->active_element_set));
     nelements=xbt_swag_size(&(elem->constraint->enabled_element_set)) +
               xbt_swag_size(&(elem->constraint->disabled_element_set));
-    if (!nelements)
+    if (not nelements)
       make_constraint_inactive(sys, elem->constraint);
     else
       lmm_on_disabled_var(sys,elem->constraint);
@@ -248,9 +248,10 @@ int lmm_constraint_sharing_policy(lmm_constraint_t cnst)
  */
 inline void lmm_constraint_free(lmm_system_t sys,lmm_constraint_t cnst)
 {
-  xbt_assert(!xbt_swag_size(&(cnst->active_element_set)),"Removing constraint but it still has active elements");
-  xbt_assert(!xbt_swag_size(&(cnst->enabled_element_set)),"Removing constraint but it still has enabled elements");
-  xbt_assert(!xbt_swag_size(&(cnst->disabled_element_set)),"Removing constraint but it still has disabled elements");
+  xbt_assert(not xbt_swag_size(&(cnst->active_element_set)), "Removing constraint but it still has active elements");
+  xbt_assert(not xbt_swag_size(&(cnst->enabled_element_set)), "Removing constraint but it still has enabled elements");
+  xbt_assert(not xbt_swag_size(&(cnst->disabled_element_set)),
+             "Removing constraint but it still has disabled elements");
   remove_constraint(sys, cnst);
   lmm_cnst_free(sys, cnst);
 }
@@ -353,7 +354,7 @@ void lmm_shrink(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var)
     }
   }
 
-  if (!found) {
+  if (not found) {
     XBT_DEBUG("cnst %p is not found in var %p", cnst, var);
     return;
   }
@@ -419,7 +420,7 @@ void lmm_expand(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, dou
       lmm_on_disabled_var(sys,var->cnsts[i].constraint);
     value=0;
     var->staged_weight=weight;
-    xbt_assert(!var->weight);
+    xbt_assert(not var->weight);
   }
 
   xbt_assert(var->cnsts_number < var->cnsts_size, "Too much constraints");
@@ -436,7 +437,7 @@ void lmm_expand(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, dou
   } else
     xbt_swag_insert_at_tail(elem, &(elem->constraint->disabled_element_set));
 
-  if(!sys->selective_update_active) {
+  if (not sys->selective_update_active) {
     make_constraint_active(sys, cnst);
   } else if(elem->value>0 || var->weight >0) {
     make_constraint_active(sys, cnst);
@@ -479,7 +480,7 @@ void lmm_expand_add(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var,
         for (j = 0; j < var->cnsts_number; j++)
           lmm_on_disabled_var(sys,var->cnsts[j].constraint);
         var->staged_weight=weight;
-        xbt_assert(!var->weight);
+        xbt_assert(not var->weight);
       }
       lmm_increase_concurrency(&var->cnsts[i]);
     }
@@ -678,15 +679,15 @@ void lmm_print(lmm_system_t sys)
 
     buf = buf + "0) <= " + std::to_string(cnst->bound) + " ('" + std::to_string(cnst->id_int) + "')";
 
-    if (!cnst->sharing_policy) {
+    if (not cnst->sharing_policy) {
       buf += " [MAX-Constraint]";
     }
     XBT_DEBUG("%s", buf.c_str());
     buf.clear();
-    xbt_assert(!double_positive(sum - cnst->bound, cnst->bound*sg_maxmin_precision),
-        "Incorrect value (%f is not smaller than %f): %g", sum, cnst->bound, sum - cnst->bound);
-       //if(double_positive(sum - cnst->bound, cnst->bound*sg_maxmin_precision))
-       //XBT_ERROR("Incorrect value (%f is not smaller than %f): %g",sum, cnst->bound, sum - cnst->bound);
+    xbt_assert(not double_positive(sum - cnst->bound, cnst->bound * sg_maxmin_precision),
+               "Incorrect value (%f is not smaller than %f): %g", sum, cnst->bound, sum - cnst->bound);
+    // if(double_positive(sum - cnst->bound, cnst->bound*sg_maxmin_precision))
+    // XBT_ERROR("Incorrect value (%f is not smaller than %f): %g",sum, cnst->bound, sum - cnst->bound);
   }
 
   XBT_DEBUG("Variables");
@@ -695,8 +696,8 @@ void lmm_print(lmm_system_t sys)
   var = (lmm_variable_t)_var;
     if (var->bound > 0) {
       XBT_DEBUG("'%d'(%f) : %f (<=%f)", var->id_int, var->weight, var->value, var->bound);
-      xbt_assert(!double_positive(var->value - var->bound, var->bound*sg_maxmin_precision),
-                  "Incorrect value (%f is not smaller than %f", var->value, var->bound);
+      xbt_assert(not double_positive(var->value - var->bound, var->bound * sg_maxmin_precision),
+                 "Incorrect value (%f is not smaller than %f", var->value, var->bound);
     } else {
       XBT_DEBUG("'%d'(%f) : %f", var->id_int, var->weight, var->value);
     }
@@ -750,7 +751,7 @@ void lmm_solve(lmm_system_t sys)
     /* INIT: Collect constraints that actually need to be saturated (i.e remaining  and usage are strictly positive)
      * into cnst_light_tab. */
     cnst->remaining = cnst->bound;
-    if (!double_positive(cnst->remaining, cnst->bound*sg_maxmin_precision))
+    if (not double_positive(cnst->remaining, cnst->bound * sg_maxmin_precision))
       continue;
     cnst->usage = 0;
     elem_list = &(cnst->enabled_element_set);
@@ -765,7 +766,7 @@ void lmm_solve(lmm_system_t sys)
 
         make_elem_active(elem);
         simgrid::surf::Action *action = static_cast<simgrid::surf::Action*>(elem->variable->id);
-        if (sys->keep_track && !action->is_linked())
+        if (sys->keep_track && not action->is_linked())
           sys->keep_track->push_back(*action);
       }
     }
@@ -841,8 +842,8 @@ void lmm_solve(lmm_system_t sys)
           double_update(&(cnst->remaining),  elem->value * var->value, cnst->bound*sg_maxmin_precision);
           double_update(&(cnst->usage), elem->value / var->weight, sg_maxmin_precision);
           //If the constraint is saturated, remove it from the set of active constraints (light_tab)
-          if(!double_positive(cnst->usage,sg_maxmin_precision) ||
-             !double_positive(cnst->remaining,cnst->bound*sg_maxmin_precision)) {
+          if (not double_positive(cnst->usage, sg_maxmin_precision) ||
+              not double_positive(cnst->remaining, cnst->bound * sg_maxmin_precision)) {
             if (cnst->cnst_light) {
               int index = (cnst->cnst_light-cnst_light_tab);
               XBT_DEBUG("index: %d \t cnst_light_num: %d \t || usage: %f remaining: %f bound: %f  ",
@@ -872,8 +873,8 @@ void lmm_solve(lmm_system_t sys)
               cnst->usage = MAX(cnst->usage, elem->value / elem->variable->weight);
           }
           //If the constraint is saturated, remove it from the set of active constraints (light_tab)
-          if(!double_positive(cnst->usage,sg_maxmin_precision) ||
-             !double_positive(cnst->remaining,cnst->bound*sg_maxmin_precision)) {
+          if (not double_positive(cnst->usage, sg_maxmin_precision) ||
+              not double_positive(cnst->remaining, cnst->bound * sg_maxmin_precision)) {
             if(cnst->cnst_light) {
               int index = (cnst->cnst_light-cnst_light_tab);
               XBT_DEBUG("index: %d \t cnst_light_num: %d \t || \t cnst: %p \t cnst->cnst_light: %p "
@@ -965,7 +966,7 @@ int lmm_cnstrs_min_concurrency_slack(lmm_variable_t var){
 
     //This is only an optimization, to avoid looking at more constraints when slack is already zero
     //Disable it when debugging to let lmm_concurrency_slack catch nasty things
-    if(!slack   && !XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug))
+    if (not slack && not XBT_LOG_ISENABLED(surf_maxmin, xbt_log_priority_debug))
       return 0;
 
     if(minslack>slack)
@@ -1020,7 +1021,7 @@ void lmm_disable_var(lmm_system_t sys, lmm_variable_t var){
   int i;
   lmm_element_t elem;
 
-  xbt_assert(!var->staged_weight,"Staged weight should have been cleared");
+  xbt_assert(not var->staged_weight, "Staged weight should have been cleared");
   //Disabling the variable, move to var to list tail. Subtility is: here, we need to call lmm_update_modified_set BEFORE
   //moving the last element of var.
   xbt_swag_remove(var, &(sys->variable_set));
@@ -1056,7 +1057,7 @@ void lmm_on_disabled_var(lmm_system_t sys, lmm_constraint_t cnstr){
     return;
 
   int numelem = xbt_swag_size(&(cnstr->disabled_element_set));
-  if(!numelem)
+  if (not numelem)
     return;
 
   lmm_element_t elem = (lmm_element_t)xbt_swag_getFirst(&(cnstr->disabled_element_set));
@@ -1175,7 +1176,7 @@ static void lmm_update_modified_set_rec(lmm_system_t sys, lmm_constraint_t cnst)
     s_lmm_element_t *cnsts = var->cnsts;
     int i;
     for (i = 0; var->visited != sys->visited_counter && i < var->cnsts_number ; i++) {
-      if (cnsts[i].constraint != cnst && !xbt_swag_belongs(cnsts[i].constraint, &sys->modified_constraint_set)) {
+      if (cnsts[i].constraint != cnst && not xbt_swag_belongs(cnsts[i].constraint, &sys->modified_constraint_set)) {
         xbt_swag_insert(cnsts[i].constraint, &sys->modified_constraint_set);
         lmm_update_modified_set_rec(sys, cnsts[i].constraint);
       }
@@ -1188,7 +1189,7 @@ static void lmm_update_modified_set_rec(lmm_system_t sys, lmm_constraint_t cnst)
 static void lmm_update_modified_set(lmm_system_t sys, lmm_constraint_t cnst)
 {
   /* nothing to do if selective update isn't active */
-  if (sys->selective_update_active && !xbt_swag_belongs(cnst, &sys->modified_constraint_set)) {
+  if (sys->selective_update_active && not xbt_swag_belongs(cnst, &sys->modified_constraint_set)) {
     xbt_swag_insert(cnst, &sys->modified_constraint_set);
     lmm_update_modified_set_rec(sys, cnst);
   }
@@ -1279,7 +1280,7 @@ void lmm_check_concurrency(lmm_system_t sys){
     xbt_swag_foreach(_var, &(sys->variable_set)) {
       var= (lmm_variable_t) _var;
 
-      if(!var->cnsts_number)
+      if (not var->cnsts_number)
         continue;
 
       elem = &var->cnsts[0];
index 75af96b..7d3aa5a 100644 (file)
@@ -138,10 +138,10 @@ NetworkCm02Model::NetworkCm02Model()
   char *optim = xbt_cfg_get_string("network/optim");
   bool select = xbt_cfg_get_boolean("network/maxmin-selective-update");
 
-  if (!strcmp(optim, "Full")) {
+  if (not strcmp(optim, "Full")) {
     updateMechanism_ = UM_FULL;
     selectiveUpdate_ = select;
-  } else if (!strcmp(optim, "Lazy")) {
+  } else if (not strcmp(optim, "Lazy")) {
     updateMechanism_ = UM_LAZY;
     selectiveUpdate_ = true;
     xbt_assert(select || (xbt_cfg_is_default_value("network/maxmin-selective-update")),
@@ -249,7 +249,7 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta)
                                           action->getLastUpdate(), now - action->getLastUpdate());
         }
       }
-      if (!lmm_get_number_of_cnst_from_var (maxminSystem_, action->getVariable())) {
+      if (not lmm_get_number_of_cnst_from_var(maxminSystem_, action->getVariable())) {
         /* There is actually no link used, hence an infinite bandwidth. This happens often when using models like
          * vivaldi. In such case, just make sure that the action completes immediately.
          */
@@ -279,7 +279,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   XBT_IN("(%s,%s,%g,%g)", src->cname(), dst->cname(), size, rate);
 
   src->routeTo(dst, route, &latency);
-  xbt_assert(!route->empty() || latency,
+  xbt_assert(not route->empty() || latency,
              "You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
              src->cname(), dst->cname());
 
@@ -447,7 +447,7 @@ void NetworkCm02Link::setBandwidth(double value)
     while ((var = lmm_get_var_from_cnst_safe(model()->getMaxminSystem(), constraint(), &elem, &nextelem, &numelem))) {
       NetworkCm02Action *action = static_cast<NetworkCm02Action*>(lmm_variable_id(var));
       action->weight_ += delta;
-      if (!action->isSuspended())
+      if (not action->isSuspended())
         lmm_update_variable_weight(model()->getMaxminSystem(), action->getVariable(), action->weight_);
     }
   }
@@ -480,7 +480,7 @@ void NetworkCm02Link::setLatency(double value)
         XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->latCurrent_);
       }
     }
-    if (!action->isSuspended())
+    if (not action->isSuspended())
       lmm_update_variable_weight(model()->getMaxminSystem(), action->getVariable(), action->weight_);
   }
 }
index 0cf97ad..8304958 100644 (file)
@@ -161,7 +161,7 @@ namespace simgrid {
 
         penalized_bw= ! num_comm_out ? (*it)->init_rate : (*it)->init_rate /penalty;
 
-        if (!double_equals(penalized_bw, rate_before_update, sg_surf_precision)){
+        if (not double_equals(penalized_bw, rate_before_update, sg_surf_precision)) {
           XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id,(*it)->destination->id,(*it)->action,penalized_bw, (*it)->action->getBound(), (*it)->init_rate );
           lmm_update_variable_bound(maxminSystem_, (*it)->action->getVariable(), penalized_bw);
         }else{
index 8b4f978..f14530a 100644 (file)
@@ -104,7 +104,7 @@ namespace simgrid {
     {
 
       if (strcmp(name,"__loopback__"))
-        xbt_assert(!LinkImpl::byName(name), "Link '%s' declared several times in the platform.", name);
+        xbt_assert(not LinkImpl::byName(name), "Link '%s' declared several times in the platform.", name);
 
       latency_.scale   = 1;
       bandwidth_.scale = 1;
@@ -125,7 +125,7 @@ namespace simgrid {
      */
     void LinkImpl::destroy()
     {
-      if (!currentlyDestroying_) {
+      if (not currentlyDestroying_) {
         currentlyDestroying_ = true;
         s4u::Link::onDestruction(this->piface_);
         delete this;
index 937f4e9..7803f6d 100644 (file)
@@ -197,7 +197,7 @@ double NetworkNS3Model::nextOccuringEvent(double now)
   XBT_DEBUG("ns3_next_occuring_event");
 
   //get the first relevant value from the running_actions list
-  if (!getRunningActionSet()->size() || now == 0.0)
+  if (not getRunningActionSet()->size() || now == 0.0)
     return -1.0;
   else
     do {
@@ -256,7 +256,7 @@ void NetworkNS3Model::updateActionsState(double now, double delta)
     }
   }
 
-  while (!xbt_dynar_is_empty(socket_to_destroy)){
+  while (not xbt_dynar_is_empty(socket_to_destroy)) {
     xbt_dynar_pop(socket_to_destroy,&ns3Socket);
 
     if (XBT_LOG_ISENABLED(ns3, xbt_log_priority_debug)) {
@@ -326,7 +326,7 @@ bool NetworkNS3Action::isSuspended()
 int NetworkNS3Action::unref()
 {
   refcount_--;
-  if (!refcount_) {
+  if (not refcount_) {
     if (action_hook.is_linked())
       stateSet_->erase(stateSet_->iterator_to(*this));
     XBT_DEBUG ("Removing action %p", this);
@@ -391,20 +391,20 @@ void ns3_initialize(const char* TcpProtocol){
   ns3::Config::SetDefault ("ns3::TcpSocket::SegmentSize", ns3::UintegerValue (1024)); // 1024-byte packet for easier reading
   ns3::Config::SetDefault ("ns3::TcpSocket::DelAckCount", ns3::UintegerValue (1));
 
-  if (!strcmp(TcpProtocol,"default"))
+  if (not strcmp(TcpProtocol, "default"))
     return;
 
-  if (!strcmp(TcpProtocol,"Reno")) {
+  if (not strcmp(TcpProtocol, "Reno")) {
     XBT_INFO("Switching Tcp protocol to '%s'",TcpProtocol);
     ns3::Config::SetDefault ("ns3::TcpL4Protocol::SocketType", ns3::StringValue("ns3::TcpReno"));
     return;
   }
-  if (!strcmp(TcpProtocol,"NewReno")) {
+  if (not strcmp(TcpProtocol, "NewReno")) {
     XBT_INFO("Switching Tcp protocol to '%s'",TcpProtocol);
     ns3::Config::SetDefault ("ns3::TcpL4Protocol::SocketType", ns3::StringValue("ns3::TcpNewReno"));
     return;
   }
-  if(!strcmp(TcpProtocol,"Tahoe")){
+  if (not strcmp(TcpProtocol, "Tahoe")) {
     XBT_INFO("Switching Tcp protocol to '%s'",TcpProtocol);
     ns3::Config::SetDefault ("ns3::TcpL4Protocol::SocketType", ns3::StringValue("ns3::TcpTahoe"));
     return;
index 608a3c3..c1f8842 100644 (file)
@@ -171,20 +171,20 @@ HostEnergy::~HostEnergy() = default;
 
 double HostEnergy::getWattMinAt(int pstate)
 {
-  xbt_assert(!power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname());
+  xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname());
   return power_range_watts_list[pstate].min;
 }
 
 double HostEnergy::getWattMaxAt(int pstate)
 {
-  xbt_assert(!power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname());
+  xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname());
   return power_range_watts_list[pstate].max;
 }
 
 /** @brief Computes the power consumed by the host according to the current pstate and processor load */
 double HostEnergy::getCurrentWattsValue(double cpu_load)
 {
-  xbt_assert(!power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname());
+  xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname());
 
   /* min_power corresponds to the power consumed when only one core is active */
   /* max_power is the power consumed at 100% cpu load       */
index a963b8c..042c185 100644 (file)
@@ -23,8 +23,8 @@ XBT_LOG_EXTERNAL_CATEGORY(xbt_cfg);
 void surf_host_model_init_ptask_L07()
 {
   XBT_CINFO(xbt_cfg,"Switching to the L07 model to handle parallel tasks.");
-  xbt_assert(!surf_cpu_model_pm, "CPU model type already defined");
-  xbt_assert(!surf_network_model, "network model type already defined");
+  xbt_assert(not surf_cpu_model_pm, "CPU model type already defined");
+  xbt_assert(not surf_network_model, "network model type already defined");
 
   surf_host_model = new simgrid::surf::HostL07Model();
   all_existing_models->push_back(surf_host_model);
@@ -432,7 +432,7 @@ void L07Action::updateBound()
 int L07Action::unref()
 {
   refcount_--;
-  if (!refcount_) {
+  if (not refcount_) {
     if (action_hook.is_linked())
       stateSet_->erase(stateSet_->iterator_to(*this));
     if (getVariable())
index 761571f..1f0c36b 100644 (file)
@@ -206,7 +206,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
     s_sg_platf_host_cbarg_t host;
     memset(&host, 0, sizeof(host));
     host.id = host_id;
-    if ((cluster->properties != nullptr) && (!xbt_dict_is_empty(cluster->properties))) {
+    if ((cluster->properties != nullptr) && (not xbt_dict_is_empty(cluster->properties))) {
       xbt_dict_cursor_t cursor=nullptr;
       char *key;
       char* data;
@@ -289,7 +289,7 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
   // Add a router.
   XBT_DEBUG(" ");
   XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id);
-  if (!cluster->router_id || !strcmp(cluster->router_id, "")) {
+  if (not cluster->router_id || not strcmp(cluster->router_id, "")) {
     char* newid         = bprintf("%s%s_router%s", cluster->prefix, cluster->id, cluster->suffix);
     current_as->router_ = sg_platf_new_router(newid, NULL);
     free(newid);
@@ -364,8 +364,8 @@ void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet)
 
 void sg_platf_new_storage(sg_platf_storage_cbarg_t storage)
 {
-  xbt_assert(!xbt_lib_get_or_null(storage_lib, storage->id,ROUTING_STORAGE_LEVEL),
-               "Refusing to add a second storage named \"%s\"", storage->id);
+  xbt_assert(not xbt_lib_get_or_null(storage_lib, storage->id, ROUTING_STORAGE_LEVEL),
+             "Refusing to add a second storage named \"%s\"", storage->id);
 
   xbt_assert(storage_types.find(storage->type_id) != storage_types.end(), "No storage type '%s'", storage->type_id);
   storage_type_t stype = storage_types.at(storage->type_id);
@@ -376,7 +376,7 @@ void sg_platf_new_storage(sg_platf_storage_cbarg_t storage)
   xbt_lib_set(storage_lib, storage->id, ROUTING_STORAGE_LEVEL, (void *) xbt_strdup(storage->type_id));
 
   // if storage content is not specified use the content of storage_type if any
-  if (!strcmp(storage->content, "") && strcmp(stype->content, "")) {
+  if (not strcmp(storage->content, "") && strcmp(stype->content, "")) {
     storage->content      = stype->content;
     XBT_DEBUG("For disk '%s' content is empty, inherit the content (of type %s)", storage->id, stype->type_id);
   }
@@ -442,7 +442,7 @@ void sg_platf_new_bypassRoute(sg_platf_route_cbarg_t bypassRoute)
 void sg_platf_new_process(sg_platf_process_cbarg_t process)
 {
   sg_host_t host = sg_host_by_name(process->host);
-  if (!host) {
+  if (not host) {
     // The requested host does not exist. Do a nice message to the user
     std::string msg = std::string("Cannot create process '") + process->function + "': host '" + process->host +
                       "' does not exist\nExisting hosts: '";
@@ -550,14 +550,14 @@ static void surf_config_models_setup()
   const char* storage_model_name = xbt_cfg_get_string("storage/model");
 
   /* The compound host model is needed when using non-default net/cpu models */
-  if ((!xbt_cfg_is_default_value("network/model") || !xbt_cfg_is_default_value("cpu/model")) &&
+  if ((not xbt_cfg_is_default_value("network/model") || not xbt_cfg_is_default_value("cpu/model")) &&
       xbt_cfg_is_default_value("host/model")) {
     host_model_name = "compound";
     xbt_cfg_set_string("host/model", host_model_name);
   }
 
   XBT_DEBUG("host model: %s", host_model_name);
-  if (!strcmp(host_model_name, "compound")) {
+  if (not strcmp(host_model_name, "compound")) {
     xbt_assert(cpu_model_name, "Set a cpu model to use with the 'compound' host model");
     xbt_assert(network_model_name, "Set a network model to use with the 'compound' host model");
 
@@ -594,7 +594,7 @@ static void surf_config_models_setup()
  */
 simgrid::s4u::NetZone* sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
 {
-  if (!surf_parse_models_setup_already_called) {
+  if (not surf_parse_models_setup_already_called) {
     /* Initialize the surf models. That must be done after we got all config, and before we need the models.
      * That is, after the last <config> tag, if any, and before the first of cluster|peer|AS|trace|trace_connect
      *
index 50c66f4..0f2308a 100644 (file)
@@ -79,7 +79,7 @@ Storage::~Storage(){
 std::map<std::string, sg_size_t*>* Storage::parseContent(const char* filename)
 {
   usedSize_ = 0;
-  if ((!filename) || (strcmp(filename, "") == 0))
+  if ((not filename) || (strcmp(filename, "") == 0))
     return nullptr;
 
   std::map<std::string, sg_size_t*>* parse_content = new std::map<std::string, sg_size_t*>();
@@ -101,7 +101,7 @@ std::map<std::string, sg_size_t*>* Storage::parseContent(const char* filename)
       *psize = size;
       parse_content->insert({tokens.front(), psize});
     }
-  } while (!fs->eof());
+  } while (not fs->eof());
   delete fs;
   return parse_content;
 }
index 8c4f4e8..62e5b9e 100644 (file)
@@ -25,7 +25,7 @@ static void check_disk_attachment()
       simgrid::surf::Storage* storage =
           static_cast<simgrid::surf::Storage*>(xbt_lib_get_or_null(storage_lib, key, SURF_STORAGE_LEVEL));
       simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(storage->attach_);
-      if (!host_elm)
+      if (not host_elm)
         surf_parse_error("Unable to attach storage %s: host %s does not exist.", storage->cname(), storage->attach_);
     }
   }
@@ -59,8 +59,8 @@ Storage* StorageN11Model::createStorage(const char* id, const char* type_id, con
                                         const char* attach)
 {
 
-  xbt_assert(!surf_storage_resource_priv(surf_storage_resource_by_name(id)),
-      "Storage '%s' declared several times in the platform file", id);
+  xbt_assert(not surf_storage_resource_priv(surf_storage_resource_by_name(id)),
+             "Storage '%s' declared several times in the platform file", id);
 
   storage_type_t storage_type = storage_types.at(type_id);
 
@@ -284,7 +284,7 @@ StorageN11Action::StorageN11Action(Model *model, double cost, bool failed, Stora
 int StorageN11Action::unref()
 {
   refcount_--;
-  if (!refcount_) {
+  if (not refcount_) {
     if (action_hook.is_linked())
       stateSet_->erase(stateSet_->iterator_to(*this));
     if (getVariable())
index dd505c0..cbb08ad 100644 (file)
@@ -137,7 +137,7 @@ std::ifstream* surf_ifsopen(const char* name)
     std::string buff = path_elm + FILE_DELIM + name;
     fs->open(buff.c_str(), std::ifstream::in);
 
-    if (!fs->fail()) {
+    if (not fs->fail()) {
       XBT_DEBUG("Found file at %s", buff.c_str());
       return fs;
     }
@@ -192,7 +192,7 @@ const char *__surf_get_initial_path()
   unsigned int len = GetCurrentDirectory(MAX_PATH + 1, current_directory);
   char root[4] = { 0 };
 
-  if (!len)
+  if (not len)
     return nullptr;
 
   strncpy(root, current_directory, 3);
@@ -243,10 +243,10 @@ int find_model_description(s_surf_model_description_t * table,
   char *name_list = nullptr;
 
   for (i = 0; table[i].name; i++)
-    if (!strcmp(name, table[i].name)) {
+    if (not strcmp(name, table[i].name)) {
       return i;
     }
-  if (!table[0].name)
+  if (not table[0].name)
     xbt_die("No model is valid! This is a bug.");
   name_list = xbt_strdup(table[0].name);
   for (i = 1; table[i].name; i++) {
@@ -354,9 +354,9 @@ void surf_init(int *argc, char **argv)
   SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,surf_storage_free);
 
   xbt_init(argc, argv);
-  if (!all_existing_models)
+  if (not all_existing_models)
     all_existing_models = new std::vector<simgrid::surf::Model*>();
-  if (!future_evt_set)
+  if (not future_evt_set)
     future_evt_set = new simgrid::trace_mgr::future_evt_set();
 
   TRACE_surf_alloc();
@@ -453,7 +453,7 @@ double Model::nextOccuringEventLazy(double now)
   lmm_solve(maxminSystem_);
   XBT_DEBUG("After share resources, The size of modified actions set is %zd", modifiedSet_->size());
 
-  while(!modifiedSet_->empty()) {
+  while (not modifiedSet_->empty()) {
     Action *action = &(modifiedSet_->front());
     modifiedSet_->pop_front();
     bool max_dur_flag = false;
@@ -766,7 +766,7 @@ void Action::cancel(){
 
 int Action::unref(){
   refcount_--;
-  if (!refcount_) {
+  if (not refcount_) {
     if (action_hook.is_linked())
       stateSet_->erase(stateSet_->iterator_to(*this));
     if (getVariable())
index 7fc1da1..7771715 100644 (file)
@@ -110,7 +110,7 @@ tmgr_trace_t tmgr_trace_new_from_file(const char *filename)
   xbt_assert(trace_list.find(filename) == trace_list.end(), "Refusing to define trace %s twice", filename);
 
   std::ifstream* f = surf_ifsopen(filename);
-  xbt_assert(!f->fail(), "Cannot open file '%s' (path=%s)", filename, (boost::join(surf_path, ":")).c_str());
+  xbt_assert(not f->fail(), "Cannot open file '%s' (path=%s)", filename, (boost::join(surf_path, ":")).c_str());
 
   std::stringstream buffer;
   buffer << f->rdbuf();
index ba3dab8..7e3c02e 100644 (file)
@@ -45,7 +45,7 @@ XBT_IMPORT_NO_EXPORT(unsigned int) surfxml_buffer_stack_stack[1024];
 
 void surfxml_bufferstack_push(int new_one)
 {
-  if (!new_one)
+  if (not new_one)
     old_buff = surfxml_bufferstack;
   else {
     surfxml_bufferstack_stack.push_back(surfxml_bufferstack);
@@ -55,7 +55,7 @@ void surfxml_bufferstack_push(int new_one)
 
 void surfxml_bufferstack_pop(int new_one)
 {
-  if (!new_one)
+  if (not new_one)
     surfxml_bufferstack = old_buff;
   else {
     free(surfxml_bufferstack);
@@ -118,7 +118,7 @@ void sg_platf_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect)
 
 static int after_config_done;
 void parse_after_config() {
-  if (!after_config_done) {
+  if (not after_config_done) {
     TRACE_start();
 
     /* Register classical callbacks */
index ed57a4c..12611da 100644 (file)
@@ -31,7 +31,7 @@ std::vector<simgrid::surf::LinkImpl*> parsed_link_list; /* temporary store of cu
  * Helping functions
  */
 void surf_parse_assert(bool cond, const char *fmt, ...) {
-  if (!cond ) {
+  if (not cond) {
     va_list va;
     va_start(va,fmt);
     int lineno = surf_parse_lineno;
@@ -490,7 +490,7 @@ void STag_surfxml_prop()
     netzone->setProperty(A_surfxml_prop_id, A_surfxml_prop_value);
   }
   else{
-    if (!current_property_set)
+    if (not current_property_set)
       current_property_set = xbt_dict_new_homogeneous(&xbt_free_f); // Maybe, it should raise an error
     xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), nullptr);
     XBT_DEBUG("add prop %s=%s into current property set %p", A_surfxml_prop_id, A_surfxml_prop_value,
@@ -1070,7 +1070,7 @@ void STag_surfxml_argument(){
 }
 
 void STag_surfxml_model___prop(){
-  if (!current_model_property_set)
+  if (not current_model_property_set)
     current_model_property_set = new std::map<std::string, std::string>();
 
   current_model_property_set->insert(
index 20891ae..c61c519 100644 (file)
@@ -186,7 +186,7 @@ std::vector<std::string> resolveBacktrace(
 
   XBT_VERB("Fire a first command: '%s'", cmd.c_str());
   FILE* pipe = popen(cmd.c_str(), "r");
-  if (!pipe) {
+  if (not pipe) {
     xbt_die("Cannot fork addr2line to display the backtrace");
   }
 
@@ -235,7 +235,7 @@ std::vector<std::string> resolveBacktrace(
       XBT_DEBUG("addr=%s (as string) =%#lx (as number)",
         addrs[i].c_str(), addr);
 
-      while (!found) {
+      while (not found) {
         long int first;
         long int last;
 
@@ -261,7 +261,7 @@ std::vector<std::string> resolveBacktrace(
       free(maps_name);
       addrs[i].clear();
 
-      if (!found) {
+      if (not found) {
         XBT_VERB("Problem while reading the maps file. Following backtrace will be mangled.");
         XBT_DEBUG("No dynamic. Static symbol: %s", backtrace_syms[i]);
         result.push_back(simgrid::xbt::string_printf("?? (%s)", backtrace_syms[i]));
@@ -294,7 +294,7 @@ std::vector<std::string> resolveBacktrace(
         free(p);
         XBT_VERB("Fire a new command: '%s'", subcmd);
         FILE* subpipe = popen(subcmd, "r");
-        if (!subpipe) {
+        if (not subpipe) {
           xbt_die("Cannot fork addr2line to display the backtrace");
         }
         if (fgets(line_func, 1024, subpipe)) {
@@ -329,9 +329,9 @@ std::vector<std::string> resolveBacktrace(
     addrs[i].clear();
 
     /* Mask the bottom of the stack */
-    if (!strncmp("main", line_func, strlen("main")) ||
-        !strncmp("xbt_thread_context_wrapper", line_func, strlen("xbt_thread_context_wrapper"))
-        || !strncmp("smx_ctx_sysv_wrapper", line_func, strlen("smx_ctx_sysv_wrapper")))
+    if (not strncmp("main", line_func, strlen("main")) ||
+        not strncmp("xbt_thread_context_wrapper", line_func, strlen("xbt_thread_context_wrapper")) ||
+        not strncmp("smx_ctx_sysv_wrapper", line_func, strlen("smx_ctx_sysv_wrapper")))
       break;
   }
   pclose(pipe);
index bbbbf29..9b3fedb 100644 (file)
@@ -536,7 +536,7 @@ void xbt_cfg_help()    { simgrid_config->help(); }
  */
 void xbt_cfg_set_parse(const char *options)
 {
-  if (!options || !strlen(options)) {   /* nothing to do */
+  if (not options || not strlen(options)) { /* nothing to do */
     return;
   }
   char *optionlist_cpy = xbt_strdup(options);
@@ -544,7 +544,7 @@ void xbt_cfg_set_parse(const char *options)
   XBT_DEBUG("List to parse and set:'%s'", options);
   char *option = optionlist_cpy;
   while (1) {                   /* breaks in the code */
-    if (!option)
+    if (not option)
       break;
     char *name = option;
     int len = strlen(name);
@@ -573,7 +573,7 @@ void xbt_cfg_set_parse(const char *options)
 
     if (name[0] == ' ' || name[0] == '\n' || name[0] == '\t')
       continue;
-    if (!strlen(name))
+    if (not strlen(name))
       break;
 
     char *val = strchr(name, ':');
@@ -904,7 +904,7 @@ XBT_TEST_UNIT("c++flags", test_config_cxx_flags, "C++ flags")
   xbt_test_assert(string_flag == "bar", "Check string flag");
   xbt_test_assert(double_flag == 8.0, "Check double flag");
   xbt_test_assert(bool_flag1, "Check bool1 flag");
-  xbt_test_assert(!bool_flag2, "Check bool2 flag");
+  xbt_test_assert(not bool_flag2, "Check bool2 flag");
 
   xbt_cfg_free(&simgrid_config);
   simgrid_config = temp;
index 94e16a6..195d368 100644 (file)
@@ -192,8 +192,8 @@ xbt_test_suite_t xbt_test_suite_by_name(const char *name, const char *fmt, ...)
 
   if (_xbt_test_suites)
     xbt_dynar_foreach(_xbt_test_suites, it_suite, suite)
-        if (!strcmp(suite->name, name))
-      return suite;
+      if (not strcmp(suite->name, name))
+        return suite;
 
   va_start(ap, fmt);
   bufname = bvprintf(fmt, ap);
@@ -275,7 +275,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
 
   snprintf(suite_title + 40 - (suite_len + 4) / 2, 81 - (40 - (suite_len + 4) / 2), "[ %s ]", suite->title);
   suite_title[40 + (suite_len + 5) / 2] = '=';
-  if (!suite->enabled)
+  if (not suite->enabled)
     snprintf(suite_title + 70, 11, " DISABLED ");
   fprintf(stderr, "\n%s\n", suite_title);
 
@@ -307,9 +307,9 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
         } else {
           unit->nb_tests++;
 
-          if (test->failed && !test->expected_failure)
+          if (test->failed && not test->expected_failure)
             unit->test_failed++;
-          if (!test->failed && test->expected_failure)
+          if (not test->failed && test->expected_failure)
             unit->test_failed++;
           if (test->expected_failure)
             unit->test_expect++;
@@ -344,7 +344,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
           }
           fprintf(stderr, "      %s: %s [%s:%d]\n", resname, test->title, file, line);
 
-          if ((test->expected_failure && !test->failed) || (!test->expected_failure && test->failed)) {
+          if ((test->expected_failure && not test->failed) || (not test->expected_failure && test->failed)) {
             xbt_dynar_foreach(test->logs, it_log, log) {
               file = (log->file != nullptr ? log->file : file);
               line = (log->line != 0 ? log->line : line);
@@ -358,7 +358,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
         } else {
           fprintf(stderr, "\n");
         }
-      } else if (!unit->enabled) {
+      } else if (not unit->enabled) {
         fprintf(stderr, " disabled\n"); /* no test were run */
       } else if (unit->nb_tests) {
         fprintf(stderr, "...... ok\n"); /* successful */
@@ -382,7 +382,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
         suite->nb_units++;
         if (unit->test_failed)
           suite->unit_failed++;
-      } else if (!unit->enabled) {
+      } else if (not unit->enabled) {
         suite->unit_disabled++;
       } else {
         suite->unit_ignore++;
@@ -398,7 +398,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
     _xbt_test_nb_suites++;
     if (suite->test_failed)
       _xbt_test_suite_failed++;
-  } else if (!suite->enabled) {
+  } else if (not suite->enabled) {
     _xbt_test_suite_disabled++;
   } else {
     _xbt_test_suite_ignore++;
@@ -466,13 +466,13 @@ static void apply_selection(char *selection)
   char suitename[512];
   char unitname[512];
 
-  if (!selection || selection[0] == '\0')
+  if (not selection || selection[0] == '\0')
     return;
 
   /*printf("Test selection: %s\n", selection); */
 
   /* First apply the selection */
-  while (!done) {
+  while (not done) {
     int enabling = 1;
 
     char *p = strchr(sel, ',');
@@ -505,7 +505,7 @@ static void apply_selection(char *selection)
     }
 
     /* Deal with the specific case of 'all' pseudo serie */
-    if (!strcmp("all", suitename)) {
+    if (not strcmp("all", suitename)) {
       xbt_assert(unitname[0] == '\0', "The 'all' pseudo-suite does not accept any unit specification\n");
 
       xbt_dynar_foreach(_xbt_test_suites, it_suite, suite) {
@@ -519,7 +519,7 @@ static void apply_selection(char *selection)
       for (it = 0; it < xbt_dynar_length(_xbt_test_suites); it++) {
         xbt_test_suite_t thissuite =
             xbt_dynar_get_as(_xbt_test_suites, it, xbt_test_suite_t);
-        if (!strcmp(suitename, thissuite->name)) {
+        if (not strcmp(suitename, thissuite->name)) {
           /* Do not disable the whole suite when we just want to disable a child */
           if (enabling || (unitname[0] == '\0'))
             thissuite->enabled = enabling;
@@ -535,7 +535,7 @@ static void apply_selection(char *selection)
                  it2_unit < xbt_dynar_length(thissuite->units);
                  it2_unit++) {
               xbt_test_unit_t thisunit = xbt_dynar_get_as(thissuite->units, it2_unit, xbt_test_unit_t);
-              if (!strcmp(thisunit->name, unitname)) {
+              if (not strcmp(thisunit->name, unitname)) {
                 thisunit->enabled = enabling;
                 break;
               }
index 9d5dc32..ca5f4b9 100644 (file)
@@ -164,7 +164,7 @@ void xbt_dict_set_ext(xbt_dict_t dict, const char *key, int key_len, void *data,
   xbt_dictelm_t current;
   xbt_dictelm_t previous = nullptr;
 
-  xbt_assert(!free_ctn, "Cannot set an individual free function in homogeneous dicts.");
+  xbt_assert(not free_ctn, "Cannot set an individual free function in homogeneous dicts.");
   XBT_CDEBUG(xbt_dict, "ADD %.*s hash = %u, size = %d, & = %u", key_len, key, hash_code,
              dict->table_size, hash_code & dict->table_size);
   current = dict->table[hash_code & dict->table_size];
@@ -369,7 +369,7 @@ void xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_len)
     }
   }
 
-  if (!dict->table[hash_code & dict->table_size])
+  if (not dict->table[hash_code & dict->table_size])
     dict->fill--;
 
   xbt_dictelm_free(dict, current);
@@ -430,7 +430,7 @@ void xbt_dict_dump_output_string(void *s)
  */
 int xbt_dict_is_empty(xbt_dict_t dict)
 {
-  return !dict || (xbt_dict_length(dict) == 0);
+  return not dict || (xbt_dict_length(dict) == 0);
 }
 
 /**
@@ -477,7 +477,7 @@ void xbt_dict_dump_sizes(xbt_dict_t dict)
 
   printf("Dict %p: %d bucklets, %d used cells (of %d) ", dict, dict->count, dict->fill, dict->table_size);
 
-  if (!dict) {
+  if (not dict) {
     printf("\n");
     return;
   }
@@ -502,7 +502,7 @@ void xbt_dict_dump_sizes(xbt_dict_t dict)
       xbt_dynar_set(sizes, size, &prevsize);
     }
   }
-  if (!all_sizes)
+  if (not all_sizes)
     all_sizes = xbt_dynar_new(sizeof(int), nullptr);
 
   xbt_dynar_foreach(sizes, count, size) {
@@ -620,10 +620,10 @@ static void search_ext(xbt_dict_t head, const char *key, const char *data)
   if (data) {
     xbt_test_assert(found, "data do not match expectations: found nullptr while searching for %s", data);
     if (found)
-      xbt_test_assert(!strcmp(data, found), "data do not match expectations: found %s while searching for %s",
-                      found, data);
+      xbt_test_assert(not strcmp(data, found), "data do not match expectations: found %s while searching for %s", found,
+                      data);
   } else {
-    xbt_test_assert(!found, "data do not match expectations: found %s while searching for nullptr", found);
+    xbt_test_assert(not found, "data do not match expectations: found %s while searching for nullptr", found);
   }
 }
 
@@ -647,12 +647,12 @@ static void traverse(xbt_dict_t head)
   int i = 0;
 
   xbt_dict_foreach(head, cursor, key, data) {
-    if (!key || !data || strcmp(key, data)) {
+    if (not key || not data || strcmp(key, data)) {
       xbt_test_log("Seen #%d:  %s->%s", ++i, key, data);
     } else {
       xbt_test_log("Seen #%d:  %s", ++i, key);
     }
-    xbt_test_assert(!data || !strcmp(key, data), "Key(%s) != value(%s). Aborting", key, data);
+    xbt_test_assert(not data || not strcmp(key, data), "Key(%s) != value(%s). Aborting", key, data);
   }
 }
 
@@ -701,7 +701,7 @@ static void count_check_get_key(xbt_dict_t dict, int length)
   xbt_dict_foreach(dict, cursor, key, data) {
     effective++;
     char* key2 = xbt_dict_get_key(dict, data);
-    xbt_assert(!strcmp(key, key2), "The data was registered under %s instead of %s as expected", key2, key);
+    xbt_assert(not strcmp(key, key2), "The data was registered under %s instead of %s as expected", key2, key);
   }
 
   xbt_test_assert(effective == length, "Effective length(%d) != %d.", effective, length);
@@ -765,7 +765,7 @@ XBT_TEST_UNIT("basic", test_dict_basic, "Basic usage: change, retrieve and trave
   xbt_test_add("Search 123");
   char* data = (char*)xbt_dict_get(head, "123");
   xbt_test_assert(data);
-  xbt_test_assert(!strcmp("123", data));
+  xbt_test_assert(not strcmp("123", data));
 
   search_not_found(head, "Can't be found");
   search_not_found(head, "123 Can't be found");
@@ -872,13 +872,13 @@ XBT_TEST_UNIT("nulldata", test_dict_nulldata, "nullptr data management")
     char* data;
 
     xbt_dict_foreach(head, cursor, key, data) {
-      if (!key || !data || strcmp(key, data)) {
+      if (not key || not data || strcmp(key, data)) {
         xbt_test_log("Seen:  %s->%s", key, data);
       } else {
         xbt_test_log("Seen:  %s", key);
       }
 
-      if (!strcmp(key, "null"))
+      if (not strcmp(key, "null"))
         found = 1;
     }
     xbt_test_assert(found, "the key 'null', associated to nullptr is not found");
@@ -925,7 +925,7 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test")
 
       xbt_dict_set(head, key, key, nullptr);
       data = (char*) xbt_dict_get(head, key);
-      xbt_test_assert(!strcmp(key, data), "Retrieved value (%s) != Injected value (%s)", key, data);
+      xbt_test_assert(not strcmp(key, data), "Retrieved value (%s) != Injected value (%s)", key, data);
 
       count(head, j + 1);
     }
@@ -956,9 +956,9 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test")
     for (int j = 0; j < NB_ELM; j++) {
       snprintf(key,10, "%d", j);
       void* data = xbt_dict_get(head, key);
-      xbt_test_assert(!strcmp(key, (char *) data), "with get, key=%s != data=%s", key, (char *) data);
+      xbt_test_assert(not strcmp(key, (char*)data), "with get, key=%s != data=%s", key, (char*)data);
       data = xbt_dict_get_ext(head, key, strlen(key));
-      xbt_test_assert(!strcmp(key, (char *) data), "with get_ext, key=%s != data=%s", key, (char *) data);
+      xbt_test_assert(not strcmp(key, (char*)data), "with get_ext, key=%s != data=%s", key, (char*)data);
     }
   }
   free(key);
index b7df27f..84ba004 100644 (file)
@@ -400,7 +400,7 @@ extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned in
   unsigned long offset;
   unsigned long cur;
 
-  if (!n)
+  if (not n)
     return;
 
   _sanity_check_dynar(dynar);
@@ -431,13 +431,13 @@ extern "C" void xbt_dynar_remove_n_at(xbt_dynar_t const dynar, const unsigned in
  * \code
  * signed int position = -1;
  * xbt_dynar_foreach(dynar, iter, elem) {
- *    if (!memcmp(elem, searched_element, sizeof(*elem))) {
+ *    if (not memcmp(elem, searched_element, sizeof(*elem))) {
  *        position = iter;
  *        break;
  *    }
  * }
  * \endcode
- * 
+ *
  * Raises not_found_error if not found. If you have less than 2 millions elements, you probably want to use
  * #xbt_dynar_search_or_negative() instead, so that you don't have to TRY/CATCH on element not found.
  */
@@ -446,7 +446,7 @@ extern "C" unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void* const el
   unsigned long it;
 
   for (it = 0; it < dynar->used; it++)
-    if (!memcmp(_xbt_dynar_elm(dynar, it), elem, dynar->elmsize)) {
+    if (not memcmp(_xbt_dynar_elm(dynar, it), elem, dynar->elmsize)) {
       return it;
     }
 
@@ -467,7 +467,7 @@ extern "C" signed int xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void
   unsigned long it;
 
   for (it = 0; it < dynar->used; it++)
-    if (!memcmp(_xbt_dynar_elm(dynar, it), elem, dynar->elmsize)) {
+    if (not memcmp(_xbt_dynar_elm(dynar, it), elem, dynar->elmsize)) {
       return it;
     }
 
@@ -484,7 +484,7 @@ extern "C" int xbt_dynar_member(xbt_dynar_t const dynar, void* const elem)
   unsigned long it;
 
   for (it = 0; it < dynar->used; it++)
-    if (!memcmp(_xbt_dynar_elm(dynar, it), elem, dynar->elmsize)) {
+    if (not memcmp(_xbt_dynar_elm(dynar, it), elem, dynar->elmsize)) {
       return 1;
     }
 
@@ -700,9 +700,9 @@ extern "C" int xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2, int (*compar)(c
 {
   int i ;
   int size;
-  if((!d1) && (!d2))
+  if ((not d1) && (not d2))
     return 0;
-  if((!d1) || (!d2)) {
+  if ((not d1) || (not d2)) {
     XBT_DEBUG("nullptr dynar d1=%p d2=%p",d1,d2);
     xbt_dynar_free(&d2);
     return 1;
@@ -1080,7 +1080,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   for (int cpt = 0; cpt < NB_ELEM; cpt++) {
     snprintf(buf,1023, "%d", cpt);
     xbt_dynar_shift(d, &s2);
-    xbt_test_assert(!strcmp(buf, s2), "The retrieved value is not the same than the injected one (%s!=%s)", buf, s2);
+    xbt_test_assert(not strcmp(buf, s2), "The retrieved value is not the same than the injected one (%s!=%s)", buf, s2);
     free(s2);
   }
   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
@@ -1097,13 +1097,13 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   /* 2. Traverse the dynar with the macro */
   xbt_dynar_foreach(d, iter, s1) {
     snprintf(buf,1023, "%u", NB_ELEM - iter - 1);
-    xbt_test_assert(!strcmp(buf, s1), "The retrieved value is not the same than the injected one (%s!=%s)", buf, s1);
+    xbt_test_assert(not strcmp(buf, s1), "The retrieved value is not the same than the injected one (%s!=%s)", buf, s1);
   }
   /* 3. Traverse the dynar with the macro */
   for (int cpt = 0; cpt < NB_ELEM; cpt++) {
     snprintf(buf,1023, "%d", cpt);
     xbt_dynar_pop(d, &s2);
-    xbt_test_assert(!strcmp(buf, s2), "The retrieved value is not the same than the injected one (%s!=%s)", buf, s2);
+    xbt_test_assert(not strcmp(buf, s2), "The retrieved value is not the same than the injected one (%s!=%s)", buf, s2);
     free(s2);
   }
   /* 4. Free the resources */
@@ -1127,22 +1127,22 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   for (int cpt = 0; cpt < NB_ELEM / 2; cpt++) {
     snprintf(buf,1023, "%d", cpt);
     xbt_dynar_shift(d, &s2);
-    xbt_test_assert(!strcmp(buf, s2),
-                     "The retrieved value is not the same than the injected one at the begining (%s!=%s)", buf, s2);
+    xbt_test_assert(not strcmp(buf, s2),
+                    "The retrieved value is not the same than the injected one at the begining (%s!=%s)", buf, s2);
     free(s2);
   }
   for (int cpt = (NB_ELEM / 5) - 1; cpt >= 0; cpt--) {
     snprintf(buf,1023, "%d", cpt);
     xbt_dynar_shift(d, &s2);
-    xbt_test_assert(!strcmp(buf, s2),
-                     "The retrieved value is not the same than the injected one in the middle (%s!=%s)", buf, s2);
+    xbt_test_assert(not strcmp(buf, s2),
+                    "The retrieved value is not the same than the injected one in the middle (%s!=%s)", buf, s2);
     free(s2);
   }
   for (int cpt = NB_ELEM / 2; cpt < NB_ELEM; cpt++) {
     snprintf(buf,1023, "%d", cpt);
     xbt_dynar_shift(d, &s2);
-    xbt_test_assert(!strcmp(buf, s2), "The retrieved value is not the same than the injected one at the end (%s!=%s)",
-                     buf, s2);
+    xbt_test_assert(not strcmp(buf, s2),
+                    "The retrieved value is not the same than the injected one at the end (%s!=%s)", buf, s2);
     free(s2);
   }
   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
@@ -1159,7 +1159,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings")
   for (int cpt = 2 * (NB_ELEM / 5); cpt < 4 * (NB_ELEM / 5); cpt++) {
     snprintf(buf,1023, "%d", cpt);
     xbt_dynar_remove_at(d, 2 * (NB_ELEM / 5), &s2);
-    xbt_test_assert(!strcmp(buf, s2), "Remove a bad value. Got %s, expected %s", s2, buf);
+    xbt_test_assert(not strcmp(buf, s2), "Remove a bad value. Got %s, expected %s", s2, buf);
     free(s2);
   }
   xbt_dynar_free(&d);           /* end_of_doxygen */
index b0f5564..37f1c25 100644 (file)
@@ -227,10 +227,10 @@ XBT_TEST_UNIT("cleanup", test_cleanup, "cleanup handling")
     c = 1;
     if (v1 != 5678)
       xbt_test_fail("v1 = %d (!= 5678)", v1);
-    if (!(ex.category == 1 && ex.value == 2 && !strcmp(ex.what(), "blah")))
+    if (!(ex.category == 1 && ex.value == 2 && not strcmp(ex.what(), "blah")))
       xbt_test_fail("unexpected exception contents");
   }
-  if (!c)
+  if (not c)
     xbt_test_fail("xbt_ex_free not executed");
 }
 #endif                          /* SIMGRID_TEST */
index d43a9b6..88e7709 100644 (file)
@@ -296,7 +296,7 @@ XBT_PRIVATE std::vector<VmMap> get_memory_map(pid_t pid)
 
     /* Create space for a new map region in the region's array and copy the */
     /* parsed stuff from the temporal memreg variable */
-    XBT_DEBUG("Found region for %s", !memreg.pathname.empty() ? memreg.pathname.c_str() : "(null)");
+    XBT_DEBUG("Found region for %s", not memreg.pathname.empty() ? memreg.pathname.c_str() : "(null)");
 
     ret.push_back(std::move(memreg));
   }
index 2a1851b..0423149 100644 (file)
@@ -141,7 +141,7 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode)
  */
 void xbt_parmap_destroy(xbt_parmap_t parmap)
 {
-  if (!parmap) {
+  if (not parmap) {
     return;
   }
 
index c05deb6..495e19a 100644 (file)
@@ -23,7 +23,7 @@ static void read_and_trim_line(std::ifstream* fs, std::string* line)
   do {
     std::getline(*fs, *line);
     boost::trim(*line);
-  } while (!fs->eof() && (line->length() == 0 || line->front() == '#'));
+  } while (not fs->eof() && (line->length() == 0 || line->front() == '#'));
   XBT_DEBUG("got from trace: %s", line->c_str());
 }
 
@@ -50,7 +50,7 @@ bool ReplayReader::get(ReplayAction* action)
   read_and_trim_line(fs, &line);
 
   boost::split(*action, line, boost::is_any_of(" \t"), boost::token_compress_on);
-  return !fs->eof();
+  return not fs->eof();
 }
 
 static ReplayAction* get_action(char* name)
index 6a102b3..1146eef 100644 (file)
@@ -32,10 +32,10 @@ void xbt_str_rtrim(char *s, const char *char_list)
   const char *__char_list = " \t\n\r\x0B";
   char white_char[256] = { 1, 0 };
 
-  if (!s)
+  if (not s)
     return;
 
-  if (!char_list) {
+  if (not char_list) {
     while (*__char_list) {
       white_char[(unsigned char) *__char_list++] = 1;
     }
@@ -75,10 +75,10 @@ void xbt_str_ltrim(char *s, const char *char_list)
   const char *__char_list = " \t\n\r\x0B";
   char white_char[256] = { 1, 0 };
 
-  if (!s)
+  if (not s)
     return;
 
-  if (!char_list) {
+  if (not char_list) {
     while (*__char_list) {
       white_char[(unsigned char) *__char_list++] = 1;
     }
@@ -111,7 +111,7 @@ void xbt_str_ltrim(char *s, const char *char_list)
  */
 void xbt_str_trim(char *s, const char *char_list)
 {
-  if (!s)
+  if (not s)
     return;
 
   xbt_str_rtrim(s, char_list);
@@ -161,7 +161,7 @@ xbt_dynar_t xbt_str_split(const char *s, const char *sep)
 
   /* check what are the separators */
   memset(is_sep, 0, sizeof(is_sep));
-  if (!sep) {
+  if (not sep) {
     while (*sep_dflt)
       is_sep[(unsigned char) *sep_dflt++] = 1;
   } else {
@@ -178,9 +178,9 @@ xbt_dynar_t xbt_str_split(const char *s, const char *sep)
   if (s[0] == '\0')
     return res;
 
-  while (!done) {
+  while (not done) {
     char *topush;
-    while (!is_sep[(unsigned char) *q]) {
+    while (not is_sep[(unsigned char)*q]) {
       q++;
     }
     if (*q == '\0')
@@ -198,7 +198,7 @@ xbt_dynar_t xbt_str_split(const char *s, const char *sep)
 
 /**
  * \brief This functions splits a string after using another string as separator
- * For example A!!B!!C split after !! will return the dynar {A,B,C}
+ * For example Anot not B!not C split after !! will return the dynar {A,B,C}
  * \return An array of dynars containing the string tokens
  */
 xbt_dynar_t xbt_str_split_str(const char *s, const char *sep)
@@ -217,7 +217,7 @@ xbt_dynar_t xbt_str_split_str(const char *s, const char *sep)
     return res;
   }
 
-  while (!done) {
+  while (not done) {
     char *to_push;
     int v = 0;
     // get the start of the first occurrence of the substring
@@ -271,7 +271,7 @@ xbt_dynar_t xbt_str_split_quoted_in_place(char *s) {
   /* do not trim leading spaces: caller responsibility to clean his cruft */
   end = beg;
 
-  while (!done) {
+  while (not done) {
     switch (*end) {
     case '\\':
       ctn = 1;
@@ -283,8 +283,8 @@ xbt_dynar_t xbt_str_split_quoted_in_place(char *s) {
       break;
     case '\'':
       ctn = 1;
-      if (!in_double_quote) {
-        in_simple_quote = !in_simple_quote;
+      if (not in_double_quote) {
+        in_simple_quote = not in_simple_quote;
         memmove(end, end + 1, strlen(end));
       } else {
         /* simple quote protected by double ones */
@@ -293,8 +293,8 @@ xbt_dynar_t xbt_str_split_quoted_in_place(char *s) {
       break;
     case '"':
       ctn = 1;
-      if (!in_simple_quote) {
-        in_double_quote = !in_double_quote;
+      if (not in_simple_quote) {
+        in_double_quote = not in_double_quote;
         memmove(end, end + 1, strlen(end));
       } else {
         /* double quote protected by simple ones */
@@ -376,7 +376,7 @@ char *xbt_str_join(xbt_dynar_t dyn, const char *sep)
   unsigned int cpt;
   char* cursor;
 
-  if (!dyn_len)
+  if (not dyn_len)
     return xbt_strdup("");
 
   /* compute the length */
@@ -406,7 +406,7 @@ char *xbt_str_join_array(const char *const *strs, const char *sep)
   int amount_strings=0;
   int len=0;
 
-  if ((!strs) || (!strs[0]))
+  if ((not strs) || (not strs[0]))
     return xbt_strdup("");
 
   /* compute the length before malloc */
@@ -471,15 +471,13 @@ double xbt_str_parse_double(const char* str, const char* error_msg)
 
 XBT_TEST_SUITE("xbt_str", "String Handling");
 
-#define mytest(name, input, expected) \
-  xbt_test_add(name); \
-  d=xbt_str_split_quoted(input); \
-  s=xbt_str_join(d,"XXX"); \
-  xbt_test_assert(!strcmp(s,expected),\
-                   "Input (%s) leads to (%s) instead of (%s)", \
-                   input,s,expected);\
-                   free(s); \
-                   xbt_dynar_free(&d);
+#define mytest(name, input, expected)                                                                                  \
+  xbt_test_add(name);                                                                                                  \
+  d = xbt_str_split_quoted(input);                                                                                     \
+  s = xbt_str_join(d, "XXX");                                                                                          \
+  xbt_test_assert(not strcmp(s, expected), "Input (%s) leads to (%s) instead of (%s)", input, s, expected);            \
+  free(s);                                                                                                             \
+  xbt_dynar_free(&d);
 XBT_TEST_UNIT("xbt_str_split_quoted", test_split_quoted, "test the function xbt_str_split_quoted")
 {
   xbt_dynar_t d;
@@ -499,15 +497,13 @@ XBT_TEST_UNIT("xbt_str_split_quoted", test_split_quoted, "test the function xbt_
   mytest("Backslashed quotes + quotes", "'toto \\'tutu' tata", "toto 'tutuXXXtata");
 }
 
-#define mytest_str(name, input, separator, expected) \
-  xbt_test_add(name); \
-  d=xbt_str_split_str(input, separator); \
-  s=xbt_str_join(d,"XXX"); \
-  xbt_test_assert(!strcmp(s,expected),\
-                   "Input (%s) leads to (%s) instead of (%s)", \
-                   input,s,expected);\
-                   free(s); \
-                   xbt_dynar_free(&d);
+#define mytest_str(name, input, separator, expected)                                                                   \
+  xbt_test_add(name);                                                                                                  \
+  d = xbt_str_split_str(input, separator);                                                                             \
+  s = xbt_str_join(d, "XXX");                                                                                          \
+  xbt_test_assert(not strcmp(s, expected), "Input (%s) leads to (%s) instead of (%s)", input, s, expected);            \
+  free(s);                                                                                                             \
+  xbt_dynar_free(&d);
 
 XBT_TEST_UNIT("xbt_str_split_str", test_split_str, "test the function xbt_str_split_str")
 {
index 5841321..2c686cc 100644 (file)
@@ -80,13 +80,13 @@ static int worker(int argc, char *argv[])
     xbt_assert(res == MSG_OK, "MSG_task_get failed");
     XBT_INFO("Handling task \"%s\"", MSG_task_get_name(task));
 
-    if (!strcmp(MSG_task_get_name(task), "finalize")) {
+    if (not strcmp(MSG_task_get_name(task), "finalize")) {
       XBT_INFO("Destroying task \"%s\"", task->name);
       MSG_task_destroy(task);
       break;
     }
 
-    if (!strcmp(MSG_task_get_name(task), "cancel")) {
+    if (not strcmp(MSG_task_get_name(task), "cancel")) {
       MSG_process_create("worker1", worker_main, task, MSG_host_self());
       MSG_process_sleep(0.1);
       XBT_INFO("Canceling task \"%s\"", task->name);
index 4948ed4..c01368f 100644 (file)
@@ -18,7 +18,7 @@ static void server()
   XBT_INFO("Task listen works on regular mailboxes");
   char* res = static_cast<char*>(simgrid::s4u::this_actor::recv(mailbox));
 
-  xbt_assert(!strcmp("Some data", res), "Data received: %s", res);
+  xbt_assert(not strcmp("Some data", res), "Data received: %s", res);
   XBT_INFO("Data successfully received from regular mailbox");
   xbt_free(res);
 
@@ -31,7 +31,7 @@ static void server()
   XBT_INFO("Task listen works on asynchronous mailboxes");
 
   res = static_cast<char*>(simgrid::s4u::this_actor::recv(mailbox2));
-  xbt_assert(!strcmp("More data", res));
+  xbt_assert(not strcmp("More data", res));
   xbt_free(res);
 
   XBT_INFO("Data successfully received from asynchronous mailbox");
index 4a0b6fc..0dbda82 100644 (file)
@@ -64,7 +64,7 @@ static void display_storage_content(simgrid::s4u::Storage* storage)
 {
   XBT_INFO("Print the content of the storage element: %s", storage->name());
   std::map<std::string, sg_size_t*>* content = storage->content();
-  if (!content->empty()) {
+  if (not content->empty()) {
     for (auto entry : *content)
       XBT_INFO("\t%s size: %llu bytes", entry.first.c_str(), *entry.second);
   } else {
@@ -149,7 +149,7 @@ static void server()
   XBT_INFO("Server waiting for transfers ...");
   while (1) {
     char* msg = static_cast<char*>(simgrid::s4u::this_actor::recv(mailbox));
-    if (!strcmp(msg, "finalize")) { // Shutdown ...
+    if (not strcmp(msg, "finalize")) { // Shutdown ...
       xbt_free(msg);
       break;
     } else { // Receive file to save
index d654328..e434b5b 100644 (file)
@@ -31,7 +31,7 @@ static bool parse_cmdline(int* timings, char** platformFile, int argc, char** ar
   bool parse_ok = true;
   for (int i = 1; i < argc; i++) {
     if (std::strlen(argv[i]) > 1 && argv[i][0] == '-' && argv[i][1] == '-') {
-      if (!std::strcmp(argv[i], "--timings")) {
+      if (not std::strcmp(argv[i], "--timings")) {
         *timings = 1;
       } else {
         parse_ok = false;
@@ -80,7 +80,7 @@ static void dump_platform()
     if (hosts[i]->coreCount() > 1) {
       std::printf(" core=\"%d\"", hosts[i]->coreCount());
     }
-    if (props && !xbt_dict_is_empty(props)) {
+    if (props && not xbt_dict_is_empty(props)) {
       std::printf(">\n");
       xbt_dict_foreach (props, cursor, key, data) {
         std::printf("    <prop id=\"%s\" value=\"%s\"/>\n", key, data);
@@ -129,7 +129,7 @@ static void dump_platform()
       std::vector<simgrid::surf::LinkImpl*> route;
       simgrid::kernel::routing::NetPoint* netcardDst = host2->pimpl_netpoint;
       simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(netcardSrc, netcardDst, &route, nullptr);
-      if (!route.empty()) {
+      if (not route.empty()) {
         std::printf("  <route src=\"%s\" dst=\"%s\">\n  ", host1->cname(), host2->cname());
         for (auto link : route)
           std::printf("<link_ctn id=\"%s\"/>", link->cname());
index 7d4323c..6dbca8c 100644 (file)
@@ -94,7 +94,7 @@ static void test(int nb_cnst, int nb_var, int nb_elem, unsigned int pw_base_limi
         l=j;
       fprintf(stderr,"(%i):%i/%i ",i,j,k);
       lmm_constraint_concurrency_maximum_reset(cnst[i]);
-      xbt_assert(!lmm_constraint_concurrency_maximum_get(cnst[i]));
+      xbt_assert(not lmm_constraint_concurrency_maximum_get(cnst[i]));
       if(i%10==9)
         fprintf(stderr,"\n");
     }
@@ -129,14 +129,14 @@ int main(int argc, char **argv)
   }
 
   //what class?
-  if(!strcmp(argv[1],"small"))
-      testclass=0;
-  else if(!strcmp(argv[1],"medium"))
-      testclass=1;
-  else if(!strcmp(argv[1],"big"))
-      testclass=2;
-  else if(!strcmp(argv[1],"huge"))
-      testclass=3;
+  if (not strcmp(argv[1], "small"))
+    testclass = 0;
+  else if (not strcmp(argv[1], "medium"))
+    testclass = 1;
+  else if (not strcmp(argv[1], "big"))
+    testclass = 2;
+  else if (not strcmp(argv[1], "huge"))
+    testclass = 3;
   else {
     fprintf(stderr, "Unknown class \"%s\", aborting!\n",argv[1]);
     return -2;
index 1d7143c..c480421 100644 (file)
@@ -71,7 +71,7 @@ int main(int argc, char**argv)
     } catch(xbt_ex& e) {
       gotit = true;
     }
-    if (!gotit)
+    if (not gotit)
       xbt_die("FAIL: A double-free went undetected (for size:%d)",size_of_block(i));
   }
 
@@ -83,7 +83,7 @@ int main(int argc, char**argv)
     } catch(xbt_ex& e) {
       gotit = true;
     }
-    if (!gotit)
+    if (not gotit)
       xbt_die("FAIL: A double-free went undetected (for size:%d)",size_of_block(i));
   }