Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove all xbt_assert.*(0,FALSE or NULL for xbt_die
authornavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 17 Feb 2011 17:14:29 +0000 (17:14 +0000)
committernavarrop <navarrop@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 17 Feb 2011 17:14:29 +0000 (17:14 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9657 48e7efb5-ca39-0410-a469-dd3cf9ba447f

18 files changed:
examples/msg/alias/masterslave_forwarder_with_alias.c
examples/msg/chord/chord.c
examples/msg/gtnets/gtnets.c
examples/msg/masterslave/masterslave_bypass.c
examples/msg/masterslave/masterslave_cluster.c
examples/msg/masterslave/masterslave_failure.c
examples/msg/masterslave/masterslave_forwarder.c
examples/msg/sendrecv/sendrecv.c
src/msg/host.c
src/simdag/sd_task.c
src/surf/gtnets/gtnets_topology.cc
src/surf/network_gtnets.c
src/surf/surf.c
src/surf/surf_routing.c
src/xbt/config.c
src/xbt/dynar.c
testsuite/surf/lmm_usage.c
tools/gras/stub_generator.c

index 807d775..b1aae7f 100644 (file)
@@ -180,7 +180,7 @@ int forwarder(int argc, char *argv[])
       i++;
     } else {
       XBT_INFO("Hey ?! What's up ? ");
-      xbt_assert0(0, "Unexpected behavior");
+      xbt_die( "Unexpected behavior");
     }
   }
 
index 51cf97c..90dd698 100644 (file)
@@ -915,7 +915,7 @@ int main(int argc, char *argv[])
        XBT_DEBUG("Set timeout to %d", timeout);
       }
       else {
-       xbt_assert1(0, "Invalid chord option '%s'", options[0]);
+       xbt_die(bprintf("Invalid chord option '%s'", options[0]));
       }
     }
     options++;
index bd00faf..f63ab58 100644 (file)
@@ -111,7 +111,7 @@ int slave(int argc, char *argv[])
 
   if (a != MSG_OK) {
     XBT_INFO("Hey?! What's up?");
-    xbt_assert0(0, "Unexpected behavior.");
+    xbt_die("Unexpected behavior.");
   }
 
   elapsed_time = MSG_get_clock() - start_time;
index bd81da8..be9403f 100644 (file)
@@ -252,7 +252,7 @@ int slave(int argc, char *argv[])
       MSG_task_destroy(task);
     } else {
       XBT_INFO("Hey ?! What's up ? ");
-      xbt_assert0(0, "Unexpected behavior");
+      xbt_die( "Unexpected behavior");
     }
   }
   XBT_INFO("I'm done. See you!");
index 15a2ecd..3a1cb0c 100644 (file)
@@ -124,8 +124,8 @@ int slave(int argc, char *argv[])
       MSG_task_destroy(task);
     } else {
       XBT_INFO("Hey ?! What's up ? ");
-      xbt_assert0(0, "Unexpected behavior");
-    }
+      xbt_die("Unexpected behavior");
+                                   }
   }
   XBT_INFO("I'm done. See you!");
   return 0;
index 901d08c..604af18 100644 (file)
@@ -96,7 +96,7 @@ int master(int argc, char *argv[])
       MSG_task_destroy(task);
     } else {
       XBT_INFO("Hey ?! What's up ? ");
-      xbt_assert0(0, "Unexpected behavior");
+      xbt_die( "Unexpected behavior");
     }
   }
 
@@ -124,8 +124,8 @@ int master(int argc, char *argv[])
       MSG_task_destroy(task);
     } else {
       XBT_INFO("Hey ?! What's up ? ");
-      xbt_assert2(0, "Unexpected behavior with '%s': %d", slaves[i]->name,
-                  a);
+      xbt_die(bprintf("Unexpected behavior with '%s': %d", slaves[i]->name,
+                  a));
     }
   }
 
@@ -166,7 +166,7 @@ int slave(int argc, char *argv[])
         return 0;
       } else {
         XBT_INFO("Hey ?! What's up ? ");
-        xbt_assert0(0, "Unexpected behavior");
+        xbt_die("Unexpected behavior");
       }
     } else if (a == MSG_HOST_FAILURE) {
       XBT_INFO
@@ -176,7 +176,7 @@ int slave(int argc, char *argv[])
       XBT_INFO("Mmh. Something went wrong. Nevermind. Let's keep going!");
     } else {
       XBT_INFO("Hey ?! What's up ? ");
-      xbt_assert0(0, "Unexpected behavior");
+      xbt_die("Unexpected behavior");
     }
   }
   XBT_INFO("I'm done. See you!");
index efcb433..4055876 100644 (file)
@@ -166,7 +166,7 @@ int forwarder(int argc, char *argv[])
       i++;
     } else {
       XBT_INFO("Hey ?! What's up ? ");
-      xbt_assert0(0, "Unexpected behavior");
+      xbt_die("Unexpected behavior");
     }
   }
   xbt_free(slaves);
index 97f162d..cd5ea88 100644 (file)
@@ -102,7 +102,7 @@ int receiver(int argc, char *argv[])
     XBT_INFO("Communic. time %le", communication_time);
     XBT_INFO("--- la %f ----", communication_time);
   } else {
-    xbt_assert0(0, "Unexpected behavior");
+    xbt_die("Unexpected behavior");
   }
 
 
@@ -119,7 +119,7 @@ int receiver(int argc, char *argv[])
     XBT_INFO("Communic. time %le", communication_time);
     XBT_INFO("--- bw %f ----", task_comm_size_bw / communication_time);
   } else {
-    xbt_assert0(0, "Unexpected behavior");
+    xbt_die("Unexpected behavior");
   }
 
 
index f5cbf87..20541bc 100644 (file)
@@ -180,7 +180,7 @@ m_host_t *MSG_get_host_table(void)
 int MSG_get_host_msgload(m_host_t h)
 {
   xbt_assert0((h != NULL), "Invalid parameters");
-  xbt_assert0(0, "Not implemented yet");
+  xbt_die( "Not implemented yet");
 
   return (0);
 }
index d1d9f1a..57a5995 100644 (file)
@@ -158,7 +158,7 @@ void __SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state)
     task->state_set = sd_global->failed_task_set;
     break;
   default:
-    xbt_assert0(0, "Invalid state");
+    xbt_die( "Invalid state");
   }
   xbt_swag_insert(task, task->state_set);
   task->state = new_state;
index b022bc7..7df843c 100644 (file)
@@ -358,7 +358,7 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){
       
   }
   else{
-    xbt_assert0(0, "Shouldn't be here");
+    xbt_die("Shouldn't be here");
   }
 
   return 0;
index 804a20a..dd73d52 100644 (file)
@@ -42,7 +42,7 @@ static void link_new(char *name, double bw, double lat, xbt_dict_t props)
            link_count, name, lat, bw);
 
   if (gtnets_add_link(link_count, bw, lat)) {
-         xbt_assert0(0, "Cannot create GTNetS link");
+         xbt_die("Cannot create GTNetS link");
   }
   gtnets_link->id = link_count;
 
@@ -69,7 +69,7 @@ static void route_new(int src_id, int dst_id, xbt_dynar_t links,
   }
 
   if (gtnets_add_route(src_id, dst_id, gtnets_links, nb_link)) {
-    xbt_assert0(0, "Cannot create GTNetS route");
+    xbt_die("Cannot create GTNetS route");
   }
   XBT_OUT();
 }
@@ -78,7 +78,7 @@ static void route_onehop_new(int src_id, int dst_id,
                              network_link_GTNETS_t link)
 {
   if (gtnets_add_onehop_route(src_id, dst_id, link->id)) {
-    xbt_assert0(0, "Cannot create GTNetS route");
+    xbt_die("Cannot create GTNetS route");
   }
 }
 
@@ -174,8 +174,7 @@ static void define_callbacks(const char *file)
 
 static int resource_used(void *resource_id)
 {
-  xbt_assert0(0,
-              "The resource_used feature is not implemented in GTNets model");
+  xbt_die("The resource_used feature is not implemented in GTNets model");
 }
 
 static int action_unref(surf_action_t action)
@@ -195,13 +194,13 @@ static int action_unref(surf_action_t action)
 
 static void action_cancel(surf_action_t action)
 {
-  xbt_assert0(0, "Cannot cancel GTNetS flow");
+  xbt_die("Cannot cancel GTNetS flow");
   return;
 }
 
 static void action_recycle(surf_action_t action)
 {
-  xbt_assert0(0, "Cannot recycle GTNetS flow");
+  xbt_die("Cannot recycle GTNetS flow");
   return;
 }
 
@@ -255,12 +254,10 @@ static void update_actions_state(double now, double delta)
     num_flows = 0;
 
     if (gtnets_run_until_next_flow_completion(&metadata, &num_flows)) {
-      xbt_assert0(0,
-                  "Cannot run GTNetS simulation until next flow completion");
+      xbt_die("Cannot run GTNetS simulation until next flow completion");
     }
     if (num_flows < 1) {
-      xbt_assert0(0,
-                  "GTNetS simulation couldn't find a flow that would complete");
+      xbt_die("GTNetS simulation couldn't find a flow that would complete");
     }
 
     xbt_swag_foreach(action, running_actions) {
@@ -315,7 +312,7 @@ static void update_actions_state(double now, double delta)
 
   } else {                      /* run for a given number of seconds */
     if (gtnets_run(delta)) {
-      xbt_assert0(0, "Cannot run GTNetS simulation");
+      xbt_die("Cannot run GTNetS simulation");
     }
   }
 
@@ -326,7 +323,7 @@ static void update_resource_state(void *id,
                                   tmgr_trace_event_t event_type,
                                   double value, double date)
 {
-  xbt_assert0(0, "Cannot update model state for GTNetS simulation");
+  xbt_die("Cannot update model state for GTNetS simulation");
 }
 
 /* Max durations are not supported */
@@ -357,8 +354,8 @@ static surf_action_t communicate(const char *src_name,
 
   /* Add a flow to the GTNets Simulation, associated to this action */
   if (gtnets_create_flow(src, dst, size, (void *) action) < 0) {
-    xbt_assert2(0, "Not route between host %s and host %s", src_name,
-                dst_name);
+    xbt_die(bprintf("Not route between host %s and host %s", src_name,
+                dst_name));
   }
 #ifdef HAVE_TRACING
   TRACE_surf_gtnets_communicate(action, src, dst);
@@ -417,7 +414,7 @@ static void surf_network_model_init_internal(void)
 
   /* Added the initialization for GTNetS interface */
   if (gtnets_initialize(sg_tcp_gamma)) {
-    xbt_assert0(0, "Impossible to initialize GTNetS interface");
+    xbt_die("Impossible to initialize GTNetS interface");
   }
 
   routing_model_create(sizeof(network_link_GTNETS_t), NULL, NULL);
index 0ef93c9..2135195 100644 (file)
@@ -203,8 +203,8 @@ int find_model_description(s_surf_model_description_t * table,
     strcat(name_list, ", ");
     strcat(name_list, table[i].name);
   }
-  xbt_assert2(0, "Model '%s' is invalid! Valid models are: %s.", name,
-              name_list);
+  xbt_die(bprintf("Model '%s' is invalid! Valid models are: %s.", name,
+              name_list));
   return -1;
 }
 
index 8f84e71..3b6d308 100644 (file)
@@ -2504,9 +2504,9 @@ static char *remplace(char *value, const char **src_list, int src_size,
         param_list = dst_list;
         param_size = dst_size;
       } else {
-        xbt_assert2(0,
+        xbt_die(bprintf(
                     "bad string parameter, support only \"src\" and \"dst\", at offset: %d (\"%s\")",
-                    i, value);
+                    i, value));
       }
       i = i + 3;
 
@@ -2594,7 +2594,7 @@ static route_extended_t rulebased_get_route(routing_component_t rc,
       (routing_component_rulebased_t) rc;
 
   int are_processing_units=0;
-  xbt_dynar_t rule_list = NULL;
+  xbt_dynar_t rule_list;
   if (xbt_dict_get_or_null(routing->dict_processing_units, src)
       && xbt_dict_get_or_null(routing->dict_processing_units, dst)) {
     are_processing_units = 1;
@@ -2605,9 +2605,8 @@ static route_extended_t rulebased_get_route(routing_component_t rc,
     are_processing_units = 0;
     rule_list = routing->list_ASroute;
   } else
-    xbt_assert2(NULL,
-                "Ask for route \"from\"(%s)  or \"to\"(%s) no found in the local table",
-                src, dst);
+    xbt_die(bprintf("Ask for route \"from\"(%s)  or \"to\"(%s) no found in the local table",
+                src, dst));
 
   int rc_src = -1;
   int rc_dst = -1;
index e1b21e3..138076c 100644 (file)
@@ -547,8 +547,8 @@ void xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa)
     break;
 
   default:
-    xbt_assert2(0, "Config element variable %s not valid (type=%d)", name,
-                type);
+    xbt_die(bprintf("Config element variable %s not valid (type=%d)", name,
+                type));
   }
 }
 
@@ -645,9 +645,9 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options)
     val = strchr(name, ':');
     if (!val) {
       free(optionlist_cpy);
-      xbt_assert1(FALSE,
+      xbt_die(bprintf(
                   "Option '%s' badly formated. Should be of the form 'name:value'",
-                  name);
+                  name));
     }
     *(val++) = '\0';
 
@@ -679,9 +679,9 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options)
         i = strtol(val, &val, 0);
         if (val == NULL) {
           free(optionlist_cpy);
-          xbt_assert1(FALSE,
+          xbt_die(bprintf(
                       "Value of option %s not valid. Should be an integer",
-                      name);
+                      name));
         }
 
         xbt_cfg_set_int(cfg, name, i);  /* throws */
@@ -691,9 +691,9 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options)
         d = strtod(val, &val);
         if (val == NULL) {
           free(optionlist_cpy);
-          xbt_assert1(FALSE,
+          xbt_die(bprintf(
                       "Value of option %s not valid. Should be a double",
-                      name);
+                      name));
         }
 
         xbt_cfg_set_double(cfg, name, d);       /* throws */
@@ -704,18 +704,18 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options)
         val = strchr(val, ':');
         if (!val) {
           free(optionlist_cpy);
-          xbt_assert1(FALSE,
+          xbt_die(bprintf(
                       "Value of option %s not valid. Should be an peer (machine:port)",
-                      name);
+                      name));
         }
 
         *(val++) = '\0';
         i = strtol(val, &val, 0);
         if (val == NULL) {
           free(optionlist_cpy);
-          xbt_assert1(FALSE,
+          xbt_die(bprintf(
                       "Value of option %s not valid. Should be an peer (machine:port)",
-                      name);
+                      name));
         }
 
         xbt_cfg_set_peer(cfg, name, str, i);    /* throws */
index 47bf4aa..22eb8d2 100644 (file)
@@ -818,7 +818,7 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers")
   xbt_test_add0("==== Traverse the empty dynar");
   d = xbt_dynar_new(sizeof(int), NULL);
   xbt_dynar_foreach(d, cursor, i) {
-    xbt_assert0(0, "Damnit, there is something in the empty dynar");
+    xbt_die( "Damnit, there is something in the empty dynar");
   }
   xbt_dynar_free(&d);           /* This code is used both as example and as regression test, so we try to */
   xbt_dynar_free(&d);           /* free the struct twice here to check that it's ok, but freeing  it only once */
index e6c60cf..2c97818 100644 (file)
@@ -221,7 +221,7 @@ void test1(method_t method)
             a - x, lmm_variable_getvalue(R_1_2_3) - (a - x));
     }
   } else {
-    xbt_assert0(0, "Invalid method");
+    xbt_die( "Invalid method");
   }
 
   PRINT_VAR(R_1_2_3);
@@ -273,7 +273,7 @@ void test2(method_t method)
   } else if (method == LAGRANGE_RENO) {
     lagrange_solve(Sys);
   } else {
-    xbt_assert0(0, "Invalid method");
+    xbt_die("Invalid method");
   }
 
   PRINT_VAR(T1);
@@ -445,7 +445,7 @@ void test3(method_t method)
   } else if (method == LAGRANGE_RENO) {
     lagrange_solve(Sys);
   } else {
-    xbt_assert0(0, "Invalid method");
+    xbt_die("Invalid method");
   }
 
   for (j = 0; j < 16; j++) {
index 4d89eaf..8e3caa7 100644 (file)
@@ -139,7 +139,7 @@ int main(int argc, char *argv[])
     deployment_file = argv[i];
     surf_parse_open(deployment_file);
     if (surf_parse())
-      xbt_assert1(0, "Parse error in %s", deployment_file);
+      xbt_die(bprintf("Parse error in %s", deployment_file));
 
     surf_parse_close();
   }