From 0ca1291c2f63ca6235f4b4885c48413a900aade4 Mon Sep 17 00:00:00 2001 From: agiersch Date: Thu, 24 Mar 2011 16:49:49 +0000 Subject: [PATCH] Remove usage of xbt_assert[0-9]. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9858 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- examples/gras/mmrpc/mmrpc.c | 2 +- examples/gras/mmrpc/mmrpc_client.c | 2 +- examples/gras/pmm/pmm.c | 4 +- examples/gras/properties/properties.c | 8 +- examples/gras/replay/replay.c | 2 +- examples/gras/replay/xbt_workload.c | 2 +- examples/gras/rpc/rpc.c | 18 +-- examples/gras/synchro/philosopher.c | 4 +- examples/msg/actions/actions.c | 8 +- .../alias/masterslave_forwarder_with_alias.c | 8 +- examples/msg/chord/chord.c | 2 +- examples/msg/gtnets/gtnets.c | 2 +- examples/msg/icomms/peer.c | 4 +- examples/msg/icomms/peer2.c | 4 +- examples/msg/icomms/peer3.c | 6 +- examples/msg/masterslave/masterslave_bypass.c | 6 +- .../msg/masterslave/masterslave_cluster.c | 6 +- .../msg/masterslave/masterslave_console.c | 4 +- .../msg/masterslave/masterslave_failure.c | 6 +- .../msg/masterslave/masterslave_forwarder.c | 10 +- .../msg/masterslave/masterslave_mailbox.c | 4 +- examples/msg/parallel_task/test_ptask.c | 10 +- examples/msg/pmm/msg_pmm.c | 2 +- examples/msg/priority/priority.c | 4 +- examples/msg/properties/msg_prop.c | 12 +- examples/simdag/dax/dax_test.c | 2 +- examples/simdag/dot/dot_test.c | 2 +- examples/simdag/dot/simulate_dot.c | 2 +- examples/simdag/scheduling/minmin_test.c | 2 +- examples/simdag/sd_test.c | 2 +- examples/simdag/sd_test_console.c | 2 +- include/xbt/asserts.h | 2 +- include/xbt/ex.h | 2 +- src/amok/Bandwidth/bandwidth.c | 2 +- src/amok/PeerManagement/peermanagement.c | 2 +- src/bindings/lua/lua_stub_generator.c | 8 +- src/bindings/lua/simgrid_lua.c | 8 +- src/gras/DataDesc/cbps.c | 4 +- src/gras/DataDesc/ddt_convert.c | 2 +- src/gras/DataDesc/ddt_create.c | 54 +++---- src/gras/DataDesc/ddt_exchange.c | 32 ++-- src/gras/Msg/gras_msg_exchange.c | 16 +- src/gras/Msg/gras_msg_types.c | 6 +- src/gras/Msg/rl_msg.c | 8 +- src/gras/Msg/rpc.c | 10 +- src/gras/Msg/sg_msg.c | 2 +- src/gras/Transport/transport.c | 22 +-- src/gras/Transport/transport_plugin_file.c | 14 +- src/gras/Transport/transport_plugin_sg.c | 10 +- src/gras/Transport/transport_plugin_tcp.c | 2 +- src/gras/Virtu/gras_module.c | 12 +- src/gras/Virtu/process.c | 2 +- src/gras/Virtu/rl_process.c | 2 +- src/gras/Virtu/sg_emul.c | 8 +- src/gras/Virtu/sg_process.c | 6 +- src/instr/instr_config.c | 6 +- src/instr/instr_interface.c | 6 +- src/instr/instr_msg_task.c | 8 +- src/instr/instr_paje_trace.c | 2 +- src/instr/instr_routing.c | 4 +- src/instr/instr_smpi.c | 4 +- src/mc/memory_map.c | 2 +- src/msg/deployment.c | 2 +- src/msg/global.c | 4 +- src/msg/gos.c | 28 ++-- src/msg/host.c | 18 +-- src/msg/m_process.c | 20 +-- src/msg/msg_actions.c | 4 +- src/msg/msg_mailbox.c | 8 +- src/msg/private.h | 2 +- src/msg/task.c | 30 ++-- src/simdag/private.h | 2 +- src/simdag/sd_daxloader.c | 6 +- src/simdag/sd_dotloader.c | 2 +- src/simdag/sd_global.c | 2 +- src/simdag/sd_link.c | 18 +-- src/simdag/sd_task.c | 88 +++++------ src/simdag/sd_workstation.c | 44 +++--- src/simix/smx_context.c | 2 +- src/simix/smx_context_sysv.c | 8 +- src/simix/smx_deployment.c | 18 +-- src/simix/smx_host.c | 20 +-- src/simix/smx_network.c | 2 +- src/simix/smx_process.c | 6 +- src/simix/smx_synchro.c | 4 +- src/simix/smx_user.c | 14 +- src/smpi/smpi_base.c | 10 +- src/smpi/smpi_bench.c | 6 +- src/surf/cpu.c | 16 +- src/surf/cpu_im.c | 16 +- src/surf/cpu_ti.c | 18 +-- src/surf/gtnets/gtnets_interface.cc | 2 +- src/surf/gtnets/gtnets_simulator.cc | 24 +-- src/surf/gtnets/gtnets_topology.cc | 36 ++--- src/surf/lagrange.c | 22 +-- src/surf/maxmin.c | 8 +- src/surf/network.c | 18 +-- src/surf/network_gtnets.c | 4 +- src/surf/network_im.c | 18 +-- src/surf/surf.c | 2 +- src/surf/surf_action.c | 2 +- src/surf/surf_config.c | 12 +- src/surf/surf_routing.c | 148 +++++++++--------- src/surf/surfxml_parse.c | 12 +- src/surf/trace_mgr.c | 6 +- src/surf/workstation.c | 4 +- src/surf/workstation_ptask_L07.c | 34 ++-- src/xbt/backtrace_linux.c | 2 +- src/xbt/backtrace_windows.c | 2 +- src/xbt/config.c | 20 +-- src/xbt/cunit.c | 10 +- src/xbt/dict.c | 2 +- src/xbt/dict_cursor.c | 2 +- src/xbt/dict_multi.c | 6 +- src/xbt/dynar.c | 4 +- src/xbt/fifo.c | 6 +- src/xbt/graph.c | 8 +- src/xbt/graphxml_parse.c | 4 +- src/xbt/heap.c | 4 +- src/xbt/log.c | 14 +- src/xbt/mallocator.c | 6 +- src/xbt/set.c | 2 +- src/xbt/setset.c | 2 +- src/xbt/swag.c | 6 +- src/xbt/xbt_log_layout_simple.c | 4 +- src/xbt/xbt_matrix.c | 2 +- src/xbt/xbt_peer.c | 2 +- src/xbt/xbt_replay_trace_reader.c | 2 +- src/xbt/xbt_sg_synchro.c | 2 +- teshsuite/gras/datadesc/datadesc_usage.c | 24 +-- teshsuite/gras/msg_handle/msg_handle.c | 14 +- teshsuite/msg/get_sender.c | 2 +- .../simdag/network/p2p/test_latency_bound.c | 2 +- tools/gras/stub_generator.c | 2 +- tools/gras/unix_stub_generator.c | 8 +- tools/tesh/tesh.c | 2 +- 136 files changed, 678 insertions(+), 678 deletions(-) diff --git a/examples/gras/mmrpc/mmrpc.c b/examples/gras/mmrpc/mmrpc.c index 4ee656766c..8f8e88270e 100644 --- a/examples/gras/mmrpc/mmrpc.c +++ b/examples/gras/mmrpc/mmrpc.c @@ -163,7 +163,7 @@ int client(int argc, char *argv[]) */ for (i = 0; i < MATSIZE; i++) for (j = 0; i < MATSIZE; i++) - xbt_assert4(xbt_matrix_get_as(answer, i, j, double) == + xbt_assert(xbt_matrix_get_as(answer, i, j, double) == xbt_matrix_get_as(request[1], i, j, double), "Answer does not match expectations. Found %f at cell %d,%d instead of %f", xbt_matrix_get_as(answer, i, j, double), i, j, diff --git a/examples/gras/mmrpc/mmrpc_client.c b/examples/gras/mmrpc/mmrpc_client.c index e139989dd5..ec62e3690e 100644 --- a/examples/gras/mmrpc/mmrpc_client.c +++ b/examples/gras/mmrpc/mmrpc_client.c @@ -85,7 +85,7 @@ int client(int argc, char *argv[]) */ for (i = 0; i < MATSIZE; i++) for (j = 0; i < MATSIZE; i++) - xbt_assert4(xbt_matrix_get_as(answer, i, j, double) == + xbt_assert(xbt_matrix_get_as(answer, i, j, double) == xbt_matrix_get_as(request[1], i, j, double), "Answer does not match expectations. Found %f at cell %d,%d instead of %f", xbt_matrix_get_as(answer, i, j, double), i, j, diff --git a/examples/gras/pmm/pmm.c b/examples/gras/pmm/pmm.c index c2f570664b..dbc87c65f9 100644 --- a/examples/gras/pmm/pmm.c +++ b/examples/gras/pmm/pmm.c @@ -108,7 +108,7 @@ int master(int argc, char *argv[]) C = xbt_matrix_double_new_zeros(DATA_MATRIX_SIZE, DATA_MATRIX_SIZE); /* Create the connexions */ - xbt_assert0(argc > 1, "Usage: master "); + xbt_assert(argc > 1, "Usage: master "); gras_socket_server(atoi(argv[1])); peers = amok_pm_group_new("pmm"); @@ -126,7 +126,7 @@ int master(int argc, char *argv[]) xbt_dynar_get_cpy(peers, i, &grid[i]); socket[i] = gras_socket_client(grid[i]->name, grid[i]->port); } - xbt_assert2(i == SLAVE_COUNT, + xbt_assert(i == SLAVE_COUNT, "Not enough slaves for this setting (got %d of %d). Change the deployment file", i, SLAVE_COUNT); diff --git a/examples/gras/properties/properties.c b/examples/gras/properties/properties.c index 8f93be050e..358df121c5 100644 --- a/examples/gras/properties/properties.c +++ b/examples/gras/properties/properties.c @@ -37,18 +37,18 @@ int alice(int argc, char *argv[]) XBT_INFO("== Try to get a process property that does not exist"); value = gras_process_property_value("Nonexisting"); - xbt_assert0(!value, "nonexisting property exists!!"); + xbt_assert(!value, "nonexisting property exists!!"); /* Modify an existing property. First check it exists */ XBT_INFO("== Trying to modify a process property"); value = gras_process_property_value("new prop"); - xbt_assert0(!value, "Property 'new prop' exists before I add it!"); + xbt_assert(!value, "Property 'new prop' exists before I add it!"); xbt_dict_set(process_props, "new prop", xbt_strdup("new value"), xbt_free_f); /* Test if we have changed the value */ value = gras_process_property_value("new prop"); - xbt_assert1(!strcmp(value, "new value"), + xbt_assert(!strcmp(value, "new value"), "New property does have the value I've set ('%s' != 'new value')", value); @@ -72,7 +72,7 @@ int bob(int argc, char *argv[]) XBT_INFO("== Try to get a property that does not exist"); value = gras_os_host_property_value("non existing key"); - xbt_assert1(value == NULL, + xbt_assert(value == NULL, "The key 'non existing key' exists (with value '%s')!!", value); diff --git a/examples/gras/replay/replay.c b/examples/gras/replay/replay.c index cb5785a136..6a79238a92 100644 --- a/examples/gras/replay/replay.c +++ b/examples/gras/replay/replay.c @@ -46,7 +46,7 @@ int master(int argc, char *argv[]) declare_msg(); - xbt_assert0(argc == 3, "usage: replay_master tracefile port"); + xbt_assert(argc == 3, "usage: replay_master tracefile port"); gras_socket_server(atoi(argv[2])); /* open my master socket, even if I don't use it */ xbt_dynar_t peers = amok_pm_group_new("replay"); /* group of slaves */ xbt_peer_t peer; diff --git a/examples/gras/replay/xbt_workload.c b/examples/gras/replay/xbt_workload.c index f3a8a79855..f3b3ddf2c2 100644 --- a/examples/gras/replay/xbt_workload.c +++ b/examples/gras/replay/xbt_workload.c @@ -157,7 +157,7 @@ xbt_dynar_t xbt_workload_parse_file(char *filename) { FILE *file_in; file_in = fopen(filename, "r"); - xbt_assert1(file_in, "cannot open tracefile '%s'", filename); + xbt_assert(file_in, "cannot open tracefile '%s'", filename); char *str_in = xbt_str_from_file(file_in); fclose(file_in); xbt_dynar_t in = xbt_str_split(str_in, "\n"); diff --git a/examples/gras/rpc/rpc.c b/examples/gras/rpc/rpc.c index da1e116592..90864543ad 100644 --- a/examples/gras/rpc/rpc.c +++ b/examples/gras/rpc/rpc.c @@ -46,11 +46,11 @@ static void exception_catching(void) if (!gotit) { THROWF(unknown_error, 0, "Didn't got the remote exception!"); } - xbt_assert2(e.category == unknown_error, + xbt_assert(e.category == unknown_error, "Got wrong category: %d (instead of %d)", e.category, unknown_error); - xbt_assert1(e.value == 42, "Got wrong value: %d (!=42)", e.value); - xbt_assert1(!strncmp(e.msg, exception_msg, strlen(exception_msg)), + xbt_assert(e.value == 42, "Got wrong value: %d (!=42)", e.value); + xbt_assert(!strncmp(e.msg, exception_msg, strlen(exception_msg)), "Got wrong message: %s", e.msg); xbt_ex_free(e); } @@ -138,11 +138,11 @@ int client(int argc, char *argv[]) } CATCH(e) { gotit = 1; - xbt_assert2(e.category == unknown_error, + xbt_assert(e.category == unknown_error, "Got wrong category: %d (instead of %d)", e.category, unknown_error); - xbt_assert1(e.value == 42, "Got wrong value: %d (!=42)", e.value); - xbt_assert1(!strncmp(e.msg, exception_msg, strlen(exception_msg)), + xbt_assert(e.value == 42, "Got wrong value: %d (!=42)", e.value); + xbt_assert(!strncmp(e.msg, exception_msg, strlen(exception_msg)), "Got wrong message: %s", e.msg); XBT_INFO ("Got the expected exception when calling the exception raising RPC"); @@ -185,10 +185,10 @@ int client(int argc, char *argv[]) if (!gotit) { THROWF(unknown_error, 0, "Didn't got the remote exception!"); } - xbt_assert1(e.value == 42, "Got wrong value: %d (!=42)", e.value); - xbt_assert1(!strncmp(e.msg, exception_msg, strlen(exception_msg)), + xbt_assert(e.value == 42, "Got wrong value: %d (!=42)", e.value); + xbt_assert(!strncmp(e.msg, exception_msg, strlen(exception_msg)), "Got wrong message: %s", e.msg); - xbt_assert2(e.category == unknown_error, + xbt_assert(e.category == unknown_error, "Got wrong category: %d (instead of %d)", e.category, unknown_error); XBT_INFO diff --git a/examples/gras/synchro/philosopher.c b/examples/gras/synchro/philosopher.c index dc5a69362c..726f6b5d61 100644 --- a/examples/gras/synchro/philosopher.c +++ b/examples/gras/synchro/philosopher.c @@ -35,7 +35,7 @@ static void pickup(int id, int lunch) } state[id] = EATING; - xbt_assert1(state[(id + (philosopher_amount - 1)) % philosopher_amount] + xbt_assert(state[(id + (philosopher_amount - 1)) % philosopher_amount] == THINKING && state[(id + 1) % philosopher_amount] == THINKING, "Philosopher %d eats at the same time that one of its neighbors!!!", @@ -100,7 +100,7 @@ int philosopher(int argc, char *argv[]) xbt_thread_t *philosophers; gras_init(&argc, argv); - xbt_assert0(argc >= 2, + xbt_assert(argc >= 2, "This program expects one argument (the amount of philosophers)"); /* initializations of the philosopher mecanisms */ diff --git a/examples/msg/actions/actions.c b/examples/msg/actions/actions.c index f764cb64e7..86768803c5 100644 --- a/examples/msg/actions/actions.c +++ b/examples/msg/actions/actions.c @@ -259,7 +259,7 @@ static void action_wait(const char *const *action) double clock = MSG_get_clock(); process_globals_t globals = (process_globals_t) MSG_process_get_data(MSG_process_self()); - xbt_assert1(xbt_dynar_length(globals->irecvs), + xbt_assert(xbt_dynar_length(globals->irecvs), "action wait not preceded by any irecv: %s", xbt_str_join_array(action," ")); if (XBT_LOG_ISENABLED(actions, xbt_log_priority_verbose)) @@ -342,7 +342,7 @@ static void action_reduce(const char *const *action) process_globals_t counters = (process_globals_t) MSG_process_get_data(MSG_process_self()); - xbt_assert0(communicator_size, "Size of Communicator is not defined, " + xbt_assert(communicator_size, "Size of Communicator is not defined, " "can't use collective operations"); process_name = MSG_process_get_name(MSG_process_self()); @@ -395,7 +395,7 @@ static void action_bcast(const char *const *action) process_globals_t counters = (process_globals_t) MSG_process_get_data(MSG_process_self()); - xbt_assert0(communicator_size, "Size of Communicator is not defined, " + xbt_assert(communicator_size, "Size of Communicator is not defined, " "can't use collective operations"); process_name = MSG_process_get_name(MSG_process_self()); @@ -462,7 +462,7 @@ static void action_allReduce(const char *const *action) { process_globals_t counters = (process_globals_t) MSG_process_get_data(MSG_process_self()); - xbt_assert0(communicator_size, "Size of Communicator is not defined, " + xbt_assert(communicator_size, "Size of Communicator is not defined, " "can't use collective operations"); process_name = MSG_process_get_name(MSG_process_self()); diff --git a/examples/msg/alias/masterslave_forwarder_with_alias.c b/examples/msg/alias/masterslave_forwarder_with_alias.c index 19e967f644..6f4a70baa1 100644 --- a/examples/msg/alias/masterslave_forwarder_with_alias.c +++ b/examples/msg/alias/masterslave_forwarder_with_alias.c @@ -42,11 +42,11 @@ int master(int argc, char *argv[]) int read; read = sscanf(argv[1], "%d", &number_of_tasks); - xbt_assert1(read, "Invalid argument %s\n", argv[1]); + xbt_assert(read, "Invalid argument %s\n", argv[1]); read = sscanf(argv[2], "%lg", &task_comp_size); - xbt_assert1(read, "Invalid argument %s\n", argv[2]); + xbt_assert(read, "Invalid argument %s\n", argv[2]); read = sscanf(argv[3], "%lg", &task_comm_size); - xbt_assert1(read, "Invalid argument %s\n", argv[3]); + xbt_assert(read, "Invalid argument %s\n", argv[3]); { /* Task creation */ @@ -115,7 +115,7 @@ int slave(int argc, char *argv[]) while (1) { res = MSG_task_receive(&(task), MSG_host_get_name(MSG_host_self())); - xbt_assert0(res == MSG_OK, "MSG_task_receive failed"); + xbt_assert(res == MSG_OK, "MSG_task_receive failed"); XBT_INFO("Received \"%s\"", MSG_task_get_name(task)); diff --git a/examples/msg/chord/chord.c b/examples/msg/chord/chord.c index ee4a351772..3c287b7d41 100644 --- a/examples/msg/chord/chord.c +++ b/examples/msg/chord/chord.c @@ -272,7 +272,7 @@ int node(int argc, char *argv[]) double next_check_predecessor_date = init_time + periodic_check_predecessor_delay; double next_lookup_date = init_time + periodic_lookup_delay; - xbt_assert0(argc == 3 || argc == 5, "Wrong number of arguments for this node"); + xbt_assert(argc == 3 || argc == 5, "Wrong number of arguments for this node"); // initialize my node s_node_t node = {0}; diff --git a/examples/msg/gtnets/gtnets.c b/examples/msg/gtnets/gtnets.c index d48e5c513b..8153d9bb28 100644 --- a/examples/msg/gtnets/gtnets.c +++ b/examples/msg/gtnets/gtnets.c @@ -53,7 +53,7 @@ int master(int argc, char *argv[]) /* data size */ int read; read = sscanf(argv[1], "%lg", &task_comm_size); - xbt_assert1(read, "Invalid argument %s\n", argv[1]); + xbt_assert(read, "Invalid argument %s\n", argv[1]); /* slave name */ slavename = argv[2]; diff --git a/examples/msg/icomms/peer.c b/examples/msg/icomms/peer.c index 501ec38462..17f10609a8 100644 --- a/examples/msg/icomms/peer.c +++ b/examples/msg/icomms/peer.c @@ -97,7 +97,7 @@ int receiver(int argc, char *argv[]) int read; read = sscanf(argv[1], "%d", &id); - xbt_assert1(read, + xbt_assert(read, "Invalid argument %s\n", argv[1]); MSG_process_sleep(sleep_start_time); @@ -109,7 +109,7 @@ int receiver(int argc, char *argv[]) if (sleep_test_time == 0) { res = MSG_comm_wait(res_irecv, -1); - xbt_assert0(res == MSG_OK, "MSG_task_get failed"); + xbt_assert(res == MSG_OK, "MSG_task_get failed"); } else { while (MSG_comm_test(res_irecv) == 0) { MSG_process_sleep(sleep_test_time); diff --git a/examples/msg/icomms/peer2.c b/examples/msg/icomms/peer2.c index 0c2871905b..d068417d7c 100644 --- a/examples/msg/icomms/peer2.c +++ b/examples/msg/icomms/peer2.c @@ -68,14 +68,14 @@ int receiver(int argc, char *argv[]) msg_comm_t res_irecv; int read; read = sscanf(argv[1], "%d", &id); - xbt_assert1(read, "Invalid argument %s\n", argv[1]); + xbt_assert(read, "Invalid argument %s\n", argv[1]); MSG_process_sleep(10); sprintf(mailbox, "receiver-%d", id); while (1) { res_irecv = MSG_task_irecv(&(task), mailbox); XBT_INFO("Wait to receive a task"); res = MSG_comm_wait(res_irecv, -1); - xbt_assert0(res == MSG_OK, "MSG_task_get failed"); + xbt_assert(res == MSG_OK, "MSG_task_get failed"); XBT_INFO("Received \"%s\"", MSG_task_get_name(task)); if (!strcmp(MSG_task_get_name(task), "finalize")) { MSG_task_destroy(task); diff --git a/examples/msg/icomms/peer3.c b/examples/msg/icomms/peer3.c index ffde17484a..c9d126b696 100644 --- a/examples/msg/icomms/peer3.c +++ b/examples/msg/icomms/peer3.c @@ -69,7 +69,7 @@ int sender(int argc, char *argv[]) task = NULL; res_irecv = MSG_task_irecv(&(task), mailbox); res_wait = MSG_comm_wait(res_irecv, -1); - xbt_assert0(res_wait == MSG_OK, "MSG_comm_wait failed"); + xbt_assert(res_wait == MSG_OK, "MSG_comm_wait failed"); MSG_comm_destroy(res_irecv); MSG_task_destroy(task); } @@ -90,7 +90,7 @@ int receiver(int argc, char *argv[]) int read; read = sscanf(argv[1], "%d", &id); - xbt_assert1(read, "Invalid argument %s\n", argv[1]); + xbt_assert(read, "Invalid argument %s\n", argv[1]); sprintf(mailbox, "receiver-%d", id); MSG_process_sleep(10); msg_comm_t res_irecv; @@ -112,7 +112,7 @@ int receiver(int argc, char *argv[]) MSG_task_execute(task_com); XBT_INFO("\"%s\" done", MSG_task_get_name(task_com)); err = MSG_task_destroy(task_com); - xbt_assert0(err == MSG_OK, "MSG_task_destroy failed"); + xbt_assert(err == MSG_OK, "MSG_task_destroy failed"); } xbt_dynar_free(&comms); xbt_free(task); diff --git a/examples/msg/masterslave/masterslave_bypass.c b/examples/msg/masterslave/masterslave_bypass.c index 2a446232d0..d5e47f3f1c 100644 --- a/examples/msg/masterslave/masterslave_bypass.c +++ b/examples/msg/masterslave/masterslave_bypass.c @@ -171,11 +171,11 @@ int master(int argc, char *argv[]) int read; read = sscanf(argv[1], "%d", &number_of_tasks); - xbt_assert1(read, "Invalid argument %s\n", argv[1]); + xbt_assert(read, "Invalid argument %s\n", argv[1]); read = sscanf(argv[2], "%lg", &task_comp_size); - xbt_assert1(read, "Invalid argument %s\n", argv[2]); + xbt_assert(read, "Invalid argument %s\n", argv[2]); read = sscanf(argv[3], "%lg", &task_comm_size); - xbt_assert1(read, "Invalid argument %s\n", argv[3]); + xbt_assert(read, "Invalid argument %s\n", argv[3]); { /* Task creation */ char sprintf_buffer[64]; diff --git a/examples/msg/masterslave/masterslave_cluster.c b/examples/msg/masterslave/masterslave_cluster.c index d58b53fee4..f29388183a 100644 --- a/examples/msg/masterslave/masterslave_cluster.c +++ b/examples/msg/masterslave/masterslave_cluster.c @@ -40,11 +40,11 @@ int master(int argc, char *argv[]) int read; read = sscanf(argv[1], "%d", &number_of_tasks); - xbt_assert1(read, "Invalid argument %s\n", argv[1]); + xbt_assert(read, "Invalid argument %s\n", argv[1]); read = sscanf(argv[2], "%lg", &task_comp_size); - xbt_assert1(read, "Invalid argument %s\n", argv[2]); + xbt_assert(read, "Invalid argument %s\n", argv[2]); read = sscanf(argv[3], "%lg", &task_comm_size); - xbt_assert1(read, "Invalid argument %s\n", argv[3]); + xbt_assert(read, "Invalid argument %s\n", argv[3]); { /* Task creation */ char sprintf_buffer[64]; diff --git a/examples/msg/masterslave/masterslave_console.c b/examples/msg/masterslave/masterslave_console.c index 0580cd29cd..fc1b7573f7 100644 --- a/examples/msg/masterslave/masterslave_console.c +++ b/examples/msg/masterslave/masterslave_console.c @@ -74,13 +74,13 @@ int slave(int argc, char *argv[]) int read; read = sscanf(argv[1], "%d", &id); - xbt_assert1(read, "Invalid argument %s\n", argv[1]); + xbt_assert(read, "Invalid argument %s\n", argv[1]); sprintf(mailbox, "slave-%d", id); while (1) { res = MSG_task_receive(&(task), mailbox); - xbt_assert0(res == MSG_OK, "MSG_task_get failed"); + xbt_assert(res == MSG_OK, "MSG_task_get failed"); XBT_INFO("Received \"%s\"", MSG_task_get_name(task)); if (!strcmp(MSG_task_get_name(task), "finalize")) { diff --git a/examples/msg/masterslave/masterslave_failure.c b/examples/msg/masterslave/masterslave_failure.c index 628e77d154..58d0e4acb5 100644 --- a/examples/msg/masterslave/masterslave_failure.c +++ b/examples/msg/masterslave/masterslave_failure.c @@ -39,11 +39,11 @@ int master(int argc, char *argv[]) int read; read = sscanf(argv[1], "%d", &number_of_tasks); - xbt_assert1(read, "Invalid argument %s\n", argv[1]); + xbt_assert(read, "Invalid argument %s\n", argv[1]); read = sscanf(argv[2], "%lg", &task_comp_size); - xbt_assert1(read, "Invalid argument %s\n", argv[2]); + xbt_assert(read, "Invalid argument %s\n", argv[2]); read = sscanf(argv[3], "%lg", &task_comm_size); - xbt_assert1(read, "Invalid argument %s\n", argv[3]); + xbt_assert(read, "Invalid argument %s\n", argv[3]); { /* Process organisation */ slaves_count = argc - 4; diff --git a/examples/msg/masterslave/masterslave_forwarder.c b/examples/msg/masterslave/masterslave_forwarder.c index 4055876afe..d02543ea49 100644 --- a/examples/msg/masterslave/masterslave_forwarder.c +++ b/examples/msg/masterslave/masterslave_forwarder.c @@ -40,11 +40,11 @@ int master(int argc, char *argv[]) int i; int res = sscanf(argv[1], "%d", &number_of_tasks); - xbt_assert1(res,"Invalid argument %s\n", argv[1]); + xbt_assert(res,"Invalid argument %s\n", argv[1]); res = sscanf(argv[2], "%lg", &task_comp_size); - xbt_assert1(res, "Invalid argument %s\n", argv[2]); + xbt_assert(res, "Invalid argument %s\n", argv[2]); res = sscanf(argv[3], "%lg", &task_comm_size); - xbt_assert1(res, "Invalid argument %s\n", argv[3]); + xbt_assert(res, "Invalid argument %s\n", argv[3]); { /* Task creation */ char sprintf_buffer[64]; @@ -65,7 +65,7 @@ int master(int argc, char *argv[]) for (i = 4; i < argc; i++) { slaves[i - 4] = MSG_get_host_by_name(argv[i]); - xbt_assert1(slaves[i - 4] != NULL, "Unknown host %s. Stopping Now! ", + xbt_assert(slaves[i - 4] != NULL, "Unknown host %s. Stopping Now! ", argv[i]); } } @@ -106,7 +106,7 @@ int slave(int argc, char *argv[]) int res; while (1) { res = MSG_task_get(&(task), PORT_22); - xbt_assert0(res == MSG_OK, "MSG_task_get failed"); + xbt_assert(res == MSG_OK, "MSG_task_get failed"); XBT_INFO("Received \"%s\"", MSG_task_get_name(task)); if (!strcmp(MSG_task_get_name(task), "finalize")) { diff --git a/examples/msg/masterslave/masterslave_mailbox.c b/examples/msg/masterslave/masterslave_mailbox.c index fd81fcb7f8..d37e755e94 100644 --- a/examples/msg/masterslave/masterslave_mailbox.c +++ b/examples/msg/masterslave/masterslave_mailbox.c @@ -74,13 +74,13 @@ int slave(int argc, char *argv[]) int read; read = sscanf(argv[1], "%d", &id); - xbt_assert1(read, "Invalid argument %s\n", argv[1]); + xbt_assert(read, "Invalid argument %s\n", argv[1]); sprintf(mailbox, "slave-%d", id); while (1) { res = MSG_task_receive(&(task), mailbox); - xbt_assert0(res == MSG_OK, "MSG_task_get failed"); + xbt_assert(res == MSG_OK, "MSG_task_get failed"); // XBT_INFO("Received \"%s\"", MSG_task_get_name(task)); if (!strcmp(MSG_task_get_name(task), "finalize")) { diff --git a/examples/msg/parallel_task/test_ptask.c b/examples/msg/parallel_task/test_ptask.c index f4a79a4e24..80fe67ba2b 100644 --- a/examples/msg/parallel_task/test_ptask.c +++ b/examples/msg/parallel_task/test_ptask.c @@ -45,15 +45,15 @@ int execute(int argc, char *argv[]) m_host_list = calloc(host_list_size, sizeof(m_host_t)); for (i = 1; i <= host_list_size; i++) { m_host_list[i - 1] = MSG_get_host_by_name(argv[i]); - xbt_assert1(m_host_list[i - 1] != NULL, + xbt_assert(m_host_list[i - 1] != NULL, "Unknown host %s. Stopping Now! ", argv[i]); } int read; read = sscanf(argv[argc - 2], "%lg", &computation_amount); - xbt_assert1(read, "Invalid argument %s\n", argv[argc - 2]); + xbt_assert(read, "Invalid argument %s\n", argv[argc - 2]); read = sscanf(argv[argc - 1], "%lg", &communication_amount); - xbt_assert1(read, "Invalid argument %s\n", argv[argc - 1]); + xbt_assert(read, "Invalid argument %s\n", argv[argc - 1]); computation_duration = (double *) calloc(host_list_size, sizeof(double)); communication_table = (double *) calloc(host_list_size * host_list_size, sizeof(double)); @@ -101,13 +101,13 @@ int redistribute(int argc, char *argv[]) m_host_list = calloc(host_list_size, sizeof(m_host_t)); for (i = 1; i <= host_list_size; i++) { m_host_list[i - 1] = MSG_get_host_by_name(argv[i]); - xbt_assert1(m_host_list[i - 1] != NULL, + xbt_assert(m_host_list[i - 1] != NULL, "Unknown host %s. Stopping Now! ", argv[i]); } int read; read = sscanf(argv[argc - 1], "%lg", &communication_amount); - xbt_assert1(read, "Invalid argument %s\n", argv[argc - 1]); + xbt_assert(read, "Invalid argument %s\n", argv[argc - 1]); computation_duration = (double *) calloc(host_list_size, sizeof(double)); communication_table = (double *) calloc(host_list_size * host_list_size, sizeof(double)); diff --git a/examples/msg/pmm/msg_pmm.c b/examples/msg/pmm/msg_pmm.c index 498ba066e7..9a3174ef87 100644 --- a/examples/msg/pmm/msg_pmm.c +++ b/examples/msg/pmm/msg_pmm.c @@ -61,7 +61,7 @@ int node(int argc, char **argv) xbt_matrix_t A, B, C = NULL, sA, sB, sC; result_t result; - xbt_assert0(argc != 1, "Wrong number of arguments for this node"); + xbt_assert(argc != 1, "Wrong number of arguments for this node"); /* Initialize the node's data-structures */ myid = atoi(argv[1]); diff --git a/examples/msg/priority/priority.c b/examples/msg/priority/priority.c index e5b6c62de2..9c5eb23cee 100644 --- a/examples/msg/priority/priority.c +++ b/examples/msg/priority/priority.c @@ -21,9 +21,9 @@ static int test(int argc, char *argv[]) m_task_t task = NULL; int res = sscanf(argv[1], "%lg", &computation_amount); - xbt_assert1(res, "Invalid argument %s\n", argv[1]); + xbt_assert(res, "Invalid argument %s\n", argv[1]); res = sscanf(argv[2], "%lg", &priority); - xbt_assert1(res, "Invalid argument %s\n", argv[2]); + xbt_assert(res, "Invalid argument %s\n", argv[2]); XBT_INFO("Hello! Running a task of size %g with priority %g", computation_amount, priority); diff --git a/examples/msg/properties/msg_prop.c b/examples/msg/properties/msg_prop.c index fcf951951c..cf65df3092 100644 --- a/examples/msg/properties/msg_prop.c +++ b/examples/msg/properties/msg_prop.c @@ -38,13 +38,13 @@ int alice(int argc, char *argv[]) XBT_INFO("== Try to get a host property that does not exist"); value = MSG_host_get_property_value(host1, noexist); - xbt_assert0(!value, "The key exists (it's not supposed to)"); + xbt_assert(!value, "The key exists (it's not supposed to)"); XBT_INFO("== Try to get a host property that does exist"); value = MSG_host_get_property_value(host1, exist); - xbt_assert1(value, "\tProperty %s is undefined (where it should)", + xbt_assert(value, "\tProperty %s is undefined (where it should)", exist); - xbt_assert2(!strcmp(value, "180"), + xbt_assert(!strcmp(value, "180"), "\tValue of property %s is defined to %s (where it should be 180)", exist, value); XBT_INFO(" Property: %s old value: %s", exist, value); @@ -54,8 +54,8 @@ int alice(int argc, char *argv[]) /* Test if we have changed the value */ value = MSG_host_get_property_value(host1, exist); - xbt_assert1(value, "Property %s is undefined (where it should)", exist); - xbt_assert2(!strcmp(value, "250"), + xbt_assert(value, "Property %s is undefined (where it should)", exist); + xbt_assert(!strcmp(value, "250"), "Value of property %s is defined to %s (where it should be 250)", exist, value); XBT_INFO(" Property: %s old value: %s", exist, value); @@ -79,7 +79,7 @@ int bob(int argc, char *argv[]) XBT_INFO("== Try to get a process property that does not exist"); value = MSG_process_get_property_value(MSG_process_self(), noexist); - xbt_assert0(!value, "The property is defined (it shouldnt)"); + xbt_assert(!value, "The property is defined (it shouldnt)"); return 0; } diff --git a/examples/simdag/dax/dax_test.c b/examples/simdag/dax/dax_test.c index 184d715a63..2b90da3a1b 100644 --- a/examples/simdag/dax/dax_test.c +++ b/examples/simdag/dax/dax_test.c @@ -100,7 +100,7 @@ int main(int argc, char **argv) ("------------------- Produce the trace file---------------------------"); XBT_INFO("Producing the trace of the run into %s", tracefilename); FILE *out = fopen(tracefilename, "w"); - xbt_assert1(out, "Cannot write to %s", tracefilename); + xbt_assert(out, "Cannot write to %s", tracefilename); free(tracefilename); xbt_dynar_foreach(dax, cursor, task) { diff --git a/examples/simdag/dot/dot_test.c b/examples/simdag/dot/dot_test.c index 856f417352..ac12b0085f 100644 --- a/examples/simdag/dot/dot_test.c +++ b/examples/simdag/dot/dot_test.c @@ -90,7 +90,7 @@ int main(int argc, char **argv) ("------------------- Produce the trace file---------------------------"); XBT_INFO("Producing the trace of the run into %s", tracefilename); FILE *out = fopen(tracefilename, "w"); - xbt_assert1(out, "Cannot write to %s", tracefilename); + xbt_assert(out, "Cannot write to %s", tracefilename); free(tracefilename); xbt_dynar_foreach(dot, cursor, task) { diff --git a/examples/simdag/dot/simulate_dot.c b/examples/simdag/dot/simulate_dot.c index 5d3000249a..f70d189700 100644 --- a/examples/simdag/dot/simulate_dot.c +++ b/examples/simdag/dot/simulate_dot.c @@ -76,7 +76,7 @@ int main(int argc, char **argv) ("------------------- Produce the trace file---------------------------"); XBT_INFO("Producing the trace of the run into %s", tracefilename); FILE *out = fopen(tracefilename, "w"); - xbt_assert1(out, "Cannot write to %s", tracefilename); + xbt_assert(out, "Cannot write to %s", tracefilename); free(tracefilename); xbt_dynar_foreach(dot, cursor, task) { diff --git a/examples/simdag/scheduling/minmin_test.c b/examples/simdag/scheduling/minmin_test.c index 194cb28254..08d324ed88 100644 --- a/examples/simdag/scheduling/minmin_test.c +++ b/examples/simdag/scheduling/minmin_test.c @@ -339,7 +339,7 @@ int main(int argc, char **argv) ("------------------- Produce the trace file---------------------------"); XBT_INFO("Producing the trace of the run into %s", tracefilename); out = fopen(tracefilename, "w"); - xbt_assert1(out, "Cannot write to %s", tracefilename); + xbt_assert(out, "Cannot write to %s", tracefilename); free(tracefilename); output_xml(out, dax); diff --git a/examples/simdag/sd_test.c b/examples/simdag/sd_test.c index 3d8acc7a7d..d2887908c3 100644 --- a/examples/simdag/sd_test.c +++ b/examples/simdag/sd_test.c @@ -190,7 +190,7 @@ int main(int argc, char **argv) xbt_dynar_get_cpy(changed_tasks, 0, &checkD); xbt_dynar_get_cpy(changed_tasks, 1, &checkB); - xbt_assert0(checkD == taskD && + xbt_assert(checkD == taskD && checkB == taskB, "Unexpected simulation results"); xbt_dynar_free_container(&changed_tasks); diff --git a/examples/simdag/sd_test_console.c b/examples/simdag/sd_test_console.c index f1ac47797a..3ee1775716 100644 --- a/examples/simdag/sd_test_console.c +++ b/examples/simdag/sd_test_console.c @@ -190,7 +190,7 @@ int main(int argc, char **argv) xbt_dynar_get_cpy(changed_tasks, 0, &checkD); xbt_dynar_get_cpy(changed_tasks, 1, &checkB); - xbt_assert0(checkD == taskD && + xbt_assert(checkD == taskD && checkB == taskB, "Unexpected simulation results"); xbt_dynar_free_container(&changed_tasks); diff --git a/include/xbt/asserts.h b/include/xbt/asserts.h index 386c7c82dd..e02965353c 100644 --- a/include/xbt/asserts.h +++ b/include/xbt/asserts.h @@ -41,7 +41,7 @@ SG_BEGIN_DECL() do { if (!(cond)) THROWF(0, 0, __VA_ARGS__); } while (0) #endif -#if 1 || defined(XBT_USE_DEPRECATED) +#ifdef XBT_USE_DEPRECATED #define xbt_assert0(...) xbt_assert(__VA_ARGS__) #define xbt_assert1(...) xbt_assert(__VA_ARGS__) diff --git a/include/xbt/ex.h b/include/xbt/ex.h index e15422eaa1..ae391fa41b 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -461,7 +461,7 @@ extern void __xbt_ex_terminate_default(xbt_ex_t * e); THROWF(unknown_error, 0, "Function %s unimplemented",_XBT_FUNCTION) #ifndef NDEBUG -# define DIE_IMPOSSIBLE xbt_assert0(0,"The Impossible Did Happen (yet again)") +# define DIE_IMPOSSIBLE xbt_assert(0,"The Impossible Did Happen (yet again)") #else # define DIE_IMPOSSIBLE exit(1); #endif diff --git a/src/amok/Bandwidth/bandwidth.c b/src/amok/Bandwidth/bandwidth.c index 2aca9c1875..eeabf72329 100644 --- a/src/amok/Bandwidth/bandwidth.c +++ b/src/amok/Bandwidth/bandwidth.c @@ -220,7 +220,7 @@ void amok_bw_test(gras_socket_t peer, ((request->msg_size / ((double) 64 * 1024 * 1024)) * request->msg_amount) + 1; - xbt_assert0(new_amount > request->msg_amount, + xbt_assert(new_amount > request->msg_amount, "Overflow on the number of messages! You must have a *really* fat pipe. Please fix your platform"); request->msg_amount = new_amount; diff --git a/src/amok/PeerManagement/peermanagement.c b/src/amok/PeerManagement/peermanagement.c index a675eb5f7c..704b72ebc0 100644 --- a/src/amok/PeerManagement/peermanagement.c +++ b/src/amok/PeerManagement/peermanagement.c @@ -149,7 +149,7 @@ xbt_dynar_t amok_pm_group_new(const char *group_name) xbt_dynar_t res = xbt_dynar_new(sizeof(xbt_peer_t), xbt_peer_free_voidp); - xbt_assert0(amok_pm_moddata_id != -1, "Run amok_pm_init first!"); + xbt_assert(amok_pm_moddata_id != -1, "Run amok_pm_init first!"); g = gras_moddata_by_id(amok_pm_moddata_id); XBT_DEBUG("retrieved groups=%p", g->groups); diff --git a/src/bindings/lua/lua_stub_generator.c b/src/bindings/lua/lua_stub_generator.c index 58dfda9ca0..acffa3eacd 100644 --- a/src/bindings/lua/lua_stub_generator.c +++ b/src/bindings/lua/lua_stub_generator.c @@ -90,7 +90,7 @@ void generate_sim(const char *project) OUT = fopen(filename, "w"); - xbt_assert1(OUT, "Unable to open %s for writing", filename); + xbt_assert(OUT, "Unable to open %s for writing", filename); fprintf(OUT, "%s", SIM_PREEMBULE); @@ -149,7 +149,7 @@ void generate_rl(const char *project) sprintf(filename, RL_SOURCENAME, project, key); OUT = fopen(filename, "w"); - xbt_assert1(OUT, "Unable to open %s for writing", filename); + xbt_assert(OUT, "Unable to open %s for writing", filename); fprintf(OUT, "/* specific to Borland Compiler */\n" "#ifdef __BORLANDC__\n" @@ -190,7 +190,7 @@ void generate_makefile_am(const char *project) sprintf(filename, MAKEFILE_FILENAME_AM, project); OUT = fopen(filename, "w"); - xbt_assert1(OUT, "Unable to open %s for writing", filename); + xbt_assert(OUT, "Unable to open %s for writing", filename); fprintf(OUT, "# AUTOMAKE variable definition\n"); fprintf(OUT, "INCLUDES= @CFLAGS_SimGrid@\n\n"); @@ -256,7 +256,7 @@ void generate_makefile_local(const char *project) sprintf(filename, MAKEFILE_FILENAME_LOCAL, project); OUT = fopen(filename, "w"); - xbt_assert1(OUT, "Unable to open %s for writing", filename); + xbt_assert(OUT, "Unable to open %s for writing", filename); free(filename); fprintf(OUT, diff --git a/src/bindings/lua/simgrid_lua.c b/src/bindings/lua/simgrid_lua.c index 7dbf010603..593f56fae5 100644 --- a/src/bindings/lua/simgrid_lua.c +++ b/src/bindings/lua/simgrid_lua.c @@ -514,7 +514,7 @@ static int run_lua_code(int argc, char **argv) /* Start the co-routine */ lua_getglobal(L, argv[0]); - xbt_assert1(lua_isfunction(L, -1), + xbt_assert(lua_isfunction(L, -1), "The lua function %s does not seem to exist", argv[0]); // push arguments onto the stack @@ -525,7 +525,7 @@ static int run_lua_code(int argc, char **argv) // Call the function (in resume) int err; err = lua_pcall(L, argc - 1, 1, 0); - xbt_assert2(err == 0, "error running function `%s': %s", argv[0], + xbt_assert(err == 0, "error running function `%s': %s", argv[0], lua_tostring(L, -1)); /* retrieve result */ @@ -708,9 +708,9 @@ int luaopen_simgrid(lua_State * L) if (lua_isnil(L, -1)) { done = 1; } else { - xbt_assert1(lua_isstring(L, -1), + xbt_assert(lua_isstring(L, -1), "argv[%d] got from lua is no string", argc - 1); - xbt_assert2(argc < LUA_MAX_ARGS_COUNT, + xbt_assert(argc < LUA_MAX_ARGS_COUNT, "Too many arguments, please increase LUA_MAX_ARGS_COUNT in %s before recompiling SimGrid if you insist on having more than %d args on command line", __FILE__, LUA_MAX_ARGS_COUNT - 1); argv[argc - 1] = (char *) luaL_checkstring(L, -1); diff --git a/src/gras/DataDesc/cbps.c b/src/gras/DataDesc/cbps.c index 91fe07790e..f5d1d13d5a 100644 --- a/src/gras/DataDesc/cbps.c +++ b/src/gras/DataDesc/cbps.c @@ -262,7 +262,7 @@ void gras_cbps_block_end(gras_cbps_t ps) unsigned int cursor = 0; char *name = NULL; - xbt_assert0(xbt_dynar_length(ps->frames), + xbt_assert(xbt_dynar_length(ps->frames), "More block_end than block_begin"); xbt_dynar_pop(ps->frames, &frame); @@ -302,7 +302,7 @@ int gras_cbps_i_pop(gras_cbps_t ps) { int ret; - xbt_assert0(xbt_dynar_length(ps->lints) > 0, + xbt_assert(xbt_dynar_length(ps->lints) > 0, "gras_cbps_i_pop: no value to pop"); ret = xbt_dynar_pop_as(ps->lints, int); XBT_DEBUG("pop %d as a size", ret); diff --git a/src/gras/DataDesc/ddt_convert.c b/src/gras/DataDesc/ddt_convert.c index d24b142b1c..cb02afe49e 100644 --- a/src/gras/DataDesc/ddt_convert.c +++ b/src/gras/DataDesc/ddt_convert.c @@ -143,7 +143,7 @@ gras_dd_convert_elm(gras_datadesc_type_t type, int count, XBT_DEBUG("Resize integer %d from %lu @%p to %lu @%p", cpt, r_size, r_data, l_size, l_data); - xbt_assert0(r_data != l_data, "Impossible to resize in place"); + xbt_assert(r_data != l_data, "Impossible to resize in place"); if (sizeChange < 0) { XBT_DEBUG("Truncate %d bytes (%s,%s)", -sizeChange, diff --git a/src/gras/DataDesc/ddt_create.c b/src/gras/DataDesc/ddt_create.c index f76e217fdb..51f37af1f7 100644 --- a/src/gras/DataDesc/ddt_create.c +++ b/src/gras/DataDesc/ddt_create.c @@ -122,11 +122,11 @@ gras_datadesc_scalar(const char *name, XBT_IN(""); res = gras_datadesc_by_name_or_null(name); if (res) { - xbt_assert1(res->category_code == e_gras_datadesc_type_cat_scalar, + xbt_assert(res->category_code == e_gras_datadesc_type_cat_scalar, "Redefinition of type %s does not match", name); - xbt_assert1(res->category.scalar_data.encoding == encoding, + xbt_assert(res->category.scalar_data.encoding == encoding, "Redefinition of type %s does not match", name); - xbt_assert1(res->category.scalar_data.type == type, + xbt_assert(res->category.scalar_data.type == type, "Redefinition of type %s does not match", name); XBT_VERB("Discarding redefinition of %s", name); return res; @@ -173,7 +173,7 @@ gras_datadesc_type_t gras_datadesc_struct(const char *name) res = gras_datadesc_by_name_or_null(name); if (res) { /* FIXME: Check that field redefinition matches */ - xbt_assert1(res->category_code == e_gras_datadesc_type_cat_struct, + xbt_assert(res->category_code == e_gras_datadesc_type_cat_struct, "Redefinition of type %s does not match", name); XBT_DEBUG("Discarding redefinition of %s", name); return res; @@ -203,7 +203,7 @@ gras_datadesc_struct_append(gras_datadesc_type_t struct_type, gras_dd_cat_field_t field; int arch; - xbt_assert2(field_type, + xbt_assert(field_type, "Cannot add the field '%s' into struct '%s': its type is NULL", name, struct_type->name); XBT_IN("(%s %s.%s;)", field_type->name, struct_type->name, name); @@ -214,7 +214,7 @@ gras_datadesc_struct_append(gras_datadesc_type_t struct_type, return; } - xbt_assert1(field_type->size[GRAS_THISARCH] >= 0, + xbt_assert(field_type->size[GRAS_THISARCH] >= 0, "Cannot add a dynamically sized field in structure %s", struct_type->name); @@ -313,15 +313,15 @@ gras_datadesc_union(const char *name, gras_datadesc_type_cb_int_t selector) int arch; XBT_IN("(%s)", name); - xbt_assert0(selector, + xbt_assert(selector, "Attempt to creat an union without field_count function"); res = gras_datadesc_by_name_or_null(name); if (res) { /* FIXME: Check that field redefinition matches */ - xbt_assert1(res->category_code == e_gras_datadesc_type_cat_union, + xbt_assert(res->category_code == e_gras_datadesc_type_cat_union, "Redefinition of type %s does not match", name); - xbt_assert1(res->category.union_data.selector == selector, + xbt_assert(res->category.union_data.selector == selector, "Redefinition of type %s does not match", name); XBT_VERB("Discarding redefinition of %s", name); return res; @@ -353,7 +353,7 @@ void gras_datadesc_union_append(gras_datadesc_type_t union_type, int arch; XBT_IN("(%s %s.%s;)", field_type->name, union_type->name, name); - xbt_assert1(field_type->size[GRAS_THISARCH] >= 0, + xbt_assert(field_type->size[GRAS_THISARCH] >= 0, "Cannot add a dynamically sized field in union %s", union_type->name); @@ -421,11 +421,11 @@ gras_datadesc_ref(const char *name, gras_datadesc_type_t referenced_type) XBT_IN("(%s)", name); res = gras_datadesc_by_name_or_null(name); if (res) { - xbt_assert1(res->category_code == e_gras_datadesc_type_cat_ref, + xbt_assert(res->category_code == e_gras_datadesc_type_cat_ref, "Redefinition of %s does not match", name); - xbt_assert1(res->category.ref_data.type == referenced_type, + xbt_assert(res->category.ref_data.type == referenced_type, "Redefinition of %s does not match", name); - xbt_assert1(res->category.ref_data.selector == NULL, + xbt_assert(res->category.ref_data.selector == NULL, "Redefinition of %s does not match", name); XBT_DEBUG("Discarding redefinition of %s", name); return res; @@ -433,7 +433,7 @@ gras_datadesc_ref(const char *name, gras_datadesc_type_t referenced_type) res = gras_ddt_new(name); - xbt_assert0(pointer_type, "Cannot get the description of data pointer"); + xbt_assert(pointer_type, "Cannot get the description of data pointer"); for (arch = 0; arch < gras_arch_count; arch++) { res->size[arch] = pointer_type->size[arch]; @@ -468,18 +468,18 @@ gras_datadesc_ref_generic(const char *name, res = gras_datadesc_by_name_or_null(name); if (res) { - xbt_assert1(res->category_code == e_gras_datadesc_type_cat_ref, + xbt_assert(res->category_code == e_gras_datadesc_type_cat_ref, "Redefinition of type %s does not match", name); - xbt_assert1(res->category.ref_data.type == NULL, + xbt_assert(res->category.ref_data.type == NULL, "Redefinition of type %s does not match", name); - xbt_assert1(res->category.ref_data.selector == selector, + xbt_assert(res->category.ref_data.selector == selector, "Redefinition of type %s does not match", name); XBT_VERB("Discarding redefinition of %s", name); return res; } res = gras_ddt_new(name); - xbt_assert0(pointer_type, "Cannot get the description of data pointer"); + xbt_assert(pointer_type, "Cannot get the description of data pointer"); for (arch = 0; arch < gras_arch_count; arch++) { res->size[arch] = pointer_type->size[arch]; @@ -508,7 +508,7 @@ gras_datadesc_array_fixed(const char *name, XBT_IN("(%s)", name); res = gras_datadesc_by_name_or_null(name); if (res) { - xbt_assert1(res->category_code == e_gras_datadesc_type_cat_array, + xbt_assert(res->category_code == e_gras_datadesc_type_cat_array, "Redefinition of type %s does not match", name); if (res->category.array_data.type != element_type) { @@ -519,9 +519,9 @@ gras_datadesc_array_fixed(const char *name, gras_datadesc_type_dump(element_type); } - xbt_assert1(res->category.array_data.fixed_size == fixed_size, + xbt_assert(res->category.array_data.fixed_size == fixed_size, "Redefinition of type %s does not match", name); - xbt_assert1(res->category.array_data.dynamic_size == NULL, + xbt_assert(res->category.array_data.dynamic_size == NULL, "Redefinition of type %s does not match", name); XBT_VERB("Discarding redefinition of %s", name); @@ -529,7 +529,7 @@ gras_datadesc_array_fixed(const char *name, } res = gras_ddt_new(name); - xbt_assert1(fixed_size >= 0, "'%s' is a array of negative fixed size", + xbt_assert(fixed_size >= 0, "'%s' is a array of negative fixed size", name); for (arch = 0; arch < gras_arch_count; arch++) { res->size[arch] = fixed_size * element_type->aligned_size[arch]; @@ -558,18 +558,18 @@ gras_datadesc_type_t gras_datadesc_array_dyn(const char *name, int arch; XBT_IN("(%s)", name); - xbt_assert1(dynamic_size, + xbt_assert(dynamic_size, "'%s' is a dynamic array without size discriminant", name); res = gras_datadesc_by_name_or_null(name); if (res) { - xbt_assert1(res->category_code == e_gras_datadesc_type_cat_array, + xbt_assert(res->category_code == e_gras_datadesc_type_cat_array, "Redefinition of type %s does not match", name); - xbt_assert1(res->category.array_data.type == element_type, + xbt_assert(res->category.array_data.type == element_type, "Redefinition of type %s does not match", name); - xbt_assert1(res->category.array_data.fixed_size == -1, + xbt_assert(res->category.array_data.fixed_size == -1, "Redefinition of type %s does not match", name); - xbt_assert1(res->category.array_data.dynamic_size == dynamic_size, + xbt_assert(res->category.array_data.dynamic_size == dynamic_size, "Redefinition of type %s does not match", name); XBT_VERB("Discarding redefinition of %s", name); diff --git a/src/gras/DataDesc/ddt_exchange.c b/src/gras/DataDesc/ddt_exchange.c index 4e4e510593..8069511b51 100644 --- a/src/gras/DataDesc/ddt_exchange.c +++ b/src/gras/DataDesc/ddt_exchange.c @@ -81,7 +81,7 @@ static XBT_INLINE void gras_dd_alloc_ref(xbt_dict_t refs, long int size, char ** { char *l_data = NULL; - xbt_assert1(size > 0, "Cannot allocate %ld bytes!", size); + xbt_assert(size > 0, "Cannot allocate %ld bytes!", size); l_data = xbt_malloc((size_t) size); *l_ref = l_data; @@ -136,7 +136,7 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, char *field_dst; struct_data = type->category.struct_data; - xbt_assert1(struct_data.closed, + xbt_assert(struct_data.closed, "Please call gras_datadesc_declare_struct_close on %s before copying it", type->name); XBT_VERB(">> Copy all fields of the structure %s", type->name); @@ -194,17 +194,17 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, union_data = type->category.union_data; - xbt_assert1(union_data.closed, + xbt_assert(union_data.closed, "Please call gras_datadesc_declare_union_close on %s before copying it", type->name); /* retrieve the field number */ field_num = union_data.selector(type, state, src); - xbt_assert1(field_num > 0, + xbt_assert(field_num > 0, "union field selector of %s gave a negative value", type->name); - xbt_assert3(field_num < xbt_dynar_length(union_data.fields), + xbt_assert(field_num < xbt_dynar_length(union_data.fields), "union field selector of %s returned %d but there is only %lu fields", type->name, field_num, xbt_dynar_length(union_data.fields)); @@ -325,7 +325,7 @@ gras_datadesc_memcpy_rec(gras_cbps_t state, array_count = subsize; if (array_count == -1) { array_count = array_data.dynamic_size(type, state, src); - xbt_assert1(array_count >= 0, + xbt_assert(array_count >= 0, "Invalid (negative) array size for type %s", type->name); } @@ -390,7 +390,7 @@ int gras_datadesc_memcpy(gras_datadesc_type_t type, void *src, void *dst) static xbt_dict_t refs = NULL; /* all references already sent */ int size = 0; - xbt_assert0(type, "called with NULL type descriptor"); + xbt_assert(type, "called with NULL type descriptor"); XBT_DEBUG("Memcopy a %s from %p to %p", gras_datadesc_get_name(type), src, dst); @@ -449,7 +449,7 @@ gras_datadesc_send_rec(gras_socket_t sock, char *field_data; struct_data = type->category.struct_data; - xbt_assert1(struct_data.closed, + xbt_assert(struct_data.closed, "Please call gras_datadesc_declare_struct_close on %s before sending it", type->name); XBT_VERB(">> Send all fields of the structure %s", type->name); @@ -481,17 +481,17 @@ gras_datadesc_send_rec(gras_socket_t sock, union_data = type->category.union_data; - xbt_assert1(union_data.closed, + xbt_assert(union_data.closed, "Please call gras_datadesc_declare_union_close on %s before sending it", type->name); /* retrieve the field number */ field_num = union_data.selector(type, state, data); - xbt_assert1(field_num > 0, + xbt_assert(field_num > 0, "union field selector of %s gave a negative value", type->name); - xbt_assert3(field_num < xbt_dynar_length(union_data.fields), + xbt_assert(field_num < xbt_dynar_length(union_data.fields), "union field selector of %s returned %d but there is only %lu fields", type->name, field_num, xbt_dynar_length(union_data.fields)); @@ -579,7 +579,7 @@ gras_datadesc_send_rec(gras_socket_t sock, count = array_data.fixed_size; if (count == -1) { count = array_data.dynamic_size(type, state, data); - xbt_assert1(count >= 0, + xbt_assert(count >= 0, "Invalid (negative) array size for type %s", type->name); gras_dd_send_int(sock, &count, 0 /*non-stable */ ); @@ -635,7 +635,7 @@ void gras_datadesc_send(gras_socket_t sock, static gras_cbps_t state = NULL; static xbt_dict_t refs = NULL; /* all references already sent */ - xbt_assert0(type, "called with NULL type descriptor"); + xbt_assert(type, "called with NULL type descriptor"); if (!state) { state = gras_cbps_new(); @@ -704,7 +704,7 @@ gras_datadesc_recv_rec(gras_socket_t sock, struct_data = type->category.struct_data; - xbt_assert1(struct_data.closed, + xbt_assert(struct_data.closed, "Please call gras_datadesc_declare_struct_close on %s before receiving it", type->name); XBT_VERB(">> Receive all fields of the structure %s", type->name); @@ -736,7 +736,7 @@ gras_datadesc_recv_rec(gras_socket_t sock, union_data = type->category.union_data; - xbt_assert1(union_data.closed, + xbt_assert(union_data.closed, "Please call gras_datadesc_declare_union_close on %s before receiving it", type->name); /* retrieve the field number */ @@ -980,7 +980,7 @@ gras_datadesc_recv(gras_socket_t sock, refs = xbt_dict_new(); } - xbt_assert0(type, "called with NULL type descriptor"); + xbt_assert(type, "called with NULL type descriptor"); TRY { gras_datadesc_recv_rec(sock, state, refs, type, r_arch, NULL, 0, (char *) dst, -1, type->cycle); diff --git a/src/gras/Msg/gras_msg_exchange.c b/src/gras/Msg/gras_msg_exchange.c index d2178bc290..e1577320ac 100644 --- a/src/gras/Msg/gras_msg_exchange.c +++ b/src/gras/Msg/gras_msg_exchange.c @@ -46,7 +46,7 @@ gras_msg_wait_ext_(double timeout, (gras_msg_procdata_t) gras_libdata_by_id(gras_msg_libdata_id); unsigned int cpt; - xbt_assert0(msg_got, "msg_got is an output parameter"); + xbt_assert(msg_got, "msg_got is an output parameter"); start = gras_os_time(); XBT_VERB("Waiting for message '%s' for %fs", @@ -152,11 +152,11 @@ gras_msg_wait_(double timeout, gras_msg_wait_ext_(timeout, msgt_want, NULL, NULL, NULL, &msg); if (msgt_want->ctn_type) { - xbt_assert1(payload, + xbt_assert(payload, "Message type '%s' convey a payload that you must accept", msgt_want->name); } else { - xbt_assert1(!payload, + xbt_assert(!payload, "No payload was declared for message type '%s' (don't expect one)", msgt_want->name); } @@ -209,7 +209,7 @@ void gras_msg_wait_or(double timeout, &gras_msg_wait_or_filter, (void *) msgt_want, &msg); if (msg.type->ctn_type) { - xbt_assert1(payload, + xbt_assert(payload, "Message type '%s' convey a payload you must accept", msg.type->name); } @@ -235,11 +235,11 @@ void gras_msg_send_(gras_socket_t sock, gras_msgtype_t msgtype, { if (msgtype->ctn_type) { - xbt_assert1(payload, + xbt_assert(payload, "Message type '%s' convey a payload you must provide", msgtype->name); } else { - xbt_assert1(!payload, + xbt_assert(!payload, "No payload was declared for message type '%s'", msgtype->name); } @@ -352,7 +352,7 @@ void gras_msg_handle(double timeOut) /* we served a timer, we're done */ return; } else { - xbt_assert1(untiltimer > 0, "Negative timer (%f). I'm 'puzzeled'", + xbt_assert(untiltimer > 0, "Negative timer (%f). I'm 'puzzeled'", untiltimer); XBT_WARN ("No timer elapsed, in contrary to expectations (next in %f sec)", @@ -444,7 +444,7 @@ void gras_msg_handle(double timeOut) } } - xbt_assert1(!ctx.answer_due, + xbt_assert(!ctx.answer_due, "Bug in user code: RPC callback to message '%s' didn't call gras_msg_rpcreturn", msg.type->name); if (ctx.answer_due) diff --git a/src/gras/Msg/gras_msg_types.c b/src/gras/Msg/gras_msg_types.c index 83a606c2c8..2c2aef2701 100644 --- a/src/gras/Msg/gras_msg_types.c +++ b/src/gras/Msg/gras_msg_types.c @@ -97,17 +97,17 @@ gras_msgtype_declare_ext(const char *name, XBT_DEBUG ("Re-register version %d of message '%s' (same kind & payload, ignored).", version, name); - xbt_assert3(msgtype->kind == kind, + xbt_assert(msgtype->kind == kind, "Message %s re-registered as a %s (it was known as a %s)", namev, e_gras_msg_kind_names[kind], e_gras_msg_kind_names[msgtype->kind]); - xbt_assert3(!gras_datadesc_type_cmp + xbt_assert(!gras_datadesc_type_cmp (msgtype->ctn_type, payload_request), "Message %s re-registred with another payload (%s was %s)", namev, gras_datadesc_get_name(payload_request), gras_datadesc_get_name(msgtype->ctn_type)); - xbt_assert3(!gras_datadesc_type_cmp + xbt_assert(!gras_datadesc_type_cmp (msgtype->answer_type, payload_answer), "Message %s re-registred with another answer payload (%s was %s)", namev, gras_datadesc_get_name(payload_answer), diff --git a/src/gras/Msg/rl_msg.c b/src/gras/Msg/rl_msg.c index fead6dfa6f..5d5b48daf1 100644 --- a/src/gras/Msg/rl_msg.c +++ b/src/gras/Msg/rl_msg.c @@ -36,7 +36,7 @@ void gras_msg_send_ext(gras_socket_t sock, static gras_datadesc_type_t ulong_type = NULL; char c_kind = (char) kind; - xbt_assert0(msgtype, "Cannot send the NULL message"); + xbt_assert(msgtype, "Cannot send the NULL message"); if (!string_type) { string_type = gras_datadesc_by_name("string"); @@ -99,7 +99,7 @@ void gras_msg_recv(gras_socket_t sock, gras_msg_t msg) char *msg_name = NULL; char c_kind; - xbt_assert1(!gras_socket_is_meas(sock), + xbt_assert(!gras_socket_is_meas(sock), "Asked to receive a message on the measurement socket %p", sock); if (!string_type) { @@ -180,7 +180,7 @@ void gras_msg_recv(gras_socket_t sock, gras_msg_t msg) /* answer to RPC */ if (msg->type->answer_type) { msg->payl_size = gras_datadesc_size(msg->type->answer_type); - xbt_assert2(msg->payl_size > 0, + xbt_assert(msg->payl_size > 0, "%s %s", "Dynamic array as payload is forbided for now (FIXME?).", "Reference to dynamic array is allowed."); @@ -194,7 +194,7 @@ void gras_msg_recv(gras_socket_t sock, gras_msg_t msg) /* regular message */ if (msg->type->ctn_type) { msg->payl_size = gras_datadesc_size(msg->type->ctn_type); - xbt_assert2(msg->payl_size > 0, + xbt_assert(msg->payl_size > 0, "%s %s", "Dynamic array as payload is forbided for now (FIXME?).", "Reference to dynamic array is allowed."); diff --git a/src/gras/Msg/rpc.c b/src/gras/Msg/rpc.c index 6375e3a590..8c7e72c6a6 100644 --- a/src/gras/Msg/rpc.c +++ b/src/gras/Msg/rpc.c @@ -123,11 +123,11 @@ gras_msg_rpc_async_call_(gras_socket_t server, gras_msg_cb_ctx_t ctx = xbt_mallocator_get(gras_msg_ctx_mallocator); if (msgtype->ctn_type) { - xbt_assert1(request, + xbt_assert(request, "RPC type '%s' convey a payload you must provide", msgtype->name); } else { - xbt_assert1(!request, + xbt_assert(!request, "No payload was declared for RPC type '%s'", msgtype->name); } @@ -154,11 +154,11 @@ void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx, void *answer) s_gras_msg_t received; if (ctx->msgtype->answer_type) { - xbt_assert1(answer, + xbt_assert(answer, "Answers to RPC '%s' convey a payload you must accept", ctx->msgtype->name); } else { - xbt_assert1(!answer, + xbt_assert(!answer, "No payload was declared for answers to RPC '%s'", ctx->msgtype->name); } @@ -233,7 +233,7 @@ void gras_msg_rpccall_(gras_socket_t server, void gras_msg_rpcreturn(double timeOut, gras_msg_cb_ctx_t ctx, void *answer) { - xbt_assert0(ctx->answer_due, + xbt_assert(ctx->answer_due, "RPC return not allowed here. Either not a RPC message or already returned a result"); ctx->answer_due = 0; XBT_DEBUG("Return to RPC '%s' from %s:%d (tOut=%f, payl=%p)", diff --git a/src/gras/Msg/sg_msg.c b/src/gras/Msg/sg_msg.c index 0321d91e5d..6cc6aa14a7 100644 --- a/src/gras/Msg/sg_msg.c +++ b/src/gras/Msg/sg_msg.c @@ -146,7 +146,7 @@ gras_msg_t gras_msg_recv_any(void) * an iterator, incremented only when the socket has a comm. And we've the right socket * when that iterator is equal to "got", the result of waitany. Not needed if B holds. */ - xbt_assert1(sock_data->comm_recv, + xbt_assert(sock_data->comm_recv, "Comm_recv of socket %p is empty; please report that nasty bug", sock); /* End of paranoia */ diff --git a/src/gras/Transport/transport.c b/src/gras/Transport/transport.c index c0552823c2..2036788160 100644 --- a/src/gras/Transport/transport.c +++ b/src/gras/Transport/transport.c @@ -69,7 +69,7 @@ void gras_trp_init(void) wVersionRequested = MAKEWORD(2, 0); int res; res = WSAStartup(wVersionRequested, &wsaData); - xbt_assert0(res == 0, "Cannot find a usable WinSock DLL"); + xbt_assert(res == 0, "Cannot find a usable WinSock DLL"); /* Confirm that the WinSock DLL supports 2.0. */ /* Note that if the DLL supports versions greater */ @@ -77,7 +77,7 @@ void gras_trp_init(void) /* 2.0 in wVersion since that is the version we */ /* requested. */ - xbt_assert0(LOBYTE(wsaData.wVersion) == 2 && + xbt_assert(LOBYTE(wsaData.wVersion) == 2 && HIBYTE(wsaData.wVersion) == 0, "Cannot find a usable WinSock DLL"); XBT_INFO("Found and initialized winsock2"); @@ -87,7 +87,7 @@ void gras_trp_init(void) WSADATA wsaData; int res; res = WSAStartup(0x0101, &wsaData); - xbt_assert0(res == 0, "Cannot find a usable WinSock DLL"); + xbt_assert(res == 0, "Cannot find a usable WinSock DLL"); XBT_INFO("Found and initialized winsock"); } #endif @@ -351,7 +351,7 @@ void gras_socket_close(gras_socket_t sock) XBT_IN(""); XBT_VERB("Close %p", sock); if (sock == _gras_lastly_selected_socket) { - xbt_assert0(!gras_opt_trp_nomoredata_on_close || !sock->moredata, + xbt_assert(!gras_opt_trp_nomoredata_on_close || !sock->moredata, "Closing a socket having more data in buffer while the nomoredata_on_close option is activated"); if (sock->moredata) @@ -396,7 +396,7 @@ void gras_socket_close(gras_socket_t sock) */ void gras_trp_send(gras_socket_t sd, char *data, long int size, int stable) { - xbt_assert0(sd->outgoing, "Socket not suited for data send"); + xbt_assert(sd->outgoing, "Socket not suited for data send"); (*sd->plugin->send) (sd, data, size, stable); } @@ -407,7 +407,7 @@ void gras_trp_send(gras_socket_t sd, char *data, long int size, int stable) */ void gras_trp_recv(gras_socket_t sd, char *data, long int size) { - xbt_assert0(sd->incoming, "Socket not suited for data receive"); + xbt_assert(sd->incoming, "Socket not suited for data receive"); (sd->plugin->recv) (sd, data, size); } @@ -497,9 +497,9 @@ void gras_socket_meas_send(gras_socket_t peer, if (gras_if_RL()) chunk = xbt_malloc0(msg_size); - xbt_assert0(peer->meas, + xbt_assert(peer->meas, "Asked to send measurement data on a regular socket"); - xbt_assert0(peer->outgoing, + xbt_assert(peer->outgoing, "Socket not suited for data send (was created with gras_socket_server(), not gras_socket_client())"); for (sent_sofar = 0; sent_sofar < msg_amount; sent_sofar++) { @@ -546,9 +546,9 @@ void gras_socket_meas_recv(gras_socket_t peer, if (gras_if_RL()) chunk = xbt_malloc(msg_size); - xbt_assert0(peer->meas, + xbt_assert(peer->meas, "Asked to receive measurement data on a regular socket"); - xbt_assert0(peer->incoming, "Socket not suited for data receive"); + xbt_assert(peer->incoming, "Socket not suited for data receive"); for (got_sofar = 0; got_sofar < msg_amount; got_sofar++) { XBT_CDEBUG(gras_trp_meas, @@ -585,7 +585,7 @@ gras_socket_t gras_socket_meas_accept(gras_socket_t peer) THROWF(unknown_error,0,"measurement sockets were broken in this release of SimGrid and should be ported back in the future." "If you depend on it, sorry, you have to use an older version, or wait for the future version using it..."); - xbt_assert0(peer->meas, + xbt_assert(peer->meas, "No need to accept on non-measurement sockets (it's automatic)"); if (!peer->accepting) { diff --git a/src/gras/Transport/transport_plugin_file.c b/src/gras/Transport/transport_plugin_file.c index c48b063f0a..c26b83780e 100644 --- a/src/gras/Transport/transport_plugin_file.c +++ b/src/gras/Transport/transport_plugin_file.c @@ -96,7 +96,7 @@ gras_socket_t gras_socket_client_from_file(const char *path) { gras_socket_t res; - xbt_assert0(gras_if_RL(), "Cannot use file as socket in the simulator"); + xbt_assert(gras_if_RL(), "Cannot use file as socket in the simulator"); gras_trp_socket_new(0, &res); @@ -138,7 +138,7 @@ gras_socket_t gras_socket_server_from_file(const char *path) { gras_socket_t res; - xbt_assert0(gras_if_RL(), "Cannot use file as socket in the simulator"); + xbt_assert(gras_if_RL(), "Cannot use file as socket in the simulator"); gras_trp_socket_new(1, &res); @@ -211,8 +211,8 @@ gras_trp_file_chunk_send_raw(gras_socket_t sock, const char *data, unsigned long int size) { - xbt_assert0(sock->outgoing, "Cannot write on client file socket"); - xbt_assert0(size >= 0, "Cannot send a negative amount of data"); + xbt_assert(sock->outgoing, "Cannot write on client file socket"); + xbt_assert(size >= 0, "Cannot send a negative amount of data"); while (size) { int status = 0; @@ -246,9 +246,9 @@ gras_trp_file_chunk_recv(gras_socket_t sock, int got = 0; - xbt_assert0(sock, "Cannot recv on an NULL socket"); - xbt_assert0(sock->incoming, "Cannot recv on client file socket"); - xbt_assert0(size >= 0, "Cannot receive a negative amount of data"); + xbt_assert(sock, "Cannot recv on an NULL socket"); + xbt_assert(sock->incoming, "Cannot recv on client file socket"); + xbt_assert(size >= 0, "Cannot receive a negative amount of data"); if (sock->recvd) { data[0] = sock->recvd_val; diff --git a/src/gras/Transport/transport_plugin_sg.c b/src/gras/Transport/transport_plugin_sg.c index 9439b6a542..3f90e48ed8 100644 --- a/src/gras/Transport/transport_plugin_sg.c +++ b/src/gras/Transport/transport_plugin_sg.c @@ -61,7 +61,7 @@ static gras_sg_portrec_t find_port(gras_hostdata_t * hd, int port) unsigned int cpt; gras_sg_portrec_t pr; - xbt_assert0(hd, "Please run gras_process_init on each process"); + xbt_assert(hd, "Please run gras_process_init on each process"); xbt_dynar_foreach(hd->ports, cpt, pr) { if (pr->port == port) @@ -200,7 +200,7 @@ void gras_trp_sg_socket_server(gras_trp_plugin_t self, int port, gras_socket_t s gras_sg_portrec_t pr; gras_trp_sg_sock_data_t data; - xbt_assert0(hd, "Please run gras_process_init on each process"); + xbt_assert(hd, "Please run gras_process_init on each process"); sock->accepting = 1; @@ -256,7 +256,7 @@ void gras_trp_sg_socket_close(gras_socket_t sock) if (!sock) return; - xbt_assert0(hd, "Please run gras_process_init on each process"); + xbt_assert(hd, "Please run gras_process_init on each process"); gras_trp_sg_sock_data_t sockdata = sock->data; @@ -306,7 +306,7 @@ void gras_trp_sg_chunk_send_raw(gras_socket_t sock, gras_msg_t msg; /* message to send */ //gras_trp_sg_sock_data_t sock_data = (gras_trp_sg_sock_data_t) sock->data; - xbt_assert0(sock->meas, + xbt_assert(sock->meas, "SG chunk exchange shouldn't be used on non-measurement sockets"); @@ -342,7 +342,7 @@ int gras_trp_sg_chunk_recv(gras_socket_t sock, gras_trp_procdata_t trp_proc = (gras_trp_procdata_t) gras_libdata_by_id(gras_trp_libdata_id); - xbt_assert0(sock->meas, + xbt_assert(sock->meas, "SG chunk exchange shouldn't be used on non-measurement sockets"); xbt_queue_shift_timed(trp_proc->meas_selectable_sockets, &remote_socket, 60); diff --git a/src/gras/Transport/transport_plugin_tcp.c b/src/gras/Transport/transport_plugin_tcp.c index 90c4715a44..57a947121c 100644 --- a/src/gras/Transport/transport_plugin_tcp.c +++ b/src/gras/Transport/transport_plugin_tcp.c @@ -796,7 +796,7 @@ static int _gras_tcp_proto_number(void) if (returnValue == 0) { fetchedEntry = getprotobyname("tcp"); - xbt_assert0(fetchedEntry, "getprotobyname(tcp) gave NULL"); + xbt_assert(fetchedEntry, "getprotobyname(tcp) gave NULL"); returnValue = fetchedEntry->p_proto; } diff --git a/src/gras/Virtu/gras_module.c b/src/gras/Virtu/gras_module.c index f8cf4ed6a5..2a2feb57c6 100644 --- a/src/gras/Virtu/gras_module.c +++ b/src/gras/Virtu/gras_module.c @@ -130,17 +130,17 @@ void gras_module_add(const char *name, unsigned int datasize, int *ID, } if (found) { - xbt_assert1(mod->init_f == init_f, + xbt_assert(mod->init_f == init_f, "Module %s reregistered with a different init_f!", name); - xbt_assert1(mod->exit_f == exit_f, + xbt_assert(mod->exit_f == exit_f, "Module %s reregistered with a different exit_f!", name); - xbt_assert1(mod->join_f == join_f, + xbt_assert(mod->join_f == join_f, "Module %s reregistered with a different join_f!", name); - xbt_assert1(mod->leave_f == leave_f, + xbt_assert(mod->leave_f == leave_f, "Module %s reregistered with a different leave_f!", name); - xbt_assert1(mod->datasize == datasize, + xbt_assert(mod->datasize == datasize, "Module %s reregistered with a different datasize!", name); - xbt_assert1(mod->p_id == ID, + xbt_assert(mod->p_id == ID, "Module %s reregistered with a different p_id field!", name); diff --git a/src/gras/Virtu/process.c b/src/gras/Virtu/process.c index 39615deceb..f560472b92 100644 --- a/src/gras/Virtu/process.c +++ b/src/gras/Virtu/process.c @@ -144,7 +144,7 @@ void gras_procdata_init() XBT_DEBUG("Go ahead for cursor %d, there is %ld libdata", cursor, xbt_set_length(pd->libdata)); - xbt_assert1(fab.name, "Name of fabric #%d is NULL!", cursor); + xbt_assert(fab.name, "Name of fabric #%d is NULL!", cursor); XBT_DEBUG("Create the procdata for %s", fab.name); /* Check for our own errors */ TRY { diff --git a/src/gras/Virtu/rl_process.c b/src/gras/Virtu/rl_process.c index 121a7ed2be..db5148e9cc 100644 --- a/src/gras/Virtu/rl_process.c +++ b/src/gras/Virtu/rl_process.c @@ -90,7 +90,7 @@ int gras_os_getpid(void) gras_procdata_t *gras_procdata_get(void) { - xbt_assert0(_gras_procdata, "Run gras_process_init (ie, gras_init)!"); + xbt_assert(_gras_procdata, "Run gras_process_init (ie, gras_init)!"); return _gras_procdata; } diff --git a/src/gras/Virtu/sg_emul.c b/src/gras/Virtu/sg_emul.c index e6dcfaa445..63d8b77c7b 100644 --- a/src/gras/Virtu/sg_emul.c +++ b/src/gras/Virtu/sg_emul.c @@ -76,7 +76,7 @@ static double get_from_dict(xbt_dict_t dict, const char *key) int gras_bench_always_begin(const char *location, int line) { - xbt_assert0(!benchmarking, "Already benchmarking"); + xbt_assert(!benchmarking, "Already benchmarking"); benchmarking = 1; if (!timer) @@ -86,7 +86,7 @@ int gras_bench_always_begin(const char *location, int line) int gras_bench_always_end(void) { - xbt_assert0(benchmarking, "Not benchmarking yet"); + xbt_assert(benchmarking, "Not benchmarking yet"); benchmarking = 0; xbt_os_timer_stop(timer); duration = xbt_os_timer_elapsed(timer); @@ -99,7 +99,7 @@ int gras_bench_always_end(void) int gras_bench_once_begin(const char *location, int line) { double *ir = NULL; - xbt_assert0(!benchmarking, "Already benchmarking"); + xbt_assert(!benchmarking, "Already benchmarking"); benchmarking = 1; if (!locbuf || locbufsize < strlen(location) + 64) { @@ -122,7 +122,7 @@ int gras_bench_once_begin(const char *location, int line) int gras_bench_once_end(void) { - xbt_assert0(benchmarking, "Not benchmarking yet"); + xbt_assert(benchmarking, "Not benchmarking yet"); benchmarking = 0; if (duration > 0) { xbt_os_timer_stop(timer); diff --git a/src/gras/Virtu/sg_process.c b/src/gras/Virtu/sg_process.c index ad1c8d787a..9cbfc465fc 100644 --- a/src/gras/Virtu/sg_process.c +++ b/src/gras/Virtu/sg_process.c @@ -95,7 +95,7 @@ void gras_process_exit() xbt_queue_free(&trp_pd->meas_selectable_sockets); - xbt_assert0(hd, "Run gras_process_init (ie, gras_init)!!"); + xbt_assert(hd, "Run gras_process_init (ie, gras_init)!!"); XBT_VERB("GRAS: Finalizing process '%s' (%d)", SIMIX_req_process_get_name(SIMIX_process_self()), gras_os_getpid()); @@ -139,7 +139,7 @@ gras_procdata_t *gras_procdata_get(void) gras_procdata_t *pd = (gras_procdata_t *) SIMIX_req_process_get_data(SIMIX_process_self()); - xbt_assert0(pd, "Run gras_process_init! (ie, gras_init)"); + xbt_assert(pd, "Run gras_process_init! (ie, gras_init)"); return pd; } @@ -148,7 +148,7 @@ void *gras_libdata_by_name_from_remote(const char *name, smx_process_t p) { gras_procdata_t *pd = (gras_procdata_t *) SIMIX_req_process_get_data(p); - xbt_assert2(pd, + xbt_assert(pd, "process '%s' on '%s' didn't run gras_process_init! (ie, gras_init)", SIMIX_req_process_get_name(p), SIMIX_req_host_get_name(SIMIX_req_process_get_host(p))); diff --git a/src/instr/instr_config.c b/src/instr/instr_config.c index f6e21247df..998e2aa1b3 100644 --- a/src/instr/instr_config.c +++ b/src/instr/instr_config.c @@ -87,7 +87,7 @@ int TRACE_end() void TRACE_activate (void) { - xbt_assert0 (trace_active==0, "Tracing is already active."); + xbt_assert (trace_active==0, "Tracing is already active."); trace_active = 1; XBT_DEBUG ("Tracing is on"); } @@ -358,7 +358,7 @@ void TRACE_generate_triva_uncat_conf (void) char *name, *value; FILE *file = fopen (output, "w"); - xbt_assert1 (file != NULL, + xbt_assert (file != NULL, "Unable to open file (%s) for writing triva graph " "configuration (uncategorized).", output); @@ -441,7 +441,7 @@ void TRACE_generate_triva_cat_conf (void) } FILE *file = fopen (output, "w"); - xbt_assert1 (file != NULL, + xbt_assert (file != NULL, "Unable to open file (%s) for writing triva graph " "configuration (categorized).", output); diff --git a/src/instr/instr_interface.c b/src/instr/instr_interface.c index a96568ec1c..49e0517e17 100644 --- a/src/instr/instr_interface.c +++ b/src/instr/instr_interface.c @@ -22,7 +22,7 @@ void TRACE_category_with_color (const char *category, const char *color) if (!(TRACE_is_active() && category != NULL)) return; - xbt_assert1 (instr_platform_traced(), + xbt_assert (instr_platform_traced(), "%s must be called after environment creation", __FUNCTION__); //check if category is already created @@ -96,7 +96,7 @@ void TRACE_user_link_variable(double time, const char *resource, if (!TRACE_is_active()) return; - xbt_assert1 (instr_platform_traced(), + xbt_assert (instr_platform_traced(), "%s must be called after environment creation", __FUNCTION__); char valuestr[100]; @@ -123,7 +123,7 @@ void TRACE_user_host_variable(double time, const char *variable, if (!TRACE_is_active()) return; - xbt_assert1 (instr_platform_traced(), + xbt_assert (instr_platform_traced(), "%s must be called after environment creation", __FUNCTION__); char valuestr[100]; diff --git a/src/instr/instr_msg_task.c b/src/instr/instr_msg_task.c index 0c19542bf8..924ae904fe 100644 --- a/src/instr/instr_msg_task.c +++ b/src/instr/instr_msg_task.c @@ -18,13 +18,13 @@ void TRACE_msg_set_task_category(m_task_t task, const char *category) if (!TRACE_is_active()) return; - xbt_assert3(task->category == NULL, "Task %p(%s) already has a category (%s).", + xbt_assert(task->category == NULL, "Task %p(%s) already has a category (%s).", task, task->name, task->category); if (TRACE_msg_task_is_enabled()){ - xbt_assert2(task->name != NULL, + xbt_assert(task->name != NULL, "Task %p(%s) must have a unique name in order to be traced, if --cfg=tracing/msg/task:1 is used.", task, task->name); - xbt_assert3(getContainer(task->name)==NULL, + xbt_assert(getContainer(task->name)==NULL, "Task %p(%s). Tracing already knows a task with name %s." "The name of each task must be unique, if --cfg=tracing/msg/task:1 is used.", task, task->name, task->name); } @@ -44,7 +44,7 @@ void TRACE_msg_set_task_category(m_task_t task, const char *category) m_host_t host = MSG_host_self(); container_t host_container = getContainer(host->name); //check to see if there is a container with the task->name - xbt_assert3(getContainer(task->name) == NULL, + xbt_assert(getContainer(task->name) == NULL, "Task %p(%s). Tracing already knows a task with name %s." "The name of each task must be unique, if --cfg=tracing/msg/task:1 is used.", task, task->name, task->name); container_t msg = newContainer(task->name, INSTR_MSG_TASK, host_container); diff --git a/src/instr/instr_paje_trace.c b/src/instr/instr_paje_trace.c index 142b6183e3..d2c4026885 100644 --- a/src/instr/instr_paje_trace.c +++ b/src/instr/instr_paje_trace.c @@ -155,7 +155,7 @@ void TRACE_paje_start(void) { char *filename = TRACE_get_filename(); tracing_file = fopen(filename, "w"); - xbt_assert1 (tracing_file != NULL, "Tracefile %s could not be opened for writing.", filename); + xbt_assert (tracing_file != NULL, "Tracefile %s could not be opened for writing.", filename); XBT_DEBUG("Filename %s is open for writing", filename); diff --git a/src/instr/instr_routing.c b/src/instr/instr_routing.c index ce53d219d5..3dc81263c2 100644 --- a/src/instr/instr_routing.c +++ b/src/instr/instr_routing.c @@ -71,7 +71,7 @@ static void linkContainers (const char *a1, const char *a2, xbt_dict_t filter) type_t a2_type = a2_container->type; container_t container = findCommonFather (getRootContainer(), a1_container, a2_container); - xbt_assert0 (container != NULL, "common father not found"); + xbt_assert (container != NULL, "common father not found"); //declare type char link_typename[INSTR_DEFAULT_STR_SIZE]; @@ -144,7 +144,7 @@ static void recursiveGraphExtraction (container_t container, xbt_dict_t filter) //no route between them, that's possible continue; } - xbt_assert2(route!=NULL, + xbt_assert(route!=NULL, "there is no ASroute between %s and %s", child_name1, child_name2); unsigned int cpt; void *link; diff --git a/src/instr/instr_smpi.c b/src/instr/instr_smpi.c index 50c1c17eb7..130bc2635a 100644 --- a/src/instr/instr_smpi.c +++ b/src/instr/instr_smpi.c @@ -45,7 +45,7 @@ static char *TRACE_smpi_get_key(int src, int dst, char *key, int n) snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d", src, dst); xbt_dynar_t d = xbt_dict_get_or_null(keys, aux); - xbt_assert1(xbt_dynar_length(d)!=0, + xbt_assert(xbt_dynar_length(d)!=0, "Trying to get a link key (for message reception) that has no corresponding send (%s).", __FUNCTION__); char *s = xbt_dynar_get_as (d, 0, char *); snprintf (key, n, "%s", s); @@ -113,7 +113,7 @@ void TRACE_smpi_init(int rank) }else{ father = getContainer ("0"); } - xbt_assert2(father!=NULL, + xbt_assert(father!=NULL, "Could not find a parent for mpi rank %s at function %s", str, __FUNCTION__); newContainer(str, INSTR_SMPI, father); } diff --git a/src/mc/memory_map.c b/src/mc/memory_map.c index 689fe6c157..e5ea6c8b01 100644 --- a/src/mc/memory_map.c +++ b/src/mc/memory_map.c @@ -19,7 +19,7 @@ memory_map_t get_memory_map(void) /* to be returned. */ fp = fopen("/proc/self/maps", "r"); - xbt_assert0(fp, + xbt_assert(fp, "Cannot open /proc/self/maps to investigate the memory map of the process. Please report this bug."); ret = xbt_new0(s_memory_map_t, 1); diff --git a/src/msg/deployment.c b/src/msg/deployment.c index 29e5235558..fadf887a22 100644 --- a/src/msg/deployment.c +++ b/src/msg/deployment.c @@ -26,7 +26,7 @@ void MSG_launch_application(const char *file) { - xbt_assert0(msg_global, + xbt_assert(msg_global, "MSG_global_init_args has to be called before MSG_launch_application."); SIMIX_launch_application(file); diff --git a/src/msg/global.c b/src/msg/global.c index e853feddc2..6aa780db65 100644 --- a/src/msg/global.c +++ b/src/msg/global.c @@ -110,7 +110,7 @@ void MSG_global_init(int *argc, char **argv) */ MSG_error_t MSG_set_channel_number(int number) { - xbt_assert0((msg_global) + xbt_assert((msg_global) && (msg_global->max_channel == 0), "Channel number already set!"); @@ -128,7 +128,7 @@ MSG_error_t MSG_set_channel_number(int number) */ int MSG_get_channel_number(void) { - xbt_assert0((msg_global) + xbt_assert((msg_global) && (msg_global->max_channel != 0), "Channel number not set yet!"); diff --git a/src/msg/gos.c b/src/msg/gos.c index 2143286794..7d929e1376 100644 --- a/src/msg/gos.c +++ b/src/msg/gos.c @@ -43,14 +43,14 @@ MSG_error_t MSG_task_execute(m_task_t task) simdata = task->simdata; - xbt_assert0(simdata->host_nb == 0, + xbt_assert(simdata->host_nb == 0, "This is a parallel task. Go to hell."); #ifdef HAVE_TRACING TRACE_msg_task_execute_start(task); #endif - xbt_assert1((!simdata->compute) && (task->simdata->isused == 0), + xbt_assert((!simdata->compute) && (task->simdata->isused == 0), "This task is executed somewhere else. Go fix your code! %d", task->simdata->isused); @@ -173,11 +173,11 @@ MSG_error_t MSG_parallel_task_execute(m_task_t task) simdata = task->simdata; p_simdata = SIMIX_process_self_get_data(); - xbt_assert0((!simdata->compute) + xbt_assert((!simdata->compute) && (task->simdata->isused == 0), "This task is executed somewhere else. Go fix your code!"); - xbt_assert0(simdata->host_nb, + xbt_assert(simdata->host_nb, "This is not a parallel task. Go to hell."); XBT_DEBUG("Parallel computing on %s", p_simdata->m_host->name); @@ -331,7 +331,7 @@ MSG_error_t MSG_task_get_ext(m_task_t * task, m_channel_t channel, double timeout, m_host_t host) { - xbt_assert1((channel >= 0) + xbt_assert((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel); @@ -414,7 +414,7 @@ XBT_INLINE msg_comm_t MSG_task_isend_with_matching(m_task_t task, const char *al t_simdata->sender = process; t_simdata->source = MSG_host_self(); - xbt_assert0(t_simdata->isused == 0, + xbt_assert(t_simdata->isused == 0, "This task is still being used somewhere else. You cannot send it now. Go fix your code!"); t_simdata->isused = 1; @@ -465,7 +465,7 @@ void MSG_task_dsend(m_task_t task, const char *alias, void_f_pvoid_t cleanup) t_simdata->sender = process; t_simdata->source = MSG_host_self(); - xbt_assert0(t_simdata->isused == 0, + xbt_assert(t_simdata->isused == 0, "This task is still being used somewhere else. You cannot send it now. Go fix your code!"); t_simdata->isused = 1; @@ -495,7 +495,7 @@ msg_comm_t MSG_task_irecv(m_task_t *task, const char *alias) /* FIXME: these functions are not tracable */ /* Sanity check */ - xbt_assert0(task, "Null pointer for the task storage"); + xbt_assert(task, "Null pointer for the task storage"); if (*task) XBT_CRITICAL @@ -731,7 +731,7 @@ int MSG_comm_waitany(xbt_dynar_t comms) xbt_ex_free(e); } - xbt_assert0(finished_index != -1, "WaitAny returned -1"); + xbt_assert(finished_index != -1, "WaitAny returned -1"); xbt_dynar_free(&s_comms); comm = xbt_dynar_get_as(comms, finished_index, msg_comm_t); @@ -755,7 +755,7 @@ MSG_error_t MSG_comm_get_status(msg_comm_t comm) { m_task_t MSG_comm_get_task(msg_comm_t comm) { - xbt_assert0(comm, "Invalid parameter"); + xbt_assert(comm, "Invalid parameter"); return comm->task_received ? *comm->task_received : comm->task_sent; } @@ -838,7 +838,7 @@ MSG_error_t MSG_task_put_with_timeout(m_task_t task, m_host_t dest, m_channel_t channel, double timeout) { - xbt_assert1((channel >= 0) + xbt_assert((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel); @@ -889,7 +889,7 @@ int MSG_task_listen(const char *alias) */ int MSG_task_Iprobe(m_channel_t channel) { - xbt_assert1((channel >= 0) + xbt_assert((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel); @@ -915,7 +915,7 @@ int MSG_task_Iprobe(m_channel_t channel) */ int MSG_task_probe_from_host(int channel, m_host_t host) { - xbt_assert1((channel >= 0) + xbt_assert((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel); @@ -952,7 +952,7 @@ int MSG_task_probe_from(m_channel_t channel) CHECK_HOST(); - xbt_assert1((channel >= 0) + xbt_assert((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel); diff --git a/src/msg/host.c b/src/msg/host.c index 62ca0d8bfe..eef179c87b 100644 --- a/src/msg/host.c +++ b/src/msg/host.c @@ -69,8 +69,8 @@ m_host_t __MSG_host_create(smx_host_t workstation, void *data) */ MSG_error_t MSG_host_set_data(m_host_t host, void *data) { - xbt_assert0((host != NULL), "Invalid parameters"); - xbt_assert0((host->data == NULL), "Data already set"); + xbt_assert((host != NULL), "Invalid parameters"); + xbt_assert((host->data == NULL), "Data already set"); /* Assign data */ host->data = data; @@ -88,7 +88,7 @@ MSG_error_t MSG_host_set_data(m_host_t host, void *data) void *MSG_host_get_data(m_host_t host) { - xbt_assert0((host != NULL), "Invalid parameters"); + xbt_assert((host != NULL), "Invalid parameters"); /* Return data */ return (host->data); @@ -104,7 +104,7 @@ void *MSG_host_get_data(m_host_t host) const char *MSG_host_get_name(m_host_t host) { - xbt_assert0((host != NULL) + xbt_assert((host != NULL) && (host->simdata != NULL), "Invalid parameters"); /* Return data */ @@ -130,7 +130,7 @@ void __MSG_host_destroy(m_host_t host) int i = 0; char alias[MAX_ALIAS_NAME + 1] = { 0 }; /* buffer used to build the key of the mailbox */ - xbt_assert0((host != NULL), "Invalid parameters"); + xbt_assert((host != NULL), "Invalid parameters"); /* Clean Simulator data */ /* SIMIX host will be cleaned when MSG_clean calls SIMIX_clean */ @@ -190,7 +190,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_assert((h != NULL), "Invalid parameters"); xbt_die( "Not implemented yet"); return (0); @@ -202,7 +202,7 @@ int MSG_get_host_msgload(m_host_t h) */ double MSG_get_host_speed(m_host_t h) { - xbt_assert0((h != NULL), "Invalid parameters"); + xbt_assert((h != NULL), "Invalid parameters"); return (SIMIX_req_host_get_speed(h->simdata->smx_host)); } @@ -227,7 +227,7 @@ const char *MSG_host_get_property_value(m_host_t host, const char *name) */ xbt_dict_t MSG_host_get_properties(m_host_t host) { - xbt_assert0((host != NULL), "Invalid parameters (host is NULL)"); + xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); return (SIMIX_req_host_get_properties(host->simdata->smx_host)); } @@ -240,6 +240,6 @@ xbt_dict_t MSG_host_get_properties(m_host_t host) */ int MSG_host_is_avail(m_host_t h) { - xbt_assert0((h != NULL), "Invalid parameters (host is NULL)"); + xbt_assert((h != NULL), "Invalid parameters (host is NULL)"); return (SIMIX_req_host_get_state(h->simdata->smx_host)); } diff --git a/src/msg/m_process.c b/src/msg/m_process.c index 046f73cc88..66cafcb688 100644 --- a/src/msg/m_process.c +++ b/src/msg/m_process.c @@ -138,7 +138,7 @@ m_process_t MSG_process_create_with_environment(const char *name, int argc, char **argv, xbt_dict_t properties) { - xbt_assert0(code != NULL && host != NULL, "Invalid parameters"); + xbt_assert(code != NULL && host != NULL, "Invalid parameters"); simdata_process_t simdata = xbt_new0(s_simdata_process_t, 1); m_process_t process; @@ -234,7 +234,7 @@ MSG_error_t MSG_process_change_host(m_host_t host) */ void* MSG_process_get_data(m_process_t process) { - xbt_assert0(process != NULL, "Invalid parameter"); + xbt_assert(process != NULL, "Invalid parameter"); /* get from SIMIX the MSG process data, and then the user data */ simdata_process_t simdata = SIMIX_req_process_get_data(process); @@ -249,7 +249,7 @@ void* MSG_process_get_data(m_process_t process) */ MSG_error_t MSG_process_set_data(m_process_t process, void *data) { - xbt_assert0(process != NULL, "Invalid parameter"); + xbt_assert(process != NULL, "Invalid parameter"); simdata_process_t simdata = SIMIX_req_process_get_data(process); simdata->data = data; @@ -266,7 +266,7 @@ MSG_error_t MSG_process_set_data(m_process_t process, void *data) */ m_host_t MSG_process_get_host(m_process_t process) { - xbt_assert0(process != NULL, "Invalid parameter"); + xbt_assert(process != NULL, "Invalid parameter"); simdata_process_t simdata = SIMIX_req_process_get_data(process); return simdata->m_host; @@ -315,7 +315,7 @@ int MSG_process_get_PID(m_process_t process) */ int MSG_process_get_PPID(m_process_t process) { - xbt_assert0(process != NULL, "Invalid parameter"); + xbt_assert(process != NULL, "Invalid parameter"); simdata_process_t simdata = SIMIX_req_process_get_data(process); @@ -330,7 +330,7 @@ int MSG_process_get_PPID(m_process_t process) */ const char *MSG_process_get_name(m_process_t process) { - xbt_assert0(process, "Invalid parameter"); + xbt_assert(process, "Invalid parameter"); return SIMIX_req_process_get_name(process); } @@ -355,7 +355,7 @@ const char *MSG_process_get_property_value(m_process_t process, */ xbt_dict_t MSG_process_get_properties(m_process_t process) { - xbt_assert0(process != NULL, "Invalid parameter"); + xbt_assert(process != NULL, "Invalid parameter"); return SIMIX_req_process_get_properties(process); @@ -400,7 +400,7 @@ m_process_t MSG_process_self(void) */ MSG_error_t MSG_process_suspend(m_process_t process) { - xbt_assert0(process != NULL, "Invalid parameter"); + xbt_assert(process != NULL, "Invalid parameter"); CHECK_HOST(); #ifdef HAVE_TRACING @@ -419,7 +419,7 @@ MSG_error_t MSG_process_suspend(m_process_t process) */ MSG_error_t MSG_process_resume(m_process_t process) { - xbt_assert0(process != NULL, "Invalid parameter"); + xbt_assert(process != NULL, "Invalid parameter"); CHECK_HOST(); #ifdef HAVE_TRACING @@ -438,7 +438,7 @@ MSG_error_t MSG_process_resume(m_process_t process) */ int MSG_process_is_suspended(m_process_t process) { - xbt_assert0(process != NULL, "Invalid parameter"); + xbt_assert(process != NULL, "Invalid parameter"); return SIMIX_req_process_is_suspended(process); } diff --git a/src/msg/msg_actions.c b/src/msg/msg_actions.c index 9860331077..5ac10d13da 100644 --- a/src/msg/msg_actions.c +++ b/src/msg/msg_actions.c @@ -61,7 +61,7 @@ static int MSG_action_runner(int argc, char *argv[]) free(evt); } } else { // Should have got my trace file in argument - xbt_assert1(argc >= 2, + xbt_assert(argc >= 2, "No '%s' agent function provided, no simulation-wide trace file provided to MSG_action_trace_run(), " "and no process-wide trace file provided in deployment file. Aborting.", argv[0] @@ -171,7 +171,7 @@ MSG_error_t MSG_action_trace_run(char *path) if (path) { action_fp = fopen(path, "r"); - xbt_assert2(action_fp != NULL, "Cannot open %s: %s", path, + xbt_assert(action_fp != NULL, "Cannot open %s: %s", path, strerror(errno)); } res = MSG_main(); diff --git a/src/msg/msg_mailbox.c b/src/msg/msg_mailbox.c index 6700ed73b8..979b95786e 100644 --- a/src/msg/msg_mailbox.c +++ b/src/msg/msg_mailbox.c @@ -58,8 +58,8 @@ msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias) msg_mailbox_t MSG_mailbox_get_by_channel(m_host_t host, m_channel_t channel) { - xbt_assert0((host != NULL), "Invalid host"); - xbt_assert1((channel >= 0) + xbt_assert((host != NULL), "Invalid host"); + xbt_assert((channel >= 0) && (channel < msg_global->max_channel), "Invalid channel %d", channel); @@ -83,7 +83,7 @@ MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, m_task_t * task, #endif /* Sanity check */ - xbt_assert0(task, "Null pointer for the task storage"); + xbt_assert(task, "Null pointer for the task storage"); if (*task) XBT_CRITICAL @@ -146,7 +146,7 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task, t_simdata->sender = process; t_simdata->source = MSG_host_self(); - xbt_assert0(t_simdata->isused == 0, + xbt_assert(t_simdata->isused == 0, "This task is still being used somewhere else. You cannot send it now. Go fix your code!"); t_simdata->isused=1; diff --git a/src/msg/private.h b/src/msg/private.h index f4f74b88bc..ef8b829767 100644 --- a/src/msg/private.h +++ b/src/msg/private.h @@ -100,7 +100,7 @@ XBT_PUBLIC_DATA(MSG_Global_t) msg_global; #define MSG_RETURN(val) do {PROCESS_SET_ERRNO(val);return(val);} while(0) /* #define CHECK_ERRNO() ASSERT((PROCESS_GET_ERRNO()!=MSG_HOST_FAILURE),"Host failed, you cannot call this function.") */ -/*#define CHECK_HOST() xbt_assert1(SIMIX_req_host_get_state(SIMIX_host_self())==1,\ +/*#define CHECK_HOST() xbt_assert(SIMIX_req_host_get_state(SIMIX_host_self())==1,\ "Host failed, you cannot call this function. (state=%d)",SIMIX_req_host_get_state(SIMIX_host_self()))*/ #define CHECK_HOST() diff --git a/src/msg/task.c b/src/msg/task.c index 116725c358..2908b353fe 100644 --- a/src/msg/task.c +++ b/src/msg/task.c @@ -86,7 +86,7 @@ m_task_t MSG_task_create(const char *name, double compute_duration, */ void *MSG_task_get_data(m_task_t task) { - xbt_assert0((task != NULL), "Invalid parameter"); + xbt_assert((task != NULL), "Invalid parameter"); return (task->data); } @@ -99,7 +99,7 @@ void *MSG_task_get_data(m_task_t task) */ void MSG_task_set_data(m_task_t task, void *data) { - xbt_assert0((task != NULL), "Invalid parameter"); + xbt_assert((task != NULL), "Invalid parameter"); task->data = data; } @@ -111,7 +111,7 @@ void MSG_task_set_data(m_task_t task, void *data) */ m_process_t MSG_task_get_sender(m_task_t task) { - xbt_assert0(task, "Invalid parameters"); + xbt_assert(task, "Invalid parameters"); return ((simdata_task_t) task->simdata)->sender; } @@ -122,7 +122,7 @@ m_process_t MSG_task_get_sender(m_task_t task) */ m_host_t MSG_task_get_source(m_task_t task) { - xbt_assert0(task, "Invalid parameters"); + xbt_assert(task, "Invalid parameters"); return ((simdata_task_t) task->simdata)->source; } @@ -133,7 +133,7 @@ m_host_t MSG_task_get_source(m_task_t task) */ const char *MSG_task_get_name(m_task_t task) { - xbt_assert0(task, "Invalid parameters"); + xbt_assert(task, "Invalid parameters"); return task->name; } @@ -144,7 +144,7 @@ const char *MSG_task_get_name(m_task_t task) */ void MSG_task_set_name(m_task_t task, const char *name) { - xbt_assert0(task, "Invalid parameters"); + xbt_assert(task, "Invalid parameters"); task->name = xbt_strdup(name); } @@ -157,7 +157,7 @@ void MSG_task_set_name(m_task_t task, const char *name) MSG_error_t MSG_task_destroy(m_task_t task) { smx_action_t action = NULL; - xbt_assert0((task != NULL), "Invalid parameter"); + xbt_assert((task != NULL), "Invalid parameter"); /* why? if somebody is using, then you can't free! ok... but will return MSG_OK? when this task will be destroyed? isn't the user code wrong? */ if (task->simdata->isused > 0) { @@ -194,7 +194,7 @@ MSG_error_t MSG_task_destroy(m_task_t task) */ MSG_error_t MSG_task_cancel(m_task_t task) { - xbt_assert0((task != NULL), "Invalid parameter"); + xbt_assert((task != NULL), "Invalid parameter"); if (task->simdata->compute) { SIMIX_req_host_execution_cancel(task->simdata->compute); @@ -213,7 +213,7 @@ MSG_error_t MSG_task_cancel(m_task_t task) */ double MSG_task_get_compute_duration(m_task_t task) { - xbt_assert0((task != NULL) + xbt_assert((task != NULL) && (task->simdata != NULL), "Invalid parameter"); return task->simdata->computation_amount; @@ -227,7 +227,7 @@ double MSG_task_get_compute_duration(m_task_t task) void MSG_task_set_compute_duration(m_task_t task, double computation_amount) { - xbt_assert0(task, "Invalid parameter"); + xbt_assert(task, "Invalid parameter"); task->simdata->computation_amount = computation_amount; } @@ -238,7 +238,7 @@ void MSG_task_set_compute_duration(m_task_t task, */ double MSG_task_get_remaining_computation(m_task_t task) { - xbt_assert0((task != NULL) + xbt_assert((task != NULL) && (task->simdata != NULL), "Invalid parameter"); if (task->simdata->compute) { @@ -256,7 +256,7 @@ double MSG_task_get_remaining_computation(m_task_t task) */ double MSG_task_get_remaining_communication(m_task_t task) { - xbt_assert0((task != NULL) + xbt_assert((task != NULL) && (task->simdata != NULL), "Invalid parameter"); XBT_DEBUG("calling SIMIX_req_communication_get_remains(%p)", task->simdata->comm); @@ -270,7 +270,7 @@ double MSG_task_get_remaining_communication(m_task_t task) */ int MSG_task_is_latency_bounded(m_task_t task) { - xbt_assert0((task != NULL) + xbt_assert((task != NULL) && (task->simdata != NULL), "Invalid parameter"); XBT_DEBUG("calling SIMIX_req_communication_is_latency_bounded(%p)", task->simdata->comm); @@ -284,7 +284,7 @@ int MSG_task_is_latency_bounded(m_task_t task) */ double MSG_task_get_data_size(m_task_t task) { - xbt_assert0((task != NULL) + xbt_assert((task != NULL) && (task->simdata != NULL), "Invalid parameter"); return task->simdata->message_size; @@ -300,7 +300,7 @@ double MSG_task_get_data_size(m_task_t task) */ void MSG_task_set_priority(m_task_t task, double priority) { - xbt_assert0((task != NULL) + xbt_assert((task != NULL) && (task->simdata != NULL), "Invalid parameter"); task->simdata->priority = 1 / priority; diff --git a/src/simdag/private.h b/src/simdag/private.h index dce5fd6535..fc7026a6fa 100644 --- a/src/simdag/private.h +++ b/src/simdag/private.h @@ -16,7 +16,7 @@ #include #define SD_INITIALISED() (sd_global != NULL) -#define SD_CHECK_INIT_DONE() xbt_assert0(SD_INITIALISED(), "Call SD_init() first"); +#define SD_CHECK_INIT_DONE() xbt_assert(SD_INITIALISED(), "Call SD_init() first"); /* Global variables */ diff --git a/src/simdag/sd_daxloader.c b/src/simdag/sd_daxloader.c index 69d4ad5393..5117925cc2 100644 --- a/src/simdag/sd_daxloader.c +++ b/src/simdag/sd_daxloader.c @@ -280,7 +280,7 @@ xbt_dynar_t SD_daxload(const char *filename) SD_task_t file; char *name; FILE *in_file = fopen(filename, "r"); - xbt_assert1(in_file, "Unable to open \"%s\"\n", filename); + xbt_assert(in_file, "Unable to open \"%s\"\n", filename); input_buffer = dax__create_buffer(in_file, 10); dax__switch_to_buffer(input_buffer); dax_lineno = 1; @@ -297,7 +297,7 @@ xbt_dynar_t SD_daxload(const char *filename) int res; res = dax_lex(); - xbt_assert2(!res, "Parse error in %s: %s", filename, + xbt_assert(!res, "Parse error in %s: %s", filename, dax__parse_err_msg()); dax__delete_buffer(input_buffer); fclose(in_file); @@ -395,7 +395,7 @@ void STag_dax__adag(void) double version; version = dax_parse_double(A_dax__adag_version); - xbt_assert1(version == 2.1, + xbt_assert(version == 2.1, "Expected version 2.1 in tag, got %f. Fix the parser or your file", version); } diff --git a/src/simdag/sd_dotloader.c b/src/simdag/sd_dotloader.c index f2ee1a694b..71c6cc4161 100644 --- a/src/simdag/sd_dotloader.c +++ b/src/simdag/sd_dotloader.c @@ -147,7 +147,7 @@ xbt_dynar_t SD_dotload_with_sched(const char *filename){ xbt_dynar_t SD_dotload_generic(const char * filename) { - xbt_assert0(filename, "Unable to use a null file descriptor\n"); + xbt_assert(filename, "Unable to use a null file descriptor\n"); dag_dot = agopen((char*)filename,Agstrictdirected,0); result = xbt_dynar_new(sizeof(SD_task_t), dot_task_free); diff --git a/src/simdag/sd_global.c b/src/simdag/sd_global.c index 572898dd6e..87a0995d68 100644 --- a/src/simdag/sd_global.c +++ b/src/simdag/sd_global.c @@ -52,7 +52,7 @@ void SD_init(int *argc, char **argv) s_SD_task_t task; - xbt_assert0(!SD_INITIALISED(), "SD_init() already called"); + xbt_assert(!SD_INITIALISED(), "SD_init() already called"); /* Connect our log channels: that must be done manually under windows */ XBT_LOG_CONNECT(sd_kernel, sd); diff --git a/src/simdag/sd_link.c b/src/simdag/sd_link.c index 3274682b5b..c69d93c745 100644 --- a/src/simdag/sd_link.c +++ b/src/simdag/sd_link.c @@ -19,7 +19,7 @@ SD_link_t __SD_link_create(void *surf_link, void *data) const char *name; SD_CHECK_INIT_DONE(); - xbt_assert0(surf_link != NULL, "surf_link is NULL !"); + xbt_assert(surf_link != NULL, "surf_link is NULL !"); link = xbt_new(s_SD_link_t, 1); link->surf_link = surf_link; @@ -52,7 +52,7 @@ const SD_link_t *SD_link_get_list(void) int i; SD_CHECK_INIT_DONE(); - xbt_assert0(SD_link_get_number() > 0, "There is no link!"); + xbt_assert(SD_link_get_number() > 0, "There is no link!"); if (sd_global->link_list == NULL) { /* this is the first time the function is called */ sd_global->link_list = xbt_new(SD_link_t, link_lib->count); @@ -87,7 +87,7 @@ int SD_link_get_number(void) void *SD_link_get_data(SD_link_t link) { SD_CHECK_INIT_DONE(); - xbt_assert0(link != NULL, "Invalid parameter"); + xbt_assert(link != NULL, "Invalid parameter"); return link->data; } @@ -104,7 +104,7 @@ void *SD_link_get_data(SD_link_t link) void SD_link_set_data(SD_link_t link, void *data) { SD_CHECK_INIT_DONE(); - xbt_assert0(link != NULL, "Invalid parameter"); + xbt_assert(link != NULL, "Invalid parameter"); link->data = data; } @@ -117,7 +117,7 @@ void SD_link_set_data(SD_link_t link, void *data) const char *SD_link_get_name(SD_link_t link) { SD_CHECK_INIT_DONE(); - xbt_assert0(link != NULL, "Invalid parameter"); + xbt_assert(link != NULL, "Invalid parameter"); return surf_resource_name(link->surf_link); } @@ -130,7 +130,7 @@ const char *SD_link_get_name(SD_link_t link) double SD_link_get_current_bandwidth(SD_link_t link) { SD_CHECK_INIT_DONE(); - xbt_assert0(link != NULL, "Invalid parameter"); + xbt_assert(link != NULL, "Invalid parameter"); return surf_workstation_model->extension.workstation. get_link_bandwidth(link->surf_link); } @@ -144,7 +144,7 @@ double SD_link_get_current_bandwidth(SD_link_t link) double SD_link_get_current_latency(SD_link_t link) { SD_CHECK_INIT_DONE(); - xbt_assert0(link != NULL, "Invalid parameter"); + xbt_assert(link != NULL, "Invalid parameter"); return surf_workstation_model->extension.workstation. get_link_latency(link->surf_link); } @@ -160,7 +160,7 @@ double SD_link_get_current_latency(SD_link_t link) e_SD_link_sharing_policy_t SD_link_get_sharing_policy(SD_link_t link) { SD_CHECK_INIT_DONE(); - xbt_assert0(link != NULL, "Invalid parameter"); + xbt_assert(link != NULL, "Invalid parameter"); return link->sharing_policy; } @@ -170,7 +170,7 @@ e_SD_link_sharing_policy_t SD_link_get_sharing_policy(SD_link_t link) void __SD_link_destroy(void *link) { SD_CHECK_INIT_DONE(); - xbt_assert0(link != NULL, "Invalid parameter"); + xbt_assert(link != NULL, "Invalid parameter"); /* link->surf_link is freed by surf_exit and link->data is freed by the user */ xbt_free(link); } diff --git a/src/simdag/sd_task.c b/src/simdag/sd_task.c index 44982dc97c..555f6efb7e 100644 --- a/src/simdag/sd_task.c +++ b/src/simdag/sd_task.c @@ -83,7 +83,7 @@ SD_task_t SD_task_create(const char *name, void *data, double amount) void *SD_task_get_data(SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); return task->data; } @@ -100,7 +100,7 @@ void *SD_task_get_data(SD_task_t task) void SD_task_set_data(SD_task_t task, void *data) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); task->data = data; } @@ -115,7 +115,7 @@ void SD_task_set_data(SD_task_t task, void *data) e_SD_task_state_t SD_task_get_state(SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); return task->state; } @@ -179,7 +179,7 @@ void __SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state) const char *SD_task_get_name(SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); return task->name; } @@ -202,7 +202,7 @@ xbt_dynar_t SD_task_get_parents(SD_task_t task) xbt_dynar_t parents; SD_dependency_t dep; SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); parents = xbt_dynar_new(sizeof(SD_task_t), NULL); xbt_dynar_foreach(task->tasks_before, i, dep) { @@ -222,7 +222,7 @@ xbt_dynar_t SD_task_get_children(SD_task_t task) xbt_dynar_t children; SD_dependency_t dep; SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); children = xbt_dynar_new(sizeof(SD_task_t), NULL); xbt_dynar_foreach(task->tasks_after, i, dep) { @@ -240,8 +240,8 @@ xbt_dynar_t SD_task_get_children(SD_task_t task) int SD_task_get_workstation_count(SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); - // xbt_assert1( task->state_set != sd_global->scheduled_task_set, + xbt_assert(task != NULL, "Invalid parameter"); + //xbt_assert(task->state_set != sd_global->scheduled_task_set, // "Unscheduled task %s", task->name); return task->workstation_nb; } @@ -255,8 +255,8 @@ int SD_task_get_workstation_count(SD_task_t task) SD_workstation_t *SD_task_get_workstation_list(SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); - //xbt_assert1( task->state_set != sd_global->scheduled_task_set, + xbt_assert(task != NULL, "Invalid parameter"); + //xbt_assert(task->state_set != sd_global->scheduled_task_set, // "Unscheduled task %s", task->name); return task->workstation_list; } @@ -271,7 +271,7 @@ SD_workstation_t *SD_task_get_workstation_list(SD_task_t task) double SD_task_get_amount(SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); return task->amount; } @@ -285,7 +285,7 @@ double SD_task_get_amount(SD_task_t task) double SD_task_get_remaining_amount(SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); if (task->surf_action) return surf_workstation_model->get_remains(task->surf_action); @@ -401,7 +401,7 @@ void SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_dependency_t dependency; SD_CHECK_INIT_DONE(); - xbt_assert0(src != NULL && dst != NULL, "Invalid parameter"); + xbt_assert(src != NULL && dst != NULL, "Invalid parameter"); dynar = src->tasks_after; length = xbt_dynar_length(dynar); @@ -479,7 +479,7 @@ int SD_task_dependency_exists(SD_task_t src, SD_task_t dst) SD_dependency_t dependency; SD_CHECK_INIT_DONE(); - xbt_assert0(src != NULL + xbt_assert(src != NULL || dst != NULL, "Invalid parameter: both src and dst are NULL"); @@ -515,7 +515,7 @@ void SD_task_dependency_remove(SD_task_t src, SD_task_t dst) SD_dependency_t dependency; SD_CHECK_INIT_DONE(); - xbt_assert0(src != NULL && dst != NULL, "Invalid parameter"); + xbt_assert(src != NULL && dst != NULL, "Invalid parameter"); /* remove the dependency from src->tasks_after */ dynar = src->tasks_after; @@ -550,7 +550,7 @@ void SD_task_dependency_remove(SD_task_t src, SD_task_t dst) } } /* should never happen... */ - xbt_assert4(found, + xbt_assert(found, "SimDag error: task '%s' is a successor of '%s' but task '%s' is not a predecessor of task '%s'", SD_task_get_name(dst), SD_task_get_name(src), SD_task_get_name(src), SD_task_get_name(dst)); @@ -590,7 +590,7 @@ void *SD_task_dependency_get_data(SD_task_t src, SD_task_t dst) SD_CHECK_INIT_DONE(); - xbt_assert0(src != NULL && dst != NULL, "Invalid parameter"); + xbt_assert(src != NULL && dst != NULL, "Invalid parameter"); dynar = src->tasks_after; length = xbt_dynar_length(dynar); @@ -643,7 +643,7 @@ static void __SD_print_watch_points(SD_task_t task) void SD_task_watch(SD_task_t task, e_SD_task_state_t state) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); if (state & SD_NOT_SCHEDULED) THROWF(arg_error, 0, @@ -663,8 +663,8 @@ void SD_task_watch(SD_task_t task, e_SD_task_state_t state) void SD_task_unwatch(SD_task_t task, e_SD_task_state_t state) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); - xbt_assert0(state != SD_NOT_SCHEDULED, + xbt_assert(task != NULL, "Invalid parameter"); + xbt_assert(state != SD_NOT_SCHEDULED, "SimDag error: Cannot have a watch point for state SD_NOT_SCHEDULED"); task->watch_points = task->watch_points & ~state; @@ -694,7 +694,7 @@ double SD_task_get_execution_time(SD_task_t task, double time, max_time = 0.0; int i, j; SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL && workstation_nb > 0 + xbt_assert(task != NULL && workstation_nb > 0 && workstation_list != NULL, "Invalid parameter"); /* the task execution time is the maximum execution time of the parallel tasks */ @@ -761,7 +761,7 @@ void SD_task_schedule(SD_task_t task, int workstation_count, int communication_nb; task->workstation_nb = 0; task->rate = -1; - xbt_assert0(workstation_count > 0, "workstation_nb must be positive"); + xbt_assert(workstation_count > 0, "workstation_nb must be positive"); task->workstation_nb = workstation_count; task->rate = rate; @@ -809,7 +809,7 @@ void SD_task_schedule(SD_task_t task, int workstation_count, void SD_task_unschedule(SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); if (task->state_set != sd_global->scheduled_task_set && task->state_set != sd_global->runnable_task_set && @@ -862,11 +862,11 @@ void __SD_task_really_run(SD_task_t task) void **surf_workstations; SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); - xbt_assert2(__SD_task_is_runnable_or_in_fifo(task), + xbt_assert(task != NULL, "Invalid parameter"); + xbt_assert(__SD_task_is_runnable_or_in_fifo(task), "Task '%s' is not runnable or in a fifo! Task state: %d", SD_task_get_name(task), SD_task_get_state(task)); - xbt_assert1(task->workstation_list != NULL, + xbt_assert(task->workstation_list != NULL, "Task '%s': workstation_list is NULL!", SD_task_get_name(task)); @@ -879,7 +879,7 @@ void __SD_task_really_run(SD_task_t task) if (SD_workstation_get_access_mode(task->workstation_list[i]) == SD_WORKSTATION_SEQUENTIAL_ACCESS) { task->workstation_list[i]->current_task = task; - xbt_assert0(__SD_workstation_is_busy(task->workstation_list[i]), + xbt_assert(__SD_workstation_is_busy(task->workstation_list[i]), "The workstation should be busy now"); } } @@ -966,7 +966,7 @@ void __SD_task_really_run(SD_task_t task) __SD_task_destroy_scheduling_data(task); /* now the scheduling data are not useful anymore */ __SD_task_set_state(task, SD_RUNNING); - xbt_assert2(__SD_task_is_running(task), "Bad state of task '%s': %d", + xbt_assert(__SD_task_is_running(task), "Bad state of task '%s': %d", SD_task_get_name(task), SD_task_get_state(task)); } @@ -985,8 +985,8 @@ int __SD_task_try_to_run(SD_task_t task) SD_workstation_t workstation; SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); - xbt_assert2(__SD_task_is_runnable(task), + xbt_assert(task != NULL, "Invalid parameter"); + xbt_assert(__SD_task_is_runnable(task), "Task '%s' is not runnable! Task state: %d", SD_task_get_name(task), SD_task_get_state(task)); @@ -1009,7 +1009,7 @@ int __SD_task_try_to_run(SD_task_t task) } } __SD_task_set_state(task, SD_IN_FIFO); - xbt_assert2(__SD_task_is_in_fifo(task), "Bad state of task '%s': %d", + xbt_assert(__SD_task_is_in_fifo(task), "Bad state of task '%s': %d", SD_task_get_name(task), SD_task_get_state(task)); XBT_DEBUG("Task '%s' state is now SD_IN_FIFO", SD_task_get_name(task)); } else { @@ -1035,11 +1035,11 @@ void __SD_task_just_done(SD_task_t task) int can_start = 1; SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); - xbt_assert1(__SD_task_is_running(task), + xbt_assert(task != NULL, "Invalid parameter"); + xbt_assert(__SD_task_is_running(task), "The task must be running! Task state: %d", SD_task_get_state(task)); - xbt_assert1(task->workstation_list != NULL, + xbt_assert(task->workstation_list != NULL, "Task '%s': workstation_list is NULL!", SD_task_get_name(task)); @@ -1059,10 +1059,10 @@ void __SD_task_just_done(SD_task_t task) XBT_DEBUG("Workstation '%s': access_mode = %d", SD_workstation_get_name(workstation), workstation->access_mode); if (workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) { - xbt_assert1(workstation->task_fifo != NULL, + xbt_assert(workstation->task_fifo != NULL, "Workstation '%s' has sequential access but no fifo!", SD_workstation_get_name(workstation)); - xbt_assert2(workstation->current_task = + xbt_assert(workstation->current_task = task, "Workstation '%s': current task should be '%s'", SD_workstation_get_name(workstation), SD_task_get_name(task)); @@ -1077,7 +1077,7 @@ void __SD_task_just_done(SD_task_t task) if (candidate != NULL) { XBT_DEBUG("Candidate: '%s'", SD_task_get_name(candidate)); - xbt_assert2(__SD_task_is_in_fifo(candidate), + xbt_assert(__SD_task_is_in_fifo(candidate), "Bad state of candidate '%s': %d", SD_task_get_name(candidate), SD_task_get_state(candidate)); @@ -1117,7 +1117,7 @@ void __SD_task_just_done(SD_task_t task) continue; /* we have already evaluated that task */ } - xbt_assert2(__SD_task_is_in_fifo(candidate), + xbt_assert(__SD_task_is_in_fifo(candidate), "Bad state of candidate '%s': %d", SD_task_get_name(candidate), SD_task_get_state(candidate)); @@ -1146,7 +1146,7 @@ void __SD_task_just_done(SD_task_t task) XBT_DEBUG("Head of the fifo: '%s'", (candidate != NULL) ? SD_task_get_name(candidate) : "NULL"); - xbt_assert0(candidate == candidates[i], + xbt_assert(candidate == candidates[i], "Error in __SD_task_just_done: bad first task in the fifo"); } } /* for each workstation */ @@ -1160,7 +1160,7 @@ void __SD_task_just_done(SD_task_t task) ("Calling __SD_task_is_running: task '%s', state set: %p, running_task_set: %p, is running: %d", SD_task_get_name(candidate), candidate->state_set, sd_global->running_task_set, __SD_task_is_running(candidate)); - xbt_assert2(__SD_task_is_running(candidate), + xbt_assert(__SD_task_is_running(candidate), "Bad state of task '%s': %d", SD_task_get_name(candidate), SD_task_get_state(candidate)); @@ -1202,7 +1202,7 @@ static void __SD_task_remove_dependencies(SD_task_t task) double SD_task_get_start_time(SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); if (task->surf_action) return surf_workstation_model-> action_get_start_time(task->surf_action); @@ -1224,7 +1224,7 @@ double SD_task_get_start_time(SD_task_t task) double SD_task_get_finish_time(SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); if (task->surf_action) /* should never happen as actions are destroyed right after their completion */ return surf_workstation_model-> @@ -1244,7 +1244,7 @@ double SD_task_get_finish_time(SD_task_t task) void SD_task_destroy(SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(task != NULL, "Invalid parameter"); + xbt_assert(task != NULL, "Invalid parameter"); XBT_DEBUG("Destroying task %s...", SD_task_get_name(task)); @@ -1358,7 +1358,7 @@ void SD_task_schedulev(SD_task_t task, int count, int i; SD_dependency_t dep; unsigned int cpt; - xbt_assert1(task->kind != 0, + xbt_assert(task->kind != 0, "Task %s is not typed. Cannot automatically schedule it.", SD_task_get_name(task)); switch (task->kind) { diff --git a/src/simdag/sd_workstation.c b/src/simdag/sd_workstation.c index 1044c91020..46808556d0 100644 --- a/src/simdag/sd_workstation.c +++ b/src/simdag/sd_workstation.c @@ -22,7 +22,7 @@ SD_workstation_t __SD_workstation_create(void *surf_workstation, SD_workstation_t workstation; const char *name; SD_CHECK_INIT_DONE(); - xbt_assert0(surf_workstation != NULL, "surf_workstation is NULL !"); + xbt_assert(surf_workstation != NULL, "surf_workstation is NULL !"); workstation = xbt_new(s_SD_workstation_t, 1); workstation->surf_workstation = surf_workstation; @@ -48,7 +48,7 @@ SD_workstation_t SD_workstation_get_by_name(const char *name) { SD_CHECK_INIT_DONE(); - xbt_assert0(name != NULL, "Invalid parameter"); + xbt_assert(name != NULL, "Invalid parameter"); return xbt_lib_get_or_null(host_lib, name, SD_HOST_LEVEL); } @@ -70,7 +70,7 @@ const SD_workstation_t *SD_workstation_get_list(void) int i; SD_CHECK_INIT_DONE(); - xbt_assert0(SD_workstation_get_number() > 0, "There is no workstation!"); + xbt_assert(SD_workstation_get_number() > 0, "There is no workstation!"); if (sd_global->workstation_list == NULL) { /* this is the first time the function is called */ sd_global->workstation_list = @@ -107,7 +107,7 @@ int SD_workstation_get_number(void) void *SD_workstation_get_data(SD_workstation_t workstation) { SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL, "Invalid parameter"); + xbt_assert(workstation != NULL, "Invalid parameter"); return workstation->data; } @@ -124,7 +124,7 @@ void *SD_workstation_get_data(SD_workstation_t workstation) void SD_workstation_set_data(SD_workstation_t workstation, void *data) { SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL, "Invalid parameter"); + xbt_assert(workstation != NULL, "Invalid parameter"); workstation->data = data; } @@ -137,7 +137,7 @@ void SD_workstation_set_data(SD_workstation_t workstation, void *data) const char *SD_workstation_get_name(SD_workstation_t workstation) { SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL, "Invalid parameter"); + xbt_assert(workstation != NULL, "Invalid parameter"); return surf_resource_name(workstation->surf_workstation); } @@ -164,7 +164,7 @@ const char *SD_workstation_get_property_value(SD_workstation_t ws, xbt_dict_t SD_workstation_get_properties(SD_workstation_t workstation) { SD_CHECK_INIT_DONE(); - xbt_assert0((workstation != NULL), "Invalid parameters"); + xbt_assert((workstation != NULL), "Invalid parameters"); return surf_workstation_model->extension. workstation.get_properties(workstation->surf_workstation); @@ -239,7 +239,7 @@ int SD_route_get_size(SD_workstation_t src, SD_workstation_t dst) double SD_workstation_get_power(SD_workstation_t workstation) { SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL, "Invalid parameter"); + xbt_assert(workstation != NULL, "Invalid parameter"); return surf_workstation_model->extension.workstation. get_speed(workstation->surf_workstation, 1.0); } @@ -254,7 +254,7 @@ double SD_workstation_get_power(SD_workstation_t workstation) double SD_workstation_get_available_power(SD_workstation_t workstation) { SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL, "Invalid parameter"); + xbt_assert(workstation != NULL, "Invalid parameter"); return surf_workstation_model->extension. workstation.get_available_speed(workstation->surf_workstation); } @@ -270,8 +270,8 @@ double SD_workstation_get_computation_time(SD_workstation_t workstation, double computation_amount) { SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL, "Invalid parameter"); - xbt_assert0(computation_amount >= 0, + xbt_assert(workstation != NULL, "Invalid parameter"); + xbt_assert(computation_amount >= 0, "computation_amount must be greater than or equal to zero"); return computation_amount / SD_workstation_get_power(workstation); } @@ -295,7 +295,7 @@ double SD_route_get_current_latency(SD_workstation_t src, int i; SD_CHECK_INIT_DONE(); - xbt_assert0(src != NULL && dst != NULL, "Invalid parameter"); + xbt_assert(src != NULL && dst != NULL, "Invalid parameter"); links = SD_route_get_list(src, dst); nb_links = SD_route_get_size(src, dst); latency = 0.0; @@ -327,7 +327,7 @@ double SD_route_get_current_bandwidth(SD_workstation_t src, int i; SD_CHECK_INIT_DONE(); - xbt_assert0(src != NULL && dst != NULL, "Invalid parameter"); + xbt_assert(src != NULL && dst != NULL, "Invalid parameter"); links = SD_route_get_list(src, dst); nb_links = SD_route_get_size(src, dst); @@ -369,8 +369,8 @@ double SD_route_get_communication_time(SD_workstation_t src, int i; SD_CHECK_INIT_DONE(); - xbt_assert0(src != NULL && dst != NULL, "Invalid parameter"); - xbt_assert0(communication_amount >= 0, + xbt_assert(src != NULL && dst != NULL, "Invalid parameter"); + xbt_assert(communication_amount >= 0, "communication_amount must be greater than or equal to zero"); @@ -406,7 +406,7 @@ e_SD_workstation_access_mode_t SD_workstation_get_access_mode(SD_workstation_t workstation) { SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL, "Invalid parameter"); + xbt_assert(workstation != NULL, "Invalid parameter"); return workstation->access_mode; } @@ -430,7 +430,7 @@ void SD_workstation_set_access_mode(SD_workstation_t workstation, access_mode) { SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL, "Invalid parameter"); + xbt_assert(workstation != NULL, "Invalid parameter"); if (access_mode == workstation->access_mode) { return; // nothing is changed @@ -450,7 +450,7 @@ void SD_workstation_set_access_mode(SD_workstation_t workstation, *//* int __SD_workstation_can_start(SD_workstation_t workstation, SD_task_t task) { SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL && task != NULL, "Invalid parameter"); + xbt_assert(workstation != NULL && task != NULL, "Invalid parameter"); return !__SD_workstation_is_busy(workstation) && (xbt_fifo_size(workstation->task_fifo) == 0) || xbt_fifo_get_first_item(workstation->task_fifo) == task); @@ -463,7 +463,7 @@ void SD_workstation_set_access_mode(SD_workstation_t workstation, int __SD_workstation_is_busy(SD_workstation_t workstation) { SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL, "Invalid parameter"); + xbt_assert(workstation != NULL, "Invalid parameter"); XBT_DEBUG ("Workstation '%s' access mode: '%s', current task: %s, fifo size: %d", @@ -489,7 +489,7 @@ void __SD_workstation_destroy(void *workstation) SD_workstation_t w; SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL, "Invalid parameter"); + xbt_assert(workstation != NULL, "Invalid parameter"); /* workstation->surf_workstation is freed by surf_exit and workstation->data is freed by the user */ w = (SD_workstation_t) workstation; @@ -507,8 +507,8 @@ void __SD_workstation_destroy(void *workstation) SD_task_t SD_workstation_get_current_task(SD_workstation_t workstation) { SD_CHECK_INIT_DONE(); - xbt_assert0(workstation != NULL, "Invalid parameter"); - xbt_assert0(workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS, + xbt_assert(workstation != NULL, "Invalid parameter"); + xbt_assert(workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS, "Access mode must be set to SD_WORKSTATION_SEQUENTIAL_ACCESS" " to use this function"); diff --git a/src/simix/smx_context.c b/src/simix/smx_context.c index 810f7fb5f9..9a526f53ae 100644 --- a/src/simix/smx_context.c +++ b/src/simix/smx_context.c @@ -86,7 +86,7 @@ void SIMIX_context_mod_exit(void) */ XBT_INLINE void SIMIX_context_set_nthreads(int nb_threads) { - xbt_assert1(nb_threads > 0, "Invalid number of parallel threads: %d", nb_threads); + xbt_assert(nb_threads > 0, "Invalid number of parallel threads: %d", nb_threads); if (nb_threads > 1) { #ifndef CONTEXT_THREADS diff --git a/src/simix/smx_context_sysv.c b/src/simix/smx_context_sysv.c index 5759fa60e9..41341b63c0 100644 --- a/src/simix/smx_context_sysv.c +++ b/src/simix/smx_context_sysv.c @@ -107,7 +107,7 @@ smx_ctx_sysv_create_context_sized(size_t size, xbt_main_func_t code, int res; res = getcontext(&(context->uc)); - xbt_assert2(res == 0, + xbt_assert(res == 0, "Error in context saving: %d (%s)", errno, strerror(errno)); @@ -194,7 +194,7 @@ void smx_ctx_sysv_suspend(smx_context_t context) int rv; rv = swapcontext(&((smx_ctx_sysv_t) context)->uc, &((smx_ctx_sysv_t)context)->old_uc); - xbt_assert0((rv == 0), "Context swapping failure"); + xbt_assert((rv == 0), "Context swapping failure"); } void smx_ctx_sysv_resume(smx_context_t context) @@ -203,7 +203,7 @@ void smx_ctx_sysv_resume(smx_context_t context) int rv; rv = swapcontext(&((smx_ctx_sysv_t)context)->old_uc, &((smx_ctx_sysv_t) context)->uc); - xbt_assert0((rv == 0), "Context swapping failure"); + xbt_assert((rv == 0), "Context swapping failure"); } void smx_ctx_sysv_runall(xbt_dynar_t processes) @@ -226,7 +226,7 @@ void smx_ctx_sysv_resume_parallel(smx_process_t process) rv = swapcontext(&((smx_ctx_sysv_t)context)->old_uc, &((smx_ctx_sysv_t) context)->uc); smx_current_context = (smx_context_t)maestro_context; - xbt_assert0((rv == 0), "Context swapping failure"); + xbt_assert((rv == 0), "Context swapping failure"); } void smx_ctx_sysv_runall_parallel(xbt_dynar_t processes) diff --git a/src/simix/smx_deployment.c b/src/simix/smx_deployment.c index b8227c19f3..96e99815e4 100644 --- a/src/simix/smx_deployment.c +++ b/src/simix/smx_deployment.c @@ -22,10 +22,10 @@ static double kill_time = -1.0; static void parse_process_init(void) { parse_host = xbt_strdup(A_surfxml_process_host); - xbt_assert1(SIMIX_host_get_by_name(parse_host), + xbt_assert(SIMIX_host_get_by_name(parse_host), "Host '%s' unknown", parse_host); parse_code = SIMIX_get_registered_function(A_surfxml_process_function); - xbt_assert1(parse_code, "Function '%s' unknown", + xbt_assert(parse_code, "Function '%s' unknown", A_surfxml_process_function); parse_argc = 0; parse_argv = NULL; @@ -106,7 +106,7 @@ static void parse_process_finalize(void) void SIMIX_launch_application(const char *file) { int parse_status; - xbt_assert0(simix_global, + xbt_assert(simix_global, "SIMIX_global_init has to be called before SIMIX_launch_application."); // Reset callbacks @@ -121,7 +121,7 @@ void SIMIX_launch_application(const char *file) surf_parse_open(file); parse_status = surf_parse(); surf_parse_close(); - xbt_assert1(!parse_status, "Parse error in %s", file); + xbt_assert(!parse_status, "Parse error in %s", file); } /** @@ -135,7 +135,7 @@ void SIMIX_launch_application(const char *file) XBT_INLINE void SIMIX_function_register(const char *name, xbt_main_func_t code) { - xbt_assert0(simix_global, + xbt_assert(simix_global, "SIMIX_global_init has to be called before SIMIX_function_register."); xbt_dict_set(simix_global->registered_functions, name, code, NULL); @@ -150,7 +150,7 @@ static xbt_main_func_t default_function = NULL; */ void SIMIX_function_register_default(xbt_main_func_t code) { - xbt_assert0(simix_global, + xbt_assert(simix_global, "SIMIX_global_init has to be called before SIMIX_function_register."); default_function = code; @@ -167,7 +167,7 @@ void SIMIX_function_register_default(xbt_main_func_t code) xbt_main_func_t SIMIX_get_registered_function(const char *name) { xbt_main_func_t res = NULL; - xbt_assert0(simix_global, + xbt_assert(simix_global, "SIMIX_global_init has to be called before SIMIX_get_registered_function."); res = xbt_dict_get_or_null(simix_global->registered_functions, name); @@ -190,10 +190,10 @@ void SIMIX_process_set_function(const char *process_host, /* init process */ parse_host = xbt_strdup(process_host); - xbt_assert1(SIMIX_host_get_by_name(parse_host), + xbt_assert(SIMIX_host_get_by_name(parse_host), "Host '%s' unknown", parse_host); parse_code = SIMIX_get_registered_function(process_function); - xbt_assert1(parse_code, "Function '%s' unknown", process_function); + xbt_assert(parse_code, "Function '%s' unknown", process_function); parse_argc = 0; parse_argv = NULL; diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index fe3f5642e3..c1d3e0ccd5 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -50,7 +50,7 @@ void SIMIX_host_destroy(void *h) { smx_host_t host = (smx_host_t) h; - xbt_assert0((host != NULL), "Invalid parameters"); + xbt_assert((host != NULL), "Invalid parameters"); /* Clean Simulator data */ if (xbt_swag_size(host->process_list) != 0) { @@ -98,7 +98,7 @@ xbt_dict_t SIMIX_host_get_dict(void) smx_host_t SIMIX_host_get_by_name(const char *name) { - xbt_assert0(((simix_global != NULL) + xbt_assert(((simix_global != NULL) && (host_lib != NULL)), "Environment not set yet"); @@ -124,21 +124,21 @@ const char* SIMIX_host_self_get_name(void) const char* SIMIX_host_get_name(smx_host_t host) { - xbt_assert0((host != NULL), "Invalid parameters"); + xbt_assert((host != NULL), "Invalid parameters"); return host->name; } xbt_dict_t SIMIX_host_get_properties(smx_host_t host) { - xbt_assert0((host != NULL), "Invalid parameters (simix host is NULL)"); + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_model->extension.workstation.get_properties(host->host); } double SIMIX_host_get_speed(smx_host_t host) { - xbt_assert0((host != NULL), "Invalid parameters (simix host is NULL)"); + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_model->extension.workstation. get_speed(host->host, 1.0); @@ -146,7 +146,7 @@ double SIMIX_host_get_speed(smx_host_t host) double SIMIX_host_get_available_speed(smx_host_t host) { - xbt_assert0((host != NULL), "Invalid parameters (simix host is NULL)"); + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_model->extension.workstation. get_available_speed(host->host); @@ -154,7 +154,7 @@ double SIMIX_host_get_available_speed(smx_host_t host) int SIMIX_host_get_state(smx_host_t host) { - xbt_assert0((host != NULL), "Invalid parameters (simix host is NULL)"); + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return surf_workstation_model->extension.workstation. get_state(host->host); @@ -172,15 +172,15 @@ void SIMIX_host_self_set_data(void *data) void* SIMIX_host_get_data(smx_host_t host) { - xbt_assert0((host != NULL), "Invalid parameters (simix host is NULL)"); + xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)"); return host->data; } void SIMIX_host_set_data(smx_host_t host, void *data) { - xbt_assert0((host != NULL), "Invalid parameters"); - xbt_assert0((host->data == NULL), "Data already set"); + xbt_assert((host != NULL), "Invalid parameters"); + xbt_assert((host->data == NULL), "Data already set"); host->data = data; } diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 2e81c90d82..eade5755b3 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -812,7 +812,7 @@ SIMIX_comm_set_copy_data_callback(void (*callback) (smx_action_t, size_t)) void SIMIX_comm_copy_pointer_callback(smx_action_t comm, size_t buff_size) { - xbt_assert1((buff_size == sizeof(void *)), + xbt_assert((buff_size == sizeof(void *)), "Cannot copy %zu bytes: must be sizeof(void*)", buff_size); *(void **) (comm->comm.dst_buff) = comm->comm.src_buff; } diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index a9e96fabfc..54e7555c76 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -136,7 +136,7 @@ void SIMIX_process_create(smx_process_t *process, else { *process = xbt_new0(s_smx_process_t, 1); - xbt_assert0(((code != NULL) && (host != NULL)), "Invalid parameters"); + xbt_assert(((code != NULL) && (host != NULL)), "Invalid parameters"); /* Process data */ (*process)->pid = simix_process_maxpid++; @@ -238,7 +238,7 @@ void SIMIX_process_change_host(smx_process_t process, { smx_host_t h1 = NULL; smx_host_t h2 = NULL; - xbt_assert0((process != NULL), "Invalid parameters"); + xbt_assert((process != NULL), "Invalid parameters"); h1 = SIMIX_host_get_by_name(source); h2 = SIMIX_host_get_by_name(dest); process->smx_host = h2; @@ -291,7 +291,7 @@ void SIMIX_process_suspend(smx_process_t process, smx_process_t issuer) void SIMIX_process_resume(smx_process_t process, smx_process_t issuer) { - xbt_assert0((process != NULL), "Invalid parameters"); + xbt_assert((process != NULL), "Invalid parameters"); process->suspended = 0; diff --git a/src/simix/smx_synchro.c b/src/simix/smx_synchro.c index 378e904d8f..aed9f50d2f 100644 --- a/src/simix/smx_synchro.c +++ b/src/simix/smx_synchro.c @@ -350,7 +350,7 @@ void SIMIX_cond_destroy(smx_cond_t cond) XBT_DEBUG("Destroy condition %p", cond); if (cond != NULL) { - xbt_assert0(xbt_swag_size(cond->sleeping) == 0, + xbt_assert(xbt_swag_size(cond->sleeping) == 0, "Cannot destroy conditional since someone is still using it"); xbt_swag_free(cond->sleeping); @@ -376,7 +376,7 @@ void SIMIX_sem_destroy(smx_sem_t sem) { XBT_DEBUG("Destroy semaphore %p", sem); if (sem != NULL) { - xbt_assert0(xbt_swag_size(sem->sleeping) == 0, + xbt_assert(xbt_swag_size(sem->sleeping) == 0, "Cannot destroy semaphore since someone is still using it"); xbt_swag_free(sem->sleeping); xbt_free(sem); diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index f8bac30bb8..9a5cb0babe 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -397,7 +397,7 @@ void SIMIX_req_process_change_host(smx_process_t process, const char *source, co */ void SIMIX_req_process_suspend(smx_process_t process) { - xbt_assert0(process, "Invalid parameters"); + xbt_assert(process, "Invalid parameters"); smx_req_t req = SIMIX_req_mine(); @@ -606,7 +606,7 @@ void SIMIX_req_rdv_destroy(smx_rdv_t rdv) smx_rdv_t SIMIX_req_rdv_get_by_name(const char *name) { - xbt_assert0(name != NULL, "Invalid parameter for SIMIX_req_rdv_get_by_name (name is NULL)"); + xbt_assert(name != NULL, "Invalid parameter for SIMIX_req_rdv_get_by_name (name is NULL)"); /* FIXME: this is a horrible lost of performance, so we hack it out by * skipping the request (for now). It won't work on distributed but @@ -661,7 +661,7 @@ void SIMIX_req_comm_send(smx_rdv_t rdv, double task_size, double rate, int (*match_fun)(void *, void *), void *data, double timeout) { - xbt_assert0(rdv, "No rendez-vous point defined for send"); + xbt_assert(rdv, "No rendez-vous point defined for send"); if (MC_IS_ENABLED) { /* the model-checker wants two separate requests */ @@ -691,7 +691,7 @@ smx_action_t SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size, double rate, int (*match_fun)(void *, void *), void *data, int detached) { - xbt_assert0(rdv, "No rendez-vous point defined for isend"); + xbt_assert(rdv, "No rendez-vous point defined for isend"); smx_req_t req = SIMIX_req_mine(); @@ -712,7 +712,7 @@ smx_action_t SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size, double rate, void SIMIX_req_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, int (*match_fun)(void *, void *), void *data, double timeout) { - xbt_assert0(rdv, "No rendez-vous point defined for recv"); + xbt_assert(rdv, "No rendez-vous point defined for recv"); if (MC_IS_ENABLED) { /* the model-checker wants two separate requests */ @@ -738,7 +738,7 @@ void SIMIX_req_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, smx_action_t SIMIX_req_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, int (*match_fun)(void *, void *), void *data) { - xbt_assert0(rdv, "No rendez-vous point defined for irecv"); + xbt_assert(rdv, "No rendez-vous point defined for irecv"); smx_req_t req = SIMIX_req_mine(); @@ -755,7 +755,7 @@ smx_action_t SIMIX_req_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_bu void SIMIX_req_comm_destroy(smx_action_t comm) { - xbt_assert0(comm, "Invalid parameter"); + xbt_assert(comm, "Invalid parameter"); /* FIXME remove this request type: comms are auto-destroyed now, * but what happens with unfinished comms? */ diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 69a932783a..3d6b456d19 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -24,8 +24,8 @@ static int match_recv(void* a, void* b) { MPI_Request ref = (MPI_Request)a; MPI_Request req = (MPI_Request)b; - xbt_assert0(ref, "Cannot match recv against null reference"); - xbt_assert0(req, "Cannot match recv against null request"); + xbt_assert(ref, "Cannot match recv against null reference"); + xbt_assert(req, "Cannot match recv against null request"); return req->comm == ref->comm && (ref->src == MPI_ANY_SOURCE || req->src == ref->src) && (ref->tag == MPI_ANY_TAG || req->tag == ref->tag); @@ -35,8 +35,8 @@ static int match_send(void* a, void* b) { MPI_Request ref = (MPI_Request)a; MPI_Request req = (MPI_Request)b; - xbt_assert0(ref, "Cannot match send against null reference"); - xbt_assert0(req, "Cannot match send against null request"); + xbt_assert(ref, "Cannot match send against null reference"); + xbt_assert(req, "Cannot match send against null request"); return req->comm == ref->comm && (req->src == MPI_ANY_SOURCE || req->src == ref->src) && (req->tag == MPI_ANY_TAG || req->tag == ref->tag); @@ -89,7 +89,7 @@ void smpi_mpi_start(MPI_Request request) { smx_rdv_t mailbox; - xbt_assert0(!request->action, + xbt_assert(!request->action, "Cannot (re)start a non-finished communication"); if(request->flags & RECV) { print_request("New recv", request); diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index e5e18b1191..8c81580389 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -134,10 +134,10 @@ int smpi_sample_2(int global, const char *file, int line) char *loc = sample_location(global, file, line); local_data_t *data; - xbt_assert0(samples, "You did something very inconsistent, didn't you?"); + xbt_assert(samples, "You did something very inconsistent, didn't you?"); data = xbt_dict_get_or_null(samples, loc); if (!data) { - xbt_assert0(data, "Please, do thing in order"); + xbt_assert(data, "Please, do thing in order"); } if (!data->started) { if ((data->iters > 0 && data->count >= data->iters) @@ -163,7 +163,7 @@ void smpi_sample_3(int global, const char *file, int line) local_data_t *data; double sample, n; - xbt_assert0(samples, "You did something very inconsistent, didn't you?"); + xbt_assert(samples, "You did something very inconsistent, didn't you?"); data = xbt_dict_get_or_null(samples, loc); smpi_bench_end(); if(data && data->started && data->count < data->iters) { diff --git a/src/surf/cpu.c b/src/surf/cpu.c index 2b7f6020e0..0e6fe6517a 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -41,17 +41,17 @@ static cpu_Cas01_t cpu_new(char *name, double power_peak, xbt_dict_t cpu_properties) { cpu_Cas01_t cpu = xbt_new0(s_cpu_Cas01_t, 1); - xbt_assert1(!surf_cpu_resource_by_name(name), + xbt_assert(!surf_cpu_resource_by_name(name), "Host '%s' declared several times in the platform file", name); cpu->generic_resource.model = surf_cpu_model; cpu->generic_resource.name = name; cpu->generic_resource.properties = cpu_properties; cpu->power_peak = power_peak; - xbt_assert0(cpu->power_peak > 0, "Power has to be >0"); + xbt_assert(cpu->power_peak > 0, "Power has to be >0"); cpu->power_scale = power_scale; cpu->core = core; - xbt_assert1(core>0,"Invalid number of cores %d",core); + xbt_assert(core>0,"Invalid number of cores %d",core); if (power_trace) cpu->power_event = tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu); @@ -85,7 +85,7 @@ static void parse_cpu_init(void) power_trace = tmgr_trace_new(A_surfxml_host_availability_file); surf_parse_get_int(&core, A_surfxml_host_core); - xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) || + xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) || (A_surfxml_host_state == A_surfxml_host_state_OFF), "Invalid state"); if (A_surfxml_host_state == A_surfxml_host_state_ON) @@ -116,8 +116,8 @@ static void add_traces_cpu(void) tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name); cpu_Cas01_t host = surf_cpu_resource_by_name(elm); - xbt_assert1(host, "Host %s undefined", elm); - xbt_assert1(trace, "Trace %s undefined", trace_name); + xbt_assert(host, "Host %s undefined", elm); + xbt_assert(trace, "Trace %s undefined", trace_name); host->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); @@ -127,8 +127,8 @@ static void add_traces_cpu(void) tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name); cpu_Cas01_t host = surf_cpu_resource_by_name(elm); - xbt_assert1(host, "Host %s undefined", elm); - xbt_assert1(trace, "Trace %s undefined", trace_name); + xbt_assert(host, "Host %s undefined", elm); + xbt_assert(trace, "Trace %s undefined", trace_name); host->power_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); diff --git a/src/surf/cpu_im.c b/src/surf/cpu_im.c index 448e339039..229c84de9d 100644 --- a/src/surf/cpu_im.c +++ b/src/surf/cpu_im.c @@ -59,20 +59,20 @@ static cpu_Cas01_im_t cpu_im_new(char *name, double power_peak, s_surf_action_cpu_Cas01_im_t action; cpu = xbt_new0(s_cpu_Cas01_im_t, 1); - xbt_assert1(!surf_cpu_resource_by_name(name), + xbt_assert(!surf_cpu_resource_by_name(name), "Host '%s' declared several times in the platform file", name); cpu->generic_resource.model = surf_cpu_model; cpu->generic_resource.name = name; cpu->generic_resource.properties = cpu_properties; cpu->power_peak = power_peak; - xbt_assert0(cpu->power_peak > 0, "Power has to be >0"); + xbt_assert(cpu->power_peak > 0, "Power has to be >0"); cpu->power_scale = power_scale; if (power_trace) cpu->power_event = tmgr_history_add_trace(history, power_trace, 0.0, 0, cpu); cpu->core = core; - xbt_assert1(core>0,"Invalid number of cores %d",core); + xbt_assert(core>0,"Invalid number of cores %d",core); cpu->state_current = state_initial; if (state_trace) @@ -104,7 +104,7 @@ static void parse_cpu_im_init(void) power_trace = tmgr_trace_new(A_surfxml_host_availability_file); surf_parse_get_int(&core, A_surfxml_host_core); - xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) || + xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) || (A_surfxml_host_state == A_surfxml_host_state_OFF), "Invalid state"); if (A_surfxml_host_state == A_surfxml_host_state_ON) @@ -134,8 +134,8 @@ static void cpu_im_add_traces_cpu(void) tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name); cpu_Cas01_im_t host = surf_cpu_resource_by_name(elm); - xbt_assert1(host, "Host %s undefined", elm); - xbt_assert1(trace, "Trace %s undefined", trace_name); + xbt_assert(host, "Host %s undefined", elm); + xbt_assert(trace, "Trace %s undefined", trace_name); host->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); @@ -145,8 +145,8 @@ static void cpu_im_add_traces_cpu(void) tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name); cpu_Cas01_im_t host = surf_cpu_resource_by_name(elm); - xbt_assert1(host, "Host %s undefined", elm); - xbt_assert1(trace, "Trace %s undefined", trace_name); + xbt_assert(host, "Host %s undefined", elm); + xbt_assert(trace, "Trace %s undefined", trace_name); host->power_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); diff --git a/src/surf/cpu_ti.c b/src/surf/cpu_ti.c index dd169796e1..47a3e3e157 100644 --- a/src/surf/cpu_ti.c +++ b/src/surf/cpu_ti.c @@ -156,17 +156,17 @@ static cpu_ti_t cpu_ti_new(char *name, double power_peak, s_tmgr_event_t val; cpu_ti_t cpu = xbt_new0(s_cpu_ti_t, 1); s_surf_action_cpu_ti_t ti_action; - xbt_assert1(!surf_cpu_resource_by_name(name), + xbt_assert(!surf_cpu_resource_by_name(name), "Host '%s' declared several times in the platform file", name); - xbt_assert0(core==1,"Multi-core not handled with this model yet"); + xbt_assert(core==1,"Multi-core not handled with this model yet"); cpu->action_set = xbt_swag_new(xbt_swag_offset(ti_action, cpu_list_hookup)); cpu->generic_resource.model = surf_cpu_model; cpu->generic_resource.name = name; cpu->generic_resource.properties = cpu_properties; cpu->power_peak = power_peak; - xbt_assert0(cpu->power_peak > 0, "Power has to be >0"); + xbt_assert(cpu->power_peak > 0, "Power has to be >0"); XBT_DEBUG("power scale %lf", power_scale); cpu->power_scale = power_scale; cpu->avail_trace = cpu_ti_parse_trace(power_trace, power_scale); @@ -205,7 +205,7 @@ static void parse_cpu_ti_init(void) power_trace = tmgr_trace_new(A_surfxml_host_availability_file); surf_parse_get_int(&core, A_surfxml_host_core); - xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) || + xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) || (A_surfxml_host_state == A_surfxml_host_state_OFF), "Invalid state"); if (A_surfxml_host_state == A_surfxml_host_state_ON) @@ -237,8 +237,8 @@ static void add_traces_cpu_ti(void) tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name); cpu_ti_t cpu = surf_cpu_resource_by_name(elm); - xbt_assert1(cpu, "Host %s undefined", elm); - xbt_assert1(trace, "Trace %s undefined", trace_name); + xbt_assert(cpu, "Host %s undefined", elm); + xbt_assert(trace, "Trace %s undefined", trace_name); if (cpu->state_event) { XBT_DEBUG("Trace already configured for this CPU(%s), ignoring it", @@ -253,8 +253,8 @@ static void add_traces_cpu_ti(void) tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name); cpu_ti_t cpu = surf_cpu_resource_by_name(elm); - xbt_assert1(cpu, "Host %s undefined", elm); - xbt_assert1(trace, "Trace %s undefined", trace_name); + xbt_assert(cpu, "Host %s undefined", elm); + xbt_assert(trace, "Trace %s undefined", trace_name); XBT_DEBUG("Add power trace: %s to CPU(%s)", trace_name, elm); if (cpu->avail_trace) @@ -754,7 +754,7 @@ static void cpu_ti_create_resource(char *name, double power_peak, tmgr_trace_t state_trace, xbt_dict_t cpu_properties) { - xbt_assert0(core==1,"Multi-core not handled with this model yet"); + xbt_assert(core==1,"Multi-core not handled with this model yet"); cpu_ti_new(name, power_peak, power_scale, power_trace, core, state_initial, state_trace, cpu_properties); } diff --git a/src/surf/gtnets/gtnets_interface.cc b/src/surf/gtnets/gtnets_interface.cc index 145476e6c1..d0412eae28 100644 --- a/src/surf/gtnets/gtnets_interface.cc +++ b/src/surf/gtnets/gtnets_interface.cc @@ -24,7 +24,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network_gtnets_interface, surf_network_gtne // initialize the GTNetS interface and environment int gtnets_initialize(int wsize){ XBT_DEBUG("Using logging."); - xbt_assert0(!gtnets_sim, "gtnets already initialized"); + xbt_assert(!gtnets_sim, "gtnets already initialized"); if(wsize > 0){ XBT_INFO("TCP window maximum size : %d", wsize); diff --git a/src/surf/gtnets/gtnets_simulator.cc b/src/surf/gtnets/gtnets_simulator.cc index cbb3434fe6..dc750d3776 100644 --- a/src/surf/gtnets/gtnets_simulator.cc +++ b/src/surf/gtnets/gtnets_simulator.cc @@ -212,14 +212,14 @@ GTSim::~GTSim(){ } int GTSim::add_router(int id){ - xbt_assert1(!(topo_->add_router(id) < 0), "can't add router %d. already exists", id); + xbt_assert(!(topo_->add_router(id) < 0), "can't add router %d. already exists", id); } //bandwidth: in bytes. //latency: in seconds. int GTSim::add_link(int id, double bandwidth, double latency){ double bw = bandwidth * 8; //Bandwidth in bits (used in GTNETS). - xbt_assert1(!(topo_->add_link(id) < 0),"Can't add link %d. already exists", id); + xbt_assert(!(topo_->add_link(id) < 0),"Can't add link %d. already exists", id); XBT_DEBUG("Creating a new P2P, linkid %d, bandwidth %gl, latency %gl", id, bandwidth, latency); gtnets_links_[id] = new Linkp2p(bw, latency); if(jitter_ > 0){ @@ -245,7 +245,7 @@ bool GTSim::link_include(int id){ } int GTSim::add_onehop_route(int src, int dst, int link){ - xbt_assert3(!(topo_->add_onehop_route(src, dst, link) < 0), "Cannot add a route, src: %d, dst: %d, link: %d", src, dst, link); + xbt_assert(!(topo_->add_onehop_route(src, dst, link) < 0), "Cannot add a route, src: %d, dst: %d, link: %d", src, dst, link); return 0; } @@ -309,8 +309,8 @@ int GTSim::add_route(int src, int dst, int* links, int nlink){ int src_node = topo_->nodeid_from_hostid(src); int dst_node = topo_->nodeid_from_hostid(dst); - xbt_assert1(!(gtnets_nodes_.find(src_node) == gtnets_nodes_.end()), "Node %d not found", src_node); - xbt_assert1(!(gtnets_nodes_.find(dst_node) == gtnets_nodes_.end()), "Node %d not found", dst_node); + xbt_assert(!(gtnets_nodes_.find(src_node) == gtnets_nodes_.end()), "Node %d not found", src_node); + xbt_assert(!(gtnets_nodes_.find(dst_node) == gtnets_nodes_.end()), "Node %d not found", dst_node); Node* tmpsrc = gtnets_nodes_[src_node]; Node* tmpdst = gtnets_nodes_[dst_node]; @@ -319,10 +319,10 @@ int GTSim::add_route(int src, int dst, int* links, int nlink){ cur_node = src_node; for (int i = 0; i < nlink; i++){ - xbt_assert1(!(gtnets_nodes_.find(cur_node) == gtnets_nodes_.end()), "Node %d not found", cur_node); + xbt_assert(!(gtnets_nodes_.find(cur_node) == gtnets_nodes_.end()), "Node %d not found", cur_node); next_node = topo_->peer_node_id(links[i], cur_node); - xbt_assert0(!(next_node < 0), "Peer node not found"); - xbt_assert1(!(gtnets_nodes_.find(next_node) == gtnets_nodes_.end()), "Node %d not found", next_node); + xbt_assert(!(next_node < 0), "Peer node not found"); + xbt_assert(!(gtnets_nodes_.find(next_node) == gtnets_nodes_.end()), "Node %d not found", next_node); //add route Node* tmpcur = gtnets_nodes_[cur_node]; @@ -341,7 +341,7 @@ int GTSim::add_route(int src, int dst, int* links, int nlink){ cur_node = next_node; } - xbt_assert2(!(cur_node != dst_node), "Route inconsistency, last: %d, dst: %d",cur_node, dst_node); + xbt_assert(!(cur_node != dst_node), "Route inconsistency, last: %d, dst: %d",cur_node, dst_node); return 0; } @@ -357,10 +357,10 @@ int GTSim::create_flow(int src, int dst, long datasize, void* metadata){ } int src_node = topo_->nodeid_from_hostid(src); - xbt_assert1(!(src_node < 0), "Src %d not found", src_node); + xbt_assert(!(src_node < 0), "Src %d not found", src_node); int dst_node = topo_->nodeid_from_hostid(dst); - xbt_assert1(!(dst_node < 0), "Dst %d not found", dst_node); + xbt_assert(!(dst_node < 0), "Dst %d not found", dst_node); gtnets_servers_[nflow_] = (TCPServer*) gtnets_nodes_[dst_node]-> AddApplication(TCPServer(TCPReno())); @@ -430,7 +430,7 @@ int GTSim::run(double delta){ } void GTSim::set_jitter(double d){ - xbt_assert1(((0 <= d)&&(d <= 1)), "The jitter value must be within interval [0.0;1.0), got %f", d); + xbt_assert(((0 <= d)&&(d <= 1)), "The jitter value must be within interval [0.0;1.0), got %f", d); jitter_ = d; } diff --git a/src/surf/gtnets/gtnets_topology.cc b/src/surf/gtnets/gtnets_topology.cc index 7df843cf4e..7f9913653e 100644 --- a/src/surf/gtnets/gtnets_topology.cc +++ b/src/surf/gtnets/gtnets_topology.cc @@ -38,7 +38,7 @@ GTNETS_Node::~GTNETS_Node(){ // hostid = network_card_id int GTNETS_Node::add_host(int hostid){ - xbt_assert0(!(is_router_), "Cannot add a host to a router node"); + xbt_assert(!(is_router_), "Cannot add a host to a router node"); hosts_.insert(hostid); return 0; } @@ -46,9 +46,9 @@ int GTNETS_Node::add_host(int hostid){ // Add a router. If this node already has a router/host, // return -1. int GTNETS_Node::add_router(int routerid){ - xbt_assert0(!(hosts_.size() > 1), "Router node should have only one router"); + xbt_assert(!(hosts_.size() > 1), "Router node should have only one router"); if (hosts_.size() == 1){ - xbt_assert1((hosts_.find(routerid) != hosts_.end()), "Node %d is a different router", routerid); + xbt_assert((hosts_.find(routerid) != hosts_.end()), "Node %d is a different router", routerid); return 0; } is_router_ = true; @@ -121,7 +121,7 @@ bool GTNETS_Link::route_exists(){ // return the peer node id int GTNETS_Link::peer_node(int cur_id){ - xbt_assert0(((cur_id == src_node_->id())||(cur_id == dst_node_->id())), "Node not found"); + xbt_assert(((cur_id == src_node_->id())||(cur_id == dst_node_->id())), "Node not found"); if (cur_id == src_node_->id()) return dst_node_->id(); else if (cur_id == dst_node_->id()) return src_node_->id(); @@ -168,7 +168,7 @@ int GTNETS_Topology::node_size(){ int GTNETS_Topology::add_link(int id){ map::iterator iter = links_.find(id); - xbt_assert1((iter == links_.end()), "Link %d already exists", id); + xbt_assert((iter == links_.end()), "Link %d already exists", id); if(iter == links_.end()) { GTNETS_Link* link= new GTNETS_Link(id); @@ -196,11 +196,11 @@ bool GTNETS_Topology::is_router(int id){ //return the node id of the peer of cur_id by linkid. int GTNETS_Topology::peer_node_id(int linkid, int cur_id){ GTNETS_Link* link = links_[linkid]; - xbt_assert1((link), "Link %d not found", linkid); - xbt_assert1(!((cur_id < 0) || (cur_id > nodes_.size()-1)), "Node %d not found", cur_id); + xbt_assert((link), "Link %d not found", linkid); + xbt_assert(!((cur_id < 0) || (cur_id > nodes_.size()-1)), "Node %d not found", cur_id); int peer = link->peer_node(nodes_[cur_id]->id()); - xbt_assert0(!(peer < 0), "Peer not found"); + xbt_assert(!(peer < 0), "Peer not found"); return peer; } @@ -210,7 +210,7 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ map::iterator iter = links_.find(linkid); - xbt_assert1(!(iter == links_.end()), "Link %d not found", linkid); + xbt_assert(!(iter == links_.end()), "Link %d not found", linkid); link = iter->second; XBT_DEBUG("Add onehop route, src (#%d), dst (#%d), linkid %d:(#%d)",src, dst, linkid, link->id()); @@ -258,7 +258,7 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ link->add_dst(nodes_[d_node_id]); }else if (!(src_node && dst_node)){ - xbt_assert0((src_node && dst_node), "Either src or dst is null"); + xbt_assert((src_node && dst_node), "Either src or dst is null"); } // case 1: link has two routers @@ -267,14 +267,14 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ int tmpsrc2 = nodeid_from_hostid(src); int tmpdst1 = dst_node->id(); int tmpdst2 = nodeid_from_hostid(dst); - xbt_assert0( (((tmpsrc1 == tmpsrc2) && (tmpdst1 == tmpdst2)) || + xbt_assert( (((tmpsrc1 == tmpsrc2) && (tmpdst1 == tmpdst2)) || ((tmpsrc1 == tmpdst2) && (tmpdst1 == tmpsrc2))), "Different one hop route defined"); } // case 2: link has one router and one host else if (src_node->is_router() && !dst_node->is_router()){ int newsrc, newdst; - xbt_assert0( ((is_router(src))||(is_router(dst))), "One of nodes should be a router"); + xbt_assert( ((is_router(src))||(is_router(dst))), "One of nodes should be a router"); if (is_router(src)){ newsrc = src; @@ -284,10 +284,10 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ newdst = src; } - xbt_assert0(!(src_node->id() != nodeid_from_hostid(newsrc)), "The router should be identical"); + xbt_assert(!(src_node->id() != nodeid_from_hostid(newsrc)), "The router should be identical"); //now, to add dst to dst_node, dst should be a host. - xbt_assert1(!(is_router(newdst)), "Dst %d is not an endpoint. cannot add it to dst_node", newdst); + xbt_assert(!(is_router(newdst)), "Dst %d is not an endpoint. cannot add it to dst_node", newdst); if (!dst_node->include(newdst)){ dst_node->add_host(newdst); @@ -296,7 +296,7 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ } else if (!src_node->is_router() && dst_node->is_router()){ int newsrc, newdst; - xbt_assert0(((is_router(src))||(is_router(dst))), "One of nodes should be a router"); + xbt_assert(((is_router(src))||(is_router(dst))), "One of nodes should be a router"); if (is_router(src)){ newsrc = dst; @@ -306,9 +306,9 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ newdst = dst; } - xbt_assert0(!(dst_node->id() != hosts_[newdst]), "The router should be identical"); + xbt_assert(!(dst_node->id() != hosts_[newdst]), "The router should be identical"); //now, to add dst to src_node, dst should be a host. - xbt_assert1(!(is_router(newsrc)), "Src %d is not an endpoint. cannot add it to src_node", newsrc); + xbt_assert(!(is_router(newsrc)), "Src %d is not an endpoint. cannot add it to src_node", newsrc); if (!src_node->include(newsrc)){ src_node->add_host(newsrc); @@ -318,7 +318,7 @@ int GTNETS_Topology::add_onehop_route(int src, int dst, int linkid){ // case 3: link has two hosts else if (!src_node->is_router() && !dst_node->is_router()){ - xbt_assert0(!(is_router(src) || is_router(dst)), "Cannot add a router to host-host link"); + xbt_assert(!(is_router(src) || is_router(dst)), "Cannot add a router to host-host link"); //if both are hosts, the order doesn't matter. if (src_node->include(src)){ diff --git a/src/surf/lagrange.c b/src/surf/lagrange.c index 62a255a36a..9fc36c9e1e 100644 --- a/src/surf/lagrange.c +++ b/src/surf/lagrange.c @@ -279,7 +279,7 @@ void lagrange_solve(lmm_system_t sys) new_obj = dual_objective(var_list, cnst_list); XBT_DEBUG("Improvement for Objective (%g -> %g) : %g", obj, new_obj, obj - new_obj); - xbt_assert1(obj - new_obj >= -epsilon_min_error, + xbt_assert(obj - new_obj >= -epsilon_min_error, "Our gradient sucks! (%1.20f)", obj - new_obj); obj = new_obj; } @@ -302,7 +302,7 @@ void lagrange_solve(lmm_system_t sys) new_obj = dual_objective(var_list, cnst_list); XBT_DEBUG("Improvement for Objective (%g -> %g) : %g", obj, new_obj, obj - new_obj); - xbt_assert1(obj - new_obj >= -epsilon_min_error, + xbt_assert(obj - new_obj >= -epsilon_min_error, "Our gradient sucks! (%1.20f)", obj - new_obj); obj = new_obj; } @@ -568,19 +568,19 @@ void lmm_set_default_protocol_function(double (*func_f) double func_vegas_f(lmm_variable_t var, double x) { - xbt_assert1(x > 0.0, "Don't call me with stupid values! (%1.20f)", x); + xbt_assert(x > 0.0, "Don't call me with stupid values! (%1.20f)", x); return VEGAS_SCALING * var->weight * log(x); } double func_vegas_fp(lmm_variable_t var, double x) { - xbt_assert1(x > 0.0, "Don't call me with stupid values! (%1.20f)", x); + xbt_assert(x > 0.0, "Don't call me with stupid values! (%1.20f)", x); return VEGAS_SCALING * var->weight / x; } double func_vegas_fpi(lmm_variable_t var, double x) { - xbt_assert1(x > 0.0, "Don't call me with stupid values! (%1.20f)", x); + xbt_assert(x > 0.0, "Don't call me with stupid values! (%1.20f)", x); return var->weight / (x / VEGAS_SCALING); } @@ -592,7 +592,7 @@ double func_vegas_fpi(lmm_variable_t var, double x) #define RENO_SCALING 1.0 double func_reno_f(lmm_variable_t var, double x) { - xbt_assert0(var->weight > 0.0, "Don't call me with stupid values!"); + xbt_assert(var->weight > 0.0, "Don't call me with stupid values!"); return RENO_SCALING * sqrt(3.0 / 2.0) / var->weight * atan(sqrt(3.0 / 2.0) * var->weight * x); @@ -608,15 +608,15 @@ double func_reno_fpi(lmm_variable_t var, double x) { double res_fpi; - xbt_assert0(var->weight > 0.0, "Don't call me with stupid values!"); - xbt_assert0(x > 0.0, "Don't call me with stupid values!"); + xbt_assert(var->weight > 0.0, "Don't call me with stupid values!"); + xbt_assert(x > 0.0, "Don't call me with stupid values!"); res_fpi = 1.0 / (var->weight * var->weight * (x / RENO_SCALING)) - 2.0 / (3.0 * var->weight * var->weight); if (res_fpi <= 0.0) return 0.0; -/* xbt_assert0(res_fpi>0.0,"Don't call me with stupid values!"); */ +/* xbt_assert(res_fpi>0.0,"Don't call me with stupid values!"); */ return sqrt(res_fpi); } @@ -629,7 +629,7 @@ double func_reno_fpi(lmm_variable_t var, double x) #define RENO2_SCALING 1.0 double func_reno2_f(lmm_variable_t var, double x) { - xbt_assert0(var->weight > 0.0, "Don't call me with stupid values!"); + xbt_assert(var->weight > 0.0, "Don't call me with stupid values!"); return RENO2_SCALING * (1.0 / var->weight) * log((x * var->weight) / (2.0 * x * var->weight + 3.0)); @@ -646,7 +646,7 @@ double func_reno2_fpi(lmm_variable_t var, double x) double res_fpi; double tmp; - xbt_assert0(x > 0.0, "Don't call me with stupid values!"); + xbt_assert(x > 0.0, "Don't call me with stupid values!"); tmp = x * var->weight * var->weight; res_fpi = tmp * (9.0 * x + 24.0); diff --git a/src/surf/maxmin.c b/src/surf/maxmin.c index 78e34a1156..2efcd6f2c6 100644 --- a/src/surf/maxmin.c +++ b/src/surf/maxmin.c @@ -115,7 +115,7 @@ static void lmm_var_free(lmm_system_t sys, lmm_variable_t var) static XBT_INLINE void lmm_cnst_free(lmm_system_t sys, lmm_constraint_t cnst) { -/* xbt_assert0(xbt_swag_size(&(cnst->element_set)), */ +/* xbt_assert(xbt_swag_size(&(cnst->element_set)), */ /* "This list should be empty!"); */ remove_active_constraint(sys, cnst); free(cnst); @@ -249,7 +249,7 @@ void lmm_expand(lmm_system_t sys, lmm_constraint_t cnst, sys->modified = 1; - xbt_assert0(var->cnsts_number < var->cnsts_size, "Too much constraints"); + xbt_assert(var->cnsts_number < var->cnsts_size, "Too much constraints"); elem = &(var->cnsts[var->cnsts_number++]); @@ -469,7 +469,7 @@ void lmm_print(lmm_system_t sys) // XBT_DEBUG("%s", trace_buf); fprintf(stderr, "%s\n", trace_buf); trace_buf[0] = '\000'; - xbt_assert3(!double_positive(sum - cnst->bound), + xbt_assert(!double_positive(sum - cnst->bound), "Incorrect value (%f is not smaller than %f): %g", sum, cnst->bound, sum - cnst->bound); } @@ -480,7 +480,7 @@ void lmm_print(lmm_system_t sys) if (var->bound > 0) { XBT_DEBUG("'%d'(%f) : %f (<=%f)", var->id_int, var->weight, var->value, var->bound); - xbt_assert2(!double_positive(var->value - var->bound), + xbt_assert(!double_positive(var->value - var->bound), "Incorrect value (%f is not smaller than %f", var->value, var->bound); } else { diff --git a/src/surf/network.c b/src/surf/network.c index b07cd755e3..7a139323d6 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -173,7 +173,7 @@ static link_CM02_t net_link_new(char *name, state_initial, state_trace, bw_initial, bw_trace); - xbt_assert1(!xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL), + xbt_assert(!xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL), "Link '%s' declared several times in the platform file.", name); @@ -207,7 +207,7 @@ static void net_parse_link_init(void) surf_parse_get_double(&lat_initial, A_surfxml_link_latency); lat_trace = tmgr_trace_new(A_surfxml_link_latency_file); - xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON) + xbt_assert((A_surfxml_link_state == A_surfxml_link_state_ON) || (A_surfxml_link_state == A_surfxml_link_state_OFF), "Invalid state"); if (A_surfxml_link_state == A_surfxml_link_state_ON) @@ -277,9 +277,9 @@ static void net_add_traces(void) link_CM02_t link = xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL); - xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined", + xbt_assert(link, "Cannot connect trace %s to link %s: link undefined", trace_name, elm); - xbt_assert2(trace, + xbt_assert(trace, "Cannot connect trace %s to link %s: trace undefined", trace_name, elm); @@ -292,9 +292,9 @@ static void net_add_traces(void) link_CM02_t link = xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL); - xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined", + xbt_assert(link, "Cannot connect trace %s to link %s: link undefined", trace_name, elm); - xbt_assert2(trace, + xbt_assert(trace, "Cannot connect trace %s to link %s: trace undefined", trace_name, elm); @@ -307,9 +307,9 @@ static void net_add_traces(void) link_CM02_t link = xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL); - xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined", + xbt_assert(link, "Cannot connect trace %s to link %s: link undefined", trace_name, elm); - xbt_assert2(trace, + xbt_assert(trace, "Cannot connect trace %s to link %s: trace undefined", trace_name, elm); @@ -623,7 +623,7 @@ static surf_action_t net_communicate(const char *src_name, /* LARGE PLATFORMS HACK: assert on total_route_size */ latency = global_routing->get_latency(src_name,dst_name); - xbt_assert2(xbt_dynar_length(route) || latency, + xbt_assert(xbt_dynar_length(route) || latency, "You're trying to send data from %s to %s but there is no connection at all between these two hosts.", src_name, dst_name); diff --git a/src/surf/network_gtnets.c b/src/surf/network_gtnets.c index 34eaca4a01..efd9ad8230 100644 --- a/src/surf/network_gtnets.c +++ b/src/surf/network_gtnets.c @@ -223,7 +223,7 @@ static double share_resources(double now) if (!xbt_swag_size(running_actions)) return -1.0; - xbt_assert0(time_to_next_flow_completion, + xbt_assert(time_to_next_flow_completion, "Time to next flow completion not initialized!\n"); XBT_DEBUG("Calling gtnets_get_time_to_next_flow_completion"); @@ -338,7 +338,7 @@ static surf_action_t communicate(const char *src_name, src = *((int *) xbt_dict_get_or_null(global_routing->root->to_index,src_name)); dst = *((int *) xbt_dict_get_or_null(global_routing->root->to_index,dst_name)); - xbt_assert0((src >= 0 + xbt_assert((src >= 0 && dst >= 0), "Either src or dst have invalid id (id<0)"); XBT_DEBUG("Setting flow src %d \"%s\", dst %d \"%s\"", src, src_name, dst, diff --git a/src/surf/network_im.c b/src/surf/network_im.c index 82590fe2a9..3b1e091df1 100644 --- a/src/surf/network_im.c +++ b/src/surf/network_im.c @@ -170,7 +170,7 @@ static link_CM02_im_t im_net_link_new(char *name, state_initial, state_trace, bw_initial, bw_trace); - xbt_assert1(!xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL), + xbt_assert(!xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL), "Link '%s' declared several times in the platform file.", name); @@ -205,7 +205,7 @@ static void im_net_parse_link_init(void) surf_parse_get_double(&lat_initial, A_surfxml_link_latency); lat_trace = tmgr_trace_new(A_surfxml_link_latency_file); - xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON) + xbt_assert((A_surfxml_link_state == A_surfxml_link_state_ON) || (A_surfxml_link_state == A_surfxml_link_state_OFF), "Invalid state"); if (A_surfxml_link_state == A_surfxml_link_state_ON) @@ -275,9 +275,9 @@ static void im_net_add_traces(void) link_CM02_im_t link = xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL); - xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined", + xbt_assert(link, "Cannot connect trace %s to link %s: link undefined", trace_name, elm); - xbt_assert2(trace, + xbt_assert(trace, "Cannot connect trace %s to link %s: trace undefined", trace_name, elm); @@ -290,9 +290,9 @@ static void im_net_add_traces(void) link_CM02_im_t link = xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL); - xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined", + xbt_assert(link, "Cannot connect trace %s to link %s: link undefined", trace_name, elm); - xbt_assert2(trace, + xbt_assert(trace, "Cannot connect trace %s to link %s: trace undefined", trace_name, elm); @@ -305,9 +305,9 @@ static void im_net_add_traces(void) link_CM02_im_t link = xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL); - xbt_assert2(link, "Cannot connect trace %s to link %s: link undefined", + xbt_assert(link, "Cannot connect trace %s to link %s: link undefined", trace_name, elm); - xbt_assert2(trace, + xbt_assert(trace, "Cannot connect trace %s to link %s: trace undefined", trace_name, elm); @@ -669,7 +669,7 @@ static surf_action_t im_net_communicate(const char *src_name, XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate); /* LARGE PLATFORMS HACK: assert on total_route_size */ - xbt_assert2(xbt_dynar_length(route), + xbt_assert(xbt_dynar_length(route), "You're trying to send data from %s to %s but there is no connection between these two hosts.", src_name, dst_name); diff --git a/src/surf/surf.c b/src/surf/surf.c index 4b431467ee..e8d350fba5 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -217,7 +217,7 @@ double generic_maxmin_share_resources(xbt_swag_t running_actions, double value = -1; #define VARIABLE(action) (*((lmm_variable_t*)(((char *) (action)) + (offset)))) - xbt_assert0(solve, "Give me a real solver function!"); + xbt_assert(solve, "Give me a real solver function!"); solve(sys); xbt_swag_foreach(action, running_actions) { diff --git a/src/surf/surf_action.c b/src/surf/surf_action.c index 3b2b0fa2d7..ea4317b26b 100644 --- a/src/surf/surf_action.c +++ b/src/surf/surf_action.c @@ -66,7 +66,7 @@ static void surf_action_mallocator_reset_f(void* action) { void *surf_action_new(size_t size, double cost, surf_model_t model, int failed) { - xbt_assert2(size <= action_mallocator_allocated_size, + xbt_assert(size <= action_mallocator_allocated_size, "Cannot create a surf action of size %zu: the mallocator only provides actions of size %d", size, action_mallocator_allocated_size); diff --git a/src/surf/surf_config.c b/src/surf/surf_config.c index 964d7dd2f5..6e5b341c15 100644 --- a/src/surf/surf_config.c +++ b/src/surf/surf_config.c @@ -80,7 +80,7 @@ static void _surf_cfg_cb__workstation_model(const char *name, int pos) { char *val; - xbt_assert0(_surf_init_status < 2, + xbt_assert(_surf_init_status < 2, "Cannot change the model after the initialization"); val = xbt_cfg_get_string(_surf_cfg_set, name); @@ -99,7 +99,7 @@ static void _surf_cfg_cb__cpu_model(const char *name, int pos) { char *val; - xbt_assert0(_surf_init_status < 2, + xbt_assert(_surf_init_status < 2, "Cannot change the model after the initialization"); val = xbt_cfg_get_string(_surf_cfg_set, name); @@ -118,7 +118,7 @@ static void _surf_cfg_cb__network_model(const char *name, int pos) { char *val; - xbt_assert0(_surf_init_status < 2, + xbt_assert(_surf_init_status < 2, "Cannot change the model after the initialization"); val = xbt_cfg_get_string(_surf_cfg_set, name); @@ -404,7 +404,7 @@ void surf_config_init(int *argc, char **argv) if (!surf_path) { /* retrieves the current directory of the current process */ const char *initial_path = __surf_get_initial_path(); - xbt_assert0((initial_path), + xbt_assert((initial_path), "__surf_get_initial_path() failed! Can't resolves current Windows directory"); surf_path = xbt_dynar_new(sizeof(char *), NULL); @@ -461,10 +461,10 @@ void surf_config_models_setup(const char *platform_file) int network_id = -1; int cpu_id = -1; - xbt_assert0(cpu_model_name, + xbt_assert(cpu_model_name, "Set a cpu model to use with the 'compound' workstation model"); - xbt_assert0(network_model_name, + xbt_assert(network_model_name, "Set a network model to use with the 'compound' workstation model"); network_id = diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 0493a951fd..161f9ca0d2 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -197,7 +197,7 @@ static double vivaldi_get_link_latency (routing_component_t rc,const char *src, euclidean_dist = sqrt (eculidean_dist_comp(0,src_ctn,dst_ctn)+eculidean_dist_comp(1,src_ctn,dst_ctn)) +fabs(atof(xbt_dynar_get_as(src_ctn, 2, char *)))+fabs(atof(xbt_dynar_get_as(dst_ctn, 2, char *))); - xbt_assert2(euclidean_dist>=0, "Euclidean Dist is less than 0\"%s\" and \"%.2f\"", src, euclidean_dist); + xbt_assert(euclidean_dist>=0, "Euclidean Dist is less than 0\"%s\" and \"%.2f\"", src, euclidean_dist); return euclidean_dist; @@ -223,10 +223,10 @@ static void parse_S_host(const char *host_id, const char* coord) network_element_info_t info = NULL; if (current_routing->hierarchy == SURF_ROUTING_NULL) current_routing->hierarchy = SURF_ROUTING_BASE; - xbt_assert1(!xbt_lib_get_or_null(host_lib, host_id,ROUTING_HOST_LEVEL), + xbt_assert(!xbt_lib_get_or_null(host_lib, host_id,ROUTING_HOST_LEVEL), "Reading a host, processing unit \"%s\" already exists", host_id); - xbt_assert1(current_routing->set_processing_unit, + xbt_assert(current_routing->set_processing_unit, "no defined method \"set_processing_unit\" in \"%s\"", current_routing->name); (*(current_routing->set_processing_unit)) (current_routing, host_id); @@ -283,10 +283,10 @@ static void parse_S_router(const char *router_id) if (current_routing->hierarchy == SURF_ROUTING_NULL) current_routing->hierarchy = SURF_ROUTING_BASE; - xbt_assert1(!xbt_lib_get_or_null(as_router_lib,A_surfxml_router_id, ROUTING_ASR_LEVEL), + xbt_assert(!xbt_lib_get_or_null(as_router_lib,A_surfxml_router_id, ROUTING_ASR_LEVEL), "Reading a router, processing unit \"%s\" already exists", router_id); - xbt_assert1(current_routing->set_processing_unit, + xbt_assert(current_routing->set_processing_unit, "no defined method \"set_processing_unit\" in \"%s\"", current_routing->name); (*(current_routing->set_processing_unit)) (current_routing, @@ -330,7 +330,7 @@ static void parse_S_route_new_and_endpoints(const char *src_id, const char *dst_ src_id, dst_id); src = src_id; dst = dst_id; - xbt_assert2(strlen(src) > 0 || strlen(dst) > 0, + xbt_assert(strlen(src) > 0 || strlen(dst) > 0, "Some limits are null in the route between \"%s\" and \"%s\"", src, dst); link_list = xbt_dynar_new(sizeof(char *), &xbt_free_ref); @@ -365,7 +365,7 @@ static void parse_S_ASroute_new_and_endpoints(void) dst = A_surfxml_ASroute_dst; gw_src = A_surfxml_ASroute_gw_src; gw_dst = A_surfxml_ASroute_gw_dst; - xbt_assert2(strlen(src) > 0 || strlen(dst) > 0 || strlen(gw_src) > 0 + xbt_assert(strlen(src) > 0 || strlen(dst) > 0 || strlen(gw_src) > 0 || strlen(gw_dst) > 0, "Some limits are null in the route between \"%s\" and \"%s\"", src, dst); @@ -385,7 +385,7 @@ static void parse_S_bypassRoute_new_and_endpoints(void) dst = A_surfxml_bypassRoute_dst; gw_src = A_surfxml_bypassRoute_gw_src; gw_dst = A_surfxml_bypassRoute_gw_dst; - xbt_assert2(strlen(src) > 0 || strlen(dst) > 0 || strlen(gw_src) > 0 + xbt_assert(strlen(src) > 0 || strlen(dst) > 0 || strlen(gw_src) > 0 || strlen(gw_dst) > 0, "Some limits are null in the route between \"%s\" and \"%s\"", src, dst); @@ -437,7 +437,7 @@ static void parse_E_route_store_route(void) { name_route_extended_t route = xbt_new0(s_name_route_extended_t, 1); route->generic_route.link_list = link_list; - xbt_assert1(current_routing->set_route, + xbt_assert(current_routing->set_route, "no defined method \"set_route\" in \"%s\"", current_routing->name); (*(current_routing->set_route)) (current_routing, src, dst, route); @@ -455,7 +455,7 @@ static void parse_E_ASroute_store_route(void) e_route->generic_route.link_list = link_list; e_route->src_gateway = xbt_strdup(gw_src); e_route->dst_gateway = xbt_strdup(gw_dst); - xbt_assert1(current_routing->set_ASroute, + xbt_assert(current_routing->set_ASroute, "no defined method \"set_ASroute\" in \"%s\"", current_routing->name); (*(current_routing->set_ASroute)) (current_routing, src, dst, e_route); @@ -475,7 +475,7 @@ static void parse_E_bypassRoute_store_route(void) e_route->generic_route.link_list = link_list; e_route->src_gateway = xbt_strdup(gw_src); e_route->dst_gateway = xbt_strdup(gw_dst); - xbt_assert1(current_routing->set_bypassroute, + xbt_assert(current_routing->set_bypassroute, "no defined method \"set_bypassroute\" in \"%s\"", current_routing->name); (*(current_routing->set_bypassroute)) (current_routing, src, dst, @@ -533,7 +533,7 @@ static void parse_S_AS(char *AS_id, char *AS_routing) } else if (current_routing != NULL && global_routing->root != NULL) { - xbt_assert1(!xbt_dict_get_or_null + xbt_assert(!xbt_dict_get_or_null (current_routing->routing_sons, AS_id), "The AS \"%s\" already exists", AS_id); /* it is a part of the tree */ @@ -596,7 +596,7 @@ static void parse_E_AS(const char *AS_id) THROWF(arg_error, 0, "Close AS(%s), that never open", AS_id); } else { network_element_info_t info = NULL; - xbt_assert1(!xbt_lib_get_or_null(as_router_lib,current_routing->name, ROUTING_ASR_LEVEL), + xbt_assert(!xbt_lib_get_or_null(as_router_lib,current_routing->name, ROUTING_ASR_LEVEL), "The AS \"%s\" already exists",current_routing->name); info = xbt_new0(s_network_element_info_t, 1); info->rc_component = current_routing->routing_father; @@ -658,7 +658,7 @@ static char* elements_As_name(const char *name) static xbt_dynar_t elements_father(const char *src, const char *dst) { - xbt_assert0(src && dst, "bad parameters for \"elements_father\" method"); + xbt_assert(src && dst, "bad parameters for \"elements_father\" method"); xbt_dynar_t result = xbt_dynar_new(sizeof(char *), NULL); @@ -679,7 +679,7 @@ static xbt_dynar_t elements_father(const char *src, const char *dst) src_as = ((network_element_info_t)src_data)->rc_component; dst_as = ((network_element_info_t)dst_data)->rc_component; - xbt_assert2(src_as + xbt_assert(src_as && dst_as, "Ask for route \"from\"(%s) or \"to\"(%s) no found", src, dst); @@ -753,7 +753,7 @@ static route_extended_t _get_route(const char *src, const char *dst) XBT_DEBUG("Solve route \"%s\" to \"%s\"", src, dst); - xbt_assert0(src && dst, "bad parameters for \"_get_route\" method"); + xbt_assert(src && dst, "bad parameters for \"_get_route\" method"); route_extended_t e_route, e_route_cnt, e_route_src = NULL, e_route_dst = NULL; @@ -778,7 +778,7 @@ static route_extended_t _get_route(const char *src, const char *dst) if (strcmp(src, dst)) { e_route_cnt = (*(common_father->get_route)) (common_father, src, dst); - xbt_assert2(e_route_cnt, "no route between \"%s\" and \"%s\"", src, + xbt_assert(e_route_cnt, "no route between \"%s\" and \"%s\"", src, dst); xbt_dynar_foreach(e_route_cnt->generic_route.link_list, cpt, link) { xbt_dynar_push(e_route->generic_route.link_list, &link); @@ -801,17 +801,17 @@ static route_extended_t _get_route(const char *src, const char *dst) (*(common_father->get_route)) (common_father, src_father->name, dst_father->name); - xbt_assert2(e_route_cnt, "no route between \"%s\" and \"%s\"", + xbt_assert(e_route_cnt, "no route between \"%s\" and \"%s\"", src_father->name, dst_father->name); - xbt_assert2((e_route_cnt->src_gateway == NULL) == + xbt_assert((e_route_cnt->src_gateway == NULL) == (e_route_cnt->dst_gateway == NULL), "bad gateway for route between \"%s\" and \"%s\"", src, dst); if (strcmp(src, e_route_cnt->src_gateway)) { e_route_src = _get_route(src, e_route_cnt->src_gateway); - xbt_assert2(e_route_src, "no route between \"%s\" and \"%s\"", src, + xbt_assert(e_route_src, "no route between \"%s\" and \"%s\"", src, e_route_cnt->src_gateway); xbt_dynar_foreach(e_route_src->generic_route.link_list, cpt, link) { xbt_dynar_push(e_route->generic_route.link_list, &link); @@ -824,7 +824,7 @@ static route_extended_t _get_route(const char *src, const char *dst) if (strcmp(e_route_cnt->dst_gateway, dst)) { e_route_dst = _get_route(e_route_cnt->dst_gateway, dst); - xbt_assert2(e_route_dst, "no route between \"%s\" and \"%s\"", + xbt_assert(e_route_dst, "no route between \"%s\" and \"%s\"", e_route_cnt->dst_gateway, dst); xbt_dynar_foreach(e_route_dst->generic_route.link_list, cpt, link) { xbt_dynar_push(e_route->generic_route.link_list, &link); @@ -849,7 +849,7 @@ static double _get_latency(const char *src, const char *dst) double latency, latency_src, latency_dst = 0.0; XBT_DEBUG("Solve route \"%s\" to \"%s\"", src, dst); - xbt_assert0(src && dst, "bad parameters for \"_get_route\" method"); + xbt_assert(src && dst, "bad parameters for \"_get_route\" method"); route_extended_t e_route_cnt; @@ -867,7 +867,7 @@ static double _get_latency(const char *src, const char *dst) if (strcmp(src, dst)) { latency = (*(common_father->get_latency)) (common_father, src, dst); - xbt_assert2(latency>=0, "no route between \"%s\" and \"%s\"", src, + xbt_assert(latency>=0, "no route between \"%s\" and \"%s\"", src, dst); } else latency = 0; } else { /* SURF_ROUTING_RECURSIVE */ @@ -876,16 +876,16 @@ static double _get_latency(const char *src, const char *dst) e_route_bypass = (*(common_father->get_bypass_route)) (common_father, src, dst); - xbt_assert0(!e_route_bypass,"Bypass cannot work yet with get_latency"); + xbt_assert(!e_route_bypass,"Bypass cannot work yet with get_latency"); e_route_cnt = (*(common_father->get_route)) (common_father, src_father->name, dst_father->name); - xbt_assert2(e_route_cnt, "no route between \"%s\" and \"%s\"", + xbt_assert(e_route_cnt, "no route between \"%s\" and \"%s\"", src_father->name, dst_father->name); - xbt_assert2((e_route_cnt->src_gateway == NULL) == + xbt_assert((e_route_cnt->src_gateway == NULL) == (e_route_cnt->dst_gateway == NULL), "bad gateway for route between \"%s\" and \"%s\"", src, dst); @@ -893,14 +893,14 @@ static double _get_latency(const char *src, const char *dst) (*(common_father->get_latency)) (common_father, elements_As_name(src), elements_As_name(dst)); - xbt_assert2(latency>=0, "no route between \"%s\" and \"%s\"", + xbt_assert(latency>=0, "no route between \"%s\" and \"%s\"", src_father->name, dst_father->name); if (src != e_route_cnt->src_gateway) { latency_src = _get_latency(src, e_route_cnt->src_gateway); - xbt_assert2(latency_src>=0, "no route between \"%s\" and \"%s\"", src, + xbt_assert(latency_src>=0, "no route between \"%s\" and \"%s\"", src, e_route_cnt->src_gateway); latency += latency_src; } @@ -908,7 +908,7 @@ static double _get_latency(const char *src, const char *dst) if (e_route_cnt->dst_gateway != dst) { latency_dst = _get_latency(e_route_cnt->dst_gateway, dst); - xbt_assert2(latency_dst>=0, "no route between \"%s\" and \"%s\"", + xbt_assert(latency_dst>=0, "no route between \"%s\" and \"%s\"", e_route_cnt->dst_gateway, dst); latency += latency_dst; } @@ -948,7 +948,7 @@ static xbt_dynar_t get_route(const char *src, const char *dst) xbt_dynar_free(&elem_father_list); } - xbt_assert2(e_route, "no route between \"%s\" and \"%s\"", src, dst); + xbt_assert(e_route, "no route between \"%s\" and \"%s\"", src, dst); if (global_routing->last_route) xbt_dynar_free(&(global_routing->last_route)); @@ -1000,7 +1000,7 @@ static double get_latency(const char *src, const char *dst) else latency = (*(common_father->get_latency)) (common_father, src, dst); - xbt_assert2(latency>=0.0, "no route between \"%s\" and \"%s\"", src, dst); + xbt_assert(latency>=0.0, "no route between \"%s\" and \"%s\"", src, dst); xbt_dynar_free(&elem_father_list); return latency; @@ -1027,7 +1027,7 @@ static void _finalize(routing_component_t rc) char *tmp_name = rc->name; xbt_dict_free(&tmp_sons); xbt_free(tmp_name); - xbt_assert1(rc->finalize, "no defined method \"finalize\" in \"%s\"", + xbt_assert(rc->finalize, "no defined method \"finalize\" in \"%s\"", current_routing->name); (*(rc->finalize)) (rc); } @@ -1200,7 +1200,7 @@ static xbt_dynar_t full_get_onelink_routes(routing_component_t rc) xbt_dict_foreach(routing->generic_routing.to_index, c2, k2, d2) { int *src_id = xbt_dict_get_or_null(routing->generic_routing.to_index, k1); int *dst_id = xbt_dict_get_or_null(routing->generic_routing.to_index, k2); - xbt_assert2(src_id + xbt_assert(src_id && dst_id, "Ask for route \"from\"(%s) or \"to\"(%s) no found in the local table", src, dst); @@ -1231,7 +1231,7 @@ static xbt_dynar_t full_get_onelink_routes(routing_component_t rc) static route_extended_t full_get_route(routing_component_t rc, const char *src, const char *dst) { - xbt_assert1(rc && src + xbt_assert(rc && src && dst, "Invalid params for \"get_route\" function at AS \"%s\"", rc->name); @@ -1243,7 +1243,7 @@ static route_extended_t full_get_route(routing_component_t rc, generic_src_dst_check(rc, src, dst); int *src_id = xbt_dict_get_or_null(routing->generic_routing.to_index, src); int *dst_id = xbt_dict_get_or_null(routing->generic_routing.to_index, dst); - xbt_assert2(src_id + xbt_assert(src_id && dst_id, "Ask for route \"from\"(%s) or \"to\"(%s) no found in the local table", src, dst); @@ -1365,10 +1365,10 @@ static void model_full_set_route(routing_component_t rc, const char *src, routing_component_full_t routing = ((routing_component_full_t) rc); size_t table_size = xbt_dict_length(routing->generic_routing.to_index); - xbt_assert2(src_id + xbt_assert(src_id && dst_id, "Network elements %s or %s not found", src, dst); - xbt_assert2(xbt_dynar_length(route->generic_route.link_list) > 0, + xbt_assert(xbt_dynar_length(route->generic_route.link_list) > 0, "Invalid count of links, must be greater than zero (%s,%s)", src, dst); @@ -1383,10 +1383,10 @@ static void model_full_set_route(routing_component_t rc, const char *src, xbt_dynar_foreach(route->generic_route.link_list,i,link_name) { void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL); - xbt_assert1(link,"Link : '%s' doesn't exists.",link_name); + xbt_assert(link,"Link : '%s' doesn't exists.",link_name); xbt_dynar_push(link_route_to_test,&link); } - xbt_assert2(!xbt_dynar_compare( + xbt_assert(!xbt_dynar_compare( (void*)TO_ROUTE_FULL(*src_id, *dst_id)->generic_route.link_list, (void*)link_route_to_test, (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp), @@ -1427,10 +1427,10 @@ static void model_full_set_route(routing_component_t rc, const char *src, { link_name = xbt_dynar_get_as(route->generic_route.link_list,i-1,void *); void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL); - xbt_assert1(link,"Link : '%s' doesn't exists.",link_name); + xbt_assert(link,"Link : '%s' doesn't exists.",link_name); xbt_dynar_push(link_route_to_test,&link); } - xbt_assert2(!xbt_dynar_compare( + xbt_assert(!xbt_dynar_compare( (void*)TO_ROUTE_FULL(*dst_id, *src_id)->generic_route.link_list, (void*)link_route_to_test, (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp), @@ -1508,7 +1508,7 @@ static xbt_dynar_t floyd_get_onelink_routes(routing_component_t rc) static route_extended_t floyd_get_route(routing_component_t rc, const char *src, const char *dst) { - xbt_assert1(rc && src + xbt_assert(rc && src && dst, "Invalid params for \"get_route\" function at AS \"%s\"", rc->name); @@ -1520,7 +1520,7 @@ static route_extended_t floyd_get_route(routing_component_t rc, generic_src_dst_check(rc, src, dst); int *src_id = xbt_dict_get_or_null(routing->generic_routing.to_index, src); int *dst_id = xbt_dict_get_or_null(routing->generic_routing.to_index, dst); - xbt_assert2(src_id + xbt_assert(src_id && dst_id, "Ask for route \"from\"(%s) or \"to\"(%s) no found in the local table", src, dst); @@ -1546,7 +1546,7 @@ static route_extended_t floyd_get_route(routing_component_t rc, pred = TO_FLOYD_PRED(*src_id, pred); if (pred == -1) /* if no pred in route -> no route to host */ break; - xbt_assert2(TO_FLOYD_LINK(pred, prev_pred), + xbt_assert(TO_FLOYD_LINK(pred, prev_pred), "Invalid link for the route between \"%s\" or \"%s\"", src, dst); @@ -1564,7 +1564,7 @@ static route_extended_t floyd_get_route(routing_component_t rc, && strcmp(gw_dst, prev_gw_src)) { xbt_dynar_t e_route_as_to_as = (*(global_routing->get_route)) (gw_dst, prev_gw_src); - xbt_assert2(e_route_as_to_as, "no route between \"%s\" and \"%s\"", + xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"", gw_dst, prev_gw_src); links = e_route_as_to_as; int pos = 0; @@ -1582,7 +1582,7 @@ static route_extended_t floyd_get_route(routing_component_t rc, first = 0; } while (pred != *src_id); - xbt_assert4(pred != -1, "no route from host %d to %d (\"%s\" to \"%s\")", + xbt_assert(pred != -1, "no route from host %d to %d (\"%s\" to \"%s\")", *src_id, *dst_id, src, dst); if (rc->hierarchy == SURF_ROUTING_RECURSIVE) { @@ -1755,10 +1755,10 @@ static void model_floyd_set_route(routing_component_t rc, const char *src, xbt_dynar_foreach(route->generic_route.link_list,cpt,link_name) { void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL); - xbt_assert1(link,"Link : '%s' doesn't exists.",link_name); + xbt_assert(link,"Link : '%s' doesn't exists.",link_name); xbt_dynar_push(link_route_to_test,&link); } - xbt_assert2(!xbt_dynar_compare( + xbt_assert(!xbt_dynar_compare( (void*)TO_FLOYD_LINK(*src_id, *dst_id)->generic_route.link_list, (void*)link_route_to_test, (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp), @@ -1800,10 +1800,10 @@ static void model_floyd_set_route(routing_component_t rc, const char *src, { link_name = xbt_dynar_get_as(route->generic_route.link_list,i-1,void *); void *link = xbt_lib_get_or_null(link_lib, link_name, SURF_LINK_LEVEL); - xbt_assert1(link,"Link : '%s' doesn't exists.",link_name); + xbt_assert(link,"Link : '%s' doesn't exists.",link_name); xbt_dynar_push(link_route_to_test,&link); } - xbt_assert2(!xbt_dynar_compare( + xbt_assert(!xbt_dynar_compare( (void*)TO_FLOYD_LINK(*dst_id, *src_id)->generic_route.link_list, (void*)link_route_to_test, (int_f_cpvoid_cpvoid_t) surf_pointer_resource_cmp), @@ -2014,7 +2014,7 @@ static route_extended_t dijkstra_get_route(routing_component_t rc, const char *src, const char *dst) { - xbt_assert1(rc && src + xbt_assert(rc && src && dst, "Invalid params for \"get_route\" function at AS \"%s\"", rc->name); @@ -2025,7 +2025,7 @@ static route_extended_t dijkstra_get_route(routing_component_t rc, generic_src_dst_check(rc, src, dst); int *src_id = xbt_dict_get_or_null(routing->generic_routing.to_index, src); int *dst_id = xbt_dict_get_or_null(routing->generic_routing.to_index, dst); - xbt_assert2(src_id + xbt_assert(src_id && dst_id, "Ask for route \"from\"(%s) or \"to\"(%s) no found in the local table", src, dst); @@ -2055,7 +2055,7 @@ static route_extended_t dijkstra_get_route(routing_component_t rc, graph_node_map_search(routing, *src_id); graph_node_map_element_t dst_elm = graph_node_map_search(routing, *dst_id); - xbt_assert2(src_elm != NULL + xbt_assert(src_elm != NULL && dst_elm != NULL, "src %d or dst %d does not exist", *src_id, *dst_id); src_node_id = ((graph_node_data_t) @@ -2071,7 +2071,7 @@ static route_extended_t dijkstra_get_route(routing_component_t rc, xbt_edge_t edge = xbt_graph_get_edge(routing->route_graph, node_s_v, node_e_v); - xbt_assert2(edge != NULL, "no route between host %d and %d", *src_id, + xbt_assert(edge != NULL, "no route between host %d and %d", *src_id, *dst_id); e_route = (route_extended_t) xbt_graph_edge_get_data(edge); @@ -2164,7 +2164,7 @@ static route_extended_t dijkstra_get_route(routing_component_t rc, xbt_edge_t edge = xbt_graph_get_edge(routing->route_graph, node_pred_v, node_v); - xbt_assert2(edge != NULL, "no route between host %d and %d", *src_id, + xbt_assert(edge != NULL, "no route between host %d and %d", *src_id, *dst_id); prev_gw_src = gw_src; @@ -2181,7 +2181,7 @@ static route_extended_t dijkstra_get_route(routing_component_t rc, && strcmp(gw_dst, prev_gw_src)) { xbt_dynar_t e_route_as_to_as = (*(global_routing->get_route)) (gw_dst, prev_gw_src); - xbt_assert2(e_route_as_to_as, "no route between \"%s\" and \"%s\"", + xbt_assert(e_route_as_to_as, "no route between \"%s\" and \"%s\"", gw_dst, prev_gw_src); links = e_route_as_to_as; int pos = 0; @@ -2437,11 +2437,11 @@ static void model_rulebased_set_route(routing_component_t rc, const char *error; int erroffset; ruleroute->re_src = pcre_compile(src, 0, &error, &erroffset, NULL); - xbt_assert3(ruleroute->re_src, + xbt_assert(ruleroute->re_src, "PCRE compilation failed at offset %d (\"%s\"): %s\n", erroffset, src, error); ruleroute->re_dst = pcre_compile(dst, 0, &error, &erroffset, NULL); - xbt_assert3(ruleroute->re_src, + xbt_assert(ruleroute->re_src, "PCRE compilation failed at offset %d (\"%s\"): %s\n", erroffset, dst, error); ruleroute->re_str_link = route->generic_route.link_list; @@ -2460,12 +2460,12 @@ static void model_rulebased_set_ASroute(routing_component_t rc, int erroffset; ruleroute_e->generic_rule_route.re_src = pcre_compile(src, 0, &error, &erroffset, NULL); - xbt_assert3(ruleroute_e->generic_rule_route.re_src, + xbt_assert(ruleroute_e->generic_rule_route.re_src, "PCRE compilation failed at offset %d (\"%s\"): %s\n", erroffset, src, error); ruleroute_e->generic_rule_route.re_dst = pcre_compile(dst, 0, &error, &erroffset, NULL); - xbt_assert3(ruleroute_e->generic_rule_route.re_src, + xbt_assert(ruleroute_e->generic_rule_route.re_src, "PCRE compilation failed at offset %d (\"%s\"): %s\n", erroffset, dst, error); ruleroute_e->generic_rule_route.re_str_link = @@ -2510,14 +2510,14 @@ static char *remplace(char *value, const char **src_list, int src_size, && value[i + number_length] <= '9') { number_length++; } - xbt_assert2(number_length != 0, + xbt_assert(number_length != 0, "bad string parameter, no number indication, at offset: %d (\"%s\")", i, value); // solve number number = atoi(value + i); i = i + number_length; - xbt_assert2(i + 2 < value_length, + xbt_assert(i + 2 < value_length, "bad string parameter, too few chars, at offset: %d (\"%s\")", i, value); @@ -2537,7 +2537,7 @@ static char *remplace(char *value, const char **src_list, int src_size, } i = i + 3; - xbt_assert4(param_size >= number, + xbt_assert(param_size >= number, "bad string parameter, not enough length param_size, at offset: %d (\"%s\") %d %d", i, value, param_size, number); @@ -2558,7 +2558,7 @@ static char *remplace(char *value, const char **src_list, int src_size, } while (i < value_length && i_result_buffer < BUFFER_SIZE); - xbt_assert2(i_result_buffer < BUFFER_SIZE, + xbt_assert(i_result_buffer < BUFFER_SIZE, "solving string \"%s\", small buffer size (%d)", value, BUFFER_SIZE); result_result[i_result_buffer] = 0; @@ -2611,7 +2611,7 @@ static route_extended_t rulebased_get_route(routing_component_t rc, const char *src, const char *dst) { - xbt_assert1(rc && src + xbt_assert(rc && src && dst, "Invalid params for \"get_route\" function at AS \"%s\"", rc->name); @@ -2660,9 +2660,9 @@ static route_extended_t rulebased_get_route(routing_component_t rc, ovector_dst, OVECCOUNT); if (rc_dst >= 0) { res = pcre_get_substring_list(src, ovector_src, rc_src, &list_src); - xbt_assert1(!res, "error solving substring list for src \"%s\"", src); + xbt_assert(!res, "error solving substring list for src \"%s\"", src); res = pcre_get_substring_list(dst, ovector_dst, rc_dst, &list_dst); - xbt_assert1(!res, "error solving substring list for src \"%s\"", dst); + xbt_assert(!res, "error solving substring list for src \"%s\"", dst); char *link_name; xbt_dynar_foreach(ruleroute->re_str_link, cpt, link_name) { char *new_link_name = @@ -2938,10 +2938,10 @@ static void generic_set_bypassroute(routing_component_t rc, char *route_name; route_name = bprintf("%s#%s", src, dst); - xbt_assert2(xbt_dynar_length(e_route->generic_route.link_list) > 0, + xbt_assert(xbt_dynar_length(e_route->generic_route.link_list) > 0, "Invalid count of links, must be greater than zero (%s,%s)", src, dst); - xbt_assert4(!xbt_dict_get_or_null(dict_bypassRoutes, route_name), + xbt_assert(!xbt_dict_get_or_null(dict_bypassRoutes, route_name), "The bypass route between \"%s\"(\"%s\") and \"%s\"(\"%s\") already exists", src, e_route->src_gateway, dst, e_route->dst_gateway); @@ -3129,7 +3129,7 @@ generic_new_route(e_surf_routing_hierarchy_t hierarchy, new_route->link_list = xbt_dynar_new(global_routing->size_of_link, NULL); - xbt_assert0(hierarchy == SURF_ROUTING_BASE, + xbt_assert(hierarchy == SURF_ROUTING_BASE, "the hierarchy type is not SURF_ROUTING_BASE"); links = ((route_t) data)->link_list; @@ -3170,7 +3170,7 @@ generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy, new_e_route->src_gateway = NULL; new_e_route->dst_gateway = NULL; - xbt_assert0(hierarchy == SURF_ROUTING_BASE + xbt_assert(hierarchy == SURF_ROUTING_BASE || hierarchy == SURF_ROUTING_RECURSIVE, "the hierarchy type is not defined"); @@ -3182,7 +3182,7 @@ generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy, } else if (hierarchy == SURF_ROUTING_RECURSIVE) { e_route = (route_extended_t) data; - xbt_assert0(e_route->src_gateway + xbt_assert(e_route->src_gateway && e_route->dst_gateway, "bad gateway, is null"); links = e_route->generic_route.link_list; @@ -3986,7 +3986,7 @@ static void routing_parse_Srandom(void) radical_ends = xbt_str_split(groups, "-"); switch (xbt_dynar_length(radical_ends)) { case 1: - xbt_assert1(!xbt_dict_get_or_null(random_value,random_id),"Custom Random '%s' already exists !",random_id); + xbt_assert(!xbt_dict_get_or_null(random_value,random_id),"Custom Random '%s' already exists !",random_id); res = random_generate(random); tmpbuf = bprintf("%s%d",random_id,atoi(xbt_dynar_getfirst_as(radical_ends,char *))); xbt_dict_set(random_value, tmpbuf, bprintf("%f",res), free); @@ -3997,7 +3997,7 @@ static void routing_parse_Srandom(void) xbt_dynar_get_as(radical_ends, 0, char *)); surf_parse_get_int(&end, xbt_dynar_get_as(radical_ends, 1, char *)); for (i = start; i <= end; i++) { - xbt_assert1(!xbt_dict_get_or_null(random_value,random_id),"Custom Random '%s' already exists !",bprintf("%s%d",random_id,i)); + xbt_assert(!xbt_dict_get_or_null(random_value,random_id),"Custom Random '%s' already exists !",bprintf("%s%d",random_id,i)); res = random_generate(random); tmpbuf = bprintf("%s%d",random_id,i); xbt_dict_set(random_value, tmpbuf, bprintf("%f",res), free); diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index a15bd377cf..6b48d7f1c8 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -269,7 +269,7 @@ void STag_surfxml_platform(void) sscanf(A_surfxml_platform_version, "%lg", &version); - xbt_assert0((version >= 1.0), "******* BIG FAT WARNING *********\n " + xbt_assert((version >= 1.0), "******* BIG FAT WARNING *********\n " "You're using an ancient XML file.\n" "Since SimGrid 3.1, units are Bytes, Flops, and seconds " "instead of MBytes, MFlops and seconds.\n" @@ -283,7 +283,7 @@ void STag_surfxml_platform(void) "Last, do not forget to also update your values for " "the calls to MSG_task_create (if any)."); - xbt_assert0((version >= 3.0), "******* BIG FAT WARNING *********\n " + xbt_assert((version >= 3.0), "******* BIG FAT WARNING *********\n " "You're using an old XML file.\n" "Use simgrid_update_xml to update your file automatically. " "This program is installed automatically with SimGrid, or " @@ -347,7 +347,7 @@ void surf_parse_open(const char *file) return; } surf_file_to_parse = surf_fopen(file, "r"); - xbt_assert1((surf_file_to_parse), "Unable to open \"%s\"\n", file); + xbt_assert((surf_file_to_parse), "Unable to open \"%s\"\n", file); surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, 10); surf_parse__switch_to_buffer(surf_input_buffer); surf_parse_lineno = 1; @@ -473,7 +473,7 @@ void parse_platform_file(const char *file) parse_status = surf_parse(); free_data(); surf_parse_close(); - xbt_assert1(!parse_status, "Parse error in %s", file); + xbt_assert(!parse_status, "Parse error in %s", file); } /* Prop tag functions */ @@ -534,7 +534,7 @@ static void parse_Etag_trace(void) static void parse_Stag_trace_connect(void) { - xbt_assert2(xbt_dict_get_or_null + xbt_assert(xbt_dict_get_or_null (traces_set_list, A_surfxml_trace_connect_trace), "Cannot connect trace %s to %s: trace unknown", A_surfxml_trace_connect_trace, @@ -586,7 +586,7 @@ double get_cpu_power(const char *power) memcpy(generator, p + 6, q - (p + 6)); generator[q - (p + 6)] = '\0'; random = xbt_dict_get_or_null(random_data_list, generator); - xbt_assert1(random, "Random generator %s undefined", generator); + xbt_assert(random, "Random generator %s undefined", generator); power_scale = random_generate(random); } } else { diff --git a/src/surf/trace_mgr.c b/src/surf/trace_mgr.c index 23ccb0d6c8..ea18e1a9c4 100644 --- a/src/surf/trace_mgr.c +++ b/src/surf/trace_mgr.c @@ -51,7 +51,7 @@ tmgr_trace_t tmgr_trace_new_from_string(const char *id, const char *input, } } - xbt_assert1(periodicity >= 0, + xbt_assert(periodicity >= 0, "Invalid periodicity %lg (must be positive)", periodicity); trace = xbt_new0(s_tmgr_trace_t, 1); @@ -115,7 +115,7 @@ tmgr_trace_t tmgr_trace_new(const char *filename) } f = surf_fopen(filename, "r"); - xbt_assert2(f != NULL, "Cannot open file '%s' (path=%s)", filename, + xbt_assert(f != NULL, "Cannot open file '%s' (path=%s)", filename, xbt_str_join(surf_path, ":")); tstr = xbt_str_from_file(f); @@ -161,7 +161,7 @@ tmgr_trace_event_t tmgr_history_add_trace(tmgr_history_t h, trace_event->idx = offset; trace_event->model = model; - xbt_assert0((trace_event->idx < xbt_dynar_length(trace->event_list)), + xbt_assert((trace_event->idx < xbt_dynar_length(trace->event_list)), "You're referring to an event that does not exist!"); xbt_heap_push(h->heap, trace_event, start_time); diff --git a/src/surf/workstation.c b/src/surf/workstation.c index 5e494826d7..9aa3304dd8 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -360,8 +360,8 @@ void surf_workstation_model_init_CLM03(const char *filename) void surf_workstation_model_init_compound(const char *filename) { - xbt_assert0(surf_cpu_model, "No CPU model defined yet!"); - xbt_assert0(surf_network_model, "No network model defined yet!"); + xbt_assert(surf_cpu_model, "No CPU model defined yet!"); + xbt_assert(surf_network_model, "No network model defined yet!"); surf_workstation_model_init_internal(); update_model_description(surf_workstation_model_description, diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index 315dc66278..772221a03b 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -622,7 +622,7 @@ static cpu_L07_t ptask_cpu_new(const char *name, double power_scale, xbt_dict_t cpu_properties) { cpu_L07_t cpu = xbt_new0(s_cpu_L07_t, 1); - xbt_assert1(!surf_workstation_resource_by_name(name), + xbt_assert(!surf_workstation_resource_by_name(name), "Host '%s' declared several times in the platform file.", name); @@ -633,7 +633,7 @@ static cpu_L07_t ptask_cpu_new(const char *name, double power_scale, cpu->id = ptask_host_count++; cpu->power_scale = power_scale; - xbt_assert0(cpu->power_scale > 0, "Power has to be >0"); + xbt_assert(cpu->power_scale > 0, "Power has to be >0"); cpu->power_current = power_initial; if (power_trace) @@ -666,7 +666,7 @@ static void ptask_parse_cpu_init(void) surf_parse_get_double(&power_initial, A_surfxml_host_availability); power_trace = tmgr_trace_new(A_surfxml_host_availability_file); - xbt_assert0((A_surfxml_host_state == A_surfxml_host_state_ON) || + xbt_assert((A_surfxml_host_state == A_surfxml_host_state_ON) || (A_surfxml_host_state == A_surfxml_host_state_OFF), "Invalid state"); if (A_surfxml_host_state == A_surfxml_host_state_ON) @@ -704,7 +704,7 @@ static link_L07_t ptask_link_new(char *name, policy, xbt_dict_t properties) { link_L07_t nw_link = xbt_new0(s_link_L07_t, 1); - xbt_assert1(!xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL), + xbt_assert(!xbt_lib_get_or_null(link_lib, name, SURF_LINK_LEVEL), "Link '%s' declared several times in the platform file.", name); @@ -761,7 +761,7 @@ static void ptask_parse_link_init(void) surf_parse_get_double(&lat_initial, A_surfxml_link_latency); lat_trace = tmgr_trace_new(A_surfxml_link_latency_file); - xbt_assert0((A_surfxml_link_state == A_surfxml_link_state_ON) + xbt_assert((A_surfxml_link_state == A_surfxml_link_state_ON) || (A_surfxml_link_state == A_surfxml_link_state_OFF), "Invalid state"); if (A_surfxml_link_state == A_surfxml_link_state_ON) @@ -826,8 +826,8 @@ static void ptask_add_traces(void) tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name); cpu_L07_t host = surf_workstation_resource_by_name(elm); - xbt_assert1(host, "Host %s undefined", elm); - xbt_assert1(trace, "Trace %s undefined", trace_name); + xbt_assert(host, "Host %s undefined", elm); + xbt_assert(trace, "Trace %s undefined", trace_name); host->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); @@ -837,8 +837,8 @@ static void ptask_add_traces(void) tmgr_trace_t trace = xbt_dict_get_or_null(traces_set_list, trace_name); cpu_L07_t host = surf_workstation_resource_by_name(elm); - xbt_assert1(host, "Host %s undefined", elm); - xbt_assert1(trace, "Trace %s undefined", trace_name); + xbt_assert(host, "Host %s undefined", elm); + xbt_assert(trace, "Trace %s undefined", trace_name); host->power_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); @@ -850,8 +850,8 @@ static void ptask_add_traces(void) link_L07_t link = xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL); - xbt_assert1(link, "Link %s undefined", elm); - xbt_assert1(trace, "Trace %s undefined", trace_name); + xbt_assert(link, "Link %s undefined", elm); + xbt_assert(trace, "Trace %s undefined", trace_name); link->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, link); @@ -862,8 +862,8 @@ static void ptask_add_traces(void) link_L07_t link = xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL); - xbt_assert1(link, "Link %s undefined", elm); - xbt_assert1(trace, "Trace %s undefined", trace_name); + xbt_assert(link, "Link %s undefined", elm); + xbt_assert(trace, "Trace %s undefined", trace_name); link->bw_event = tmgr_history_add_trace(history, trace, 0.0, 0, link); } @@ -873,8 +873,8 @@ static void ptask_add_traces(void) link_L07_t link = xbt_lib_get_or_null(link_lib, elm, SURF_LINK_LEVEL); - xbt_assert1(link, "Link %s undefined", elm); - xbt_assert1(trace, "Trace %s undefined", trace_name); + xbt_assert(link, "Link %s undefined", elm); + xbt_assert(trace, "Trace %s undefined", trace_name); link->lat_event = tmgr_history_add_trace(history, trace, 0.0, 0, link); } @@ -965,8 +965,8 @@ static void ptask_model_init_internal(void) void surf_workstation_model_init_ptask_L07(const char *filename) { XBT_INFO("surf_workstation_model_init_ptask_L07"); - xbt_assert0(!surf_cpu_model, "CPU model type already defined"); - xbt_assert0(!surf_network_model, "network model type already defined"); + xbt_assert(!surf_cpu_model, "CPU model type already defined"); + xbt_assert(!surf_network_model, "network model type already defined"); surf_network_model = surf_model_init(); ptask_define_callbacks(filename); ptask_model_init_internal(); diff --git a/src/xbt/backtrace_linux.c b/src/xbt/backtrace_linux.c index 9cfea876db..1892aa1b83 100644 --- a/src/xbt/backtrace_linux.c +++ b/src/xbt/backtrace_linux.c @@ -56,7 +56,7 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) struct stat stat_buf; char *binary_name = NULL; - xbt_assert0(e + xbt_assert(e && e->used, "Backtrace not setup yet, cannot set it up for display"); diff --git a/src/xbt/backtrace_windows.c b/src/xbt/backtrace_windows.c index 90f84abf04..fea72db4a6 100644 --- a/src/xbt/backtrace_windows.c +++ b/src/xbt/backtrace_windows.c @@ -179,7 +179,7 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) int i; char **backtrace_syms; - xbt_assert0(e + xbt_assert(e && e->used, "Backtrace not setup yet, cannot set it up for display"); diff --git a/src/xbt/config.c b/src/xbt/config.c index 4ec5c93461..a5207db770 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -84,7 +84,7 @@ void xbt_cfg_cpy(xbt_cfg_t tocopy, xbt_cfg_t * whereto) XBT_DEBUG("Copy cfg set %p", tocopy); *whereto = NULL; - xbt_assert0(tocopy, "cannot copy NULL config"); + xbt_assert(tocopy, "cannot copy NULL config"); xbt_dict_foreach((xbt_dict_t) tocopy, cursor, name, variable) { xbt_cfg_register(whereto, name, variable->desc, variable->type, NULL, @@ -212,7 +212,7 @@ xbt_cfg_register(xbt_cfg_t * cfg, if (*cfg == NULL) *cfg = xbt_cfg_new(); - xbt_assert4(type >= xbt_cfgelm_int && type <= xbt_cfgelm_peer, + xbt_assert(type >= xbt_cfgelm_int && type <= xbt_cfgelm_peer, "type of %s not valid (%d should be between %d and %d)", name, type, xbt_cfgelm_int, xbt_cfgelm_peer); res = xbt_dict_get_or_null((xbt_dict_t) * cfg, name); @@ -305,24 +305,24 @@ void xbt_cfg_register_str(xbt_cfg_t * cfg, const char *entry) XBT_DEBUG("Register string '%s'", entry); tok = strchr(entrycpy, ':'); - xbt_assert2(tok, "Invalid config element descriptor: %s%s", + xbt_assert(tok, "Invalid config element descriptor: %s%s", entry, "; Should be :_to__"); *(tok++) = '\0'; min = strtol(tok, &tok, 10); - xbt_assert1(tok, "Invalid minimum in config element descriptor %s", + xbt_assert(tok, "Invalid minimum in config element descriptor %s", entry); - xbt_assert2(strcmp(tok, "_to_"), + xbt_assert(strcmp(tok, "_to_"), "Invalid config element descriptor : %s%s", entry, "; Should be :_to__"); tok += strlen("_to_"); max = strtol(tok, &tok, 10); - xbt_assert1(tok, "Invalid maximum in config element descriptor %s", + xbt_assert(tok, "Invalid maximum in config element descriptor %s", entry); - xbt_assert2(*tok == '_', + xbt_assert(*tok == '_', "Invalid config element descriptor: %s%s", entry, "; Should be :_to__"); tok++; @@ -330,7 +330,7 @@ void xbt_cfg_register_str(xbt_cfg_t * cfg, const char *entry) for (type = 0; type < xbt_cfgelm_type_count && strcmp(tok, xbt_cfgelm_type_name[type]); type++); - xbt_assert2(type < xbt_cfgelm_type_count, + xbt_assert(type < xbt_cfgelm_type_count, "Invalid type in config element descriptor: %s%s", entry, "; Should be one of 'string', 'int', 'peer' or 'double'."); @@ -426,7 +426,7 @@ void xbt_cfg_check(xbt_cfg_t cfg) char *name; int size; - xbt_assert0(cfg, "NULL config set."); + xbt_assert(cfg, "NULL config set."); XBT_DEBUG("Check cfg set %p", cfg); xbt_dict_foreach((xbt_dict_t) cfg, cursor, name, variable) { @@ -464,7 +464,7 @@ static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t cfg, "No registered variable '%s' in this config set", name); } - xbt_assert3(type == xbt_cfgelm_any || res->type == type, + xbt_assert(type == xbt_cfgelm_any || res->type == type, "You tried to access to the config element %s as an %s, but its type is %s.", name, xbt_cfgelm_type_name[type], xbt_cfgelm_type_name[res->type]); diff --git a/src/xbt/cunit.c b/src/xbt/cunit.c index ce0551442a..4436ae5649 100644 --- a/src/xbt/cunit.c +++ b/src/xbt/cunit.c @@ -267,7 +267,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite) int suite_len = strlen(suite->title); int i; - xbt_assert2(suite_len < 68, + xbt_assert(suite_len < 68, "suite title \"%s\" too long (%d should be less than 68", suite->title, suite_len); @@ -745,7 +745,7 @@ void _xbt_test_fail(const char *file, int line, const char *fmt, ...) xbt_assert(unit); xbt_assert(fmt); - xbt_assert1(xbt_dynar_length(_xbt_test_current_unit->tests), + xbt_assert(xbt_dynar_length(_xbt_test_current_unit->tests), "Test failed even before being declared (broken unit: %s)", unit->title); @@ -771,7 +771,7 @@ void xbt_test_exception(xbt_ex_t e) void xbt_test_expect_failure(void) { xbt_test_test_t test; - xbt_assert1(xbt_dynar_length(_xbt_test_current_unit->tests), + xbt_assert(xbt_dynar_length(_xbt_test_current_unit->tests), "Cannot expect the failure of a test before declaring it (broken unit: %s)", _xbt_test_current_unit->title); test = @@ -783,7 +783,7 @@ void xbt_test_skip(void) { xbt_test_test_t test; - xbt_assert1(xbt_dynar_length(_xbt_test_current_unit->tests), + xbt_assert(xbt_dynar_length(_xbt_test_current_unit->tests), "Test skiped even before being declared (broken unit: %s)", _xbt_test_current_unit->title); @@ -803,7 +803,7 @@ void _xbt_test_log(const char *file, int line, const char *fmt, ...) xbt_assert(unit); xbt_assert(fmt); - xbt_assert1(xbt_dynar_length(_xbt_test_current_unit->tests), + xbt_assert(xbt_dynar_length(_xbt_test_current_unit->tests), "Test logged into even before being declared (broken test unit: %s)", unit->title); diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 19dd281fb1..82c8a9c15a 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -989,7 +989,7 @@ static void count_check_get_key(xbt_dict_t dict, int length) xbt_dict_foreach(dict, cursor, key, data) { effective++; key2 = xbt_dict_get_key(dict, data); - xbt_assert2(!strcmp(key, key2), + xbt_assert(!strcmp(key, key2), "The data was registered under %s instead of %s as expected", key2, key); } diff --git a/src/xbt/dict_cursor.c b/src/xbt/dict_cursor.c index f21c221e50..44f9f56492 100644 --- a/src/xbt/dict_cursor.c +++ b/src/xbt/dict_cursor.c @@ -62,7 +62,7 @@ XBT_INLINE void xbt_dict_cursor_free(xbt_dict_cursor_t * cursor) */ static XBT_INLINE void __cursor_not_null(xbt_dict_cursor_t cursor) { - xbt_assert0(cursor, "Null cursor"); + xbt_assert(cursor, "Null cursor"); } diff --git a/src/xbt/dict_multi.c b/src/xbt/dict_multi.c index 57d4953030..a11b2c96ce 100644 --- a/src/xbt/dict_multi.c +++ b/src/xbt/dict_multi.c @@ -42,7 +42,7 @@ xbt_multidict_set_ext(xbt_dict_t mdict, int keys_len = xbt_dynar_length(keys); xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens)); - xbt_assert0(keys_len, "Can't set a zero-long key set in a multidict"); + xbt_assert(keys_len, "Can't set a zero-long key set in a multidict"); XBT_DEBUG("xbt_multidict_set(%p,%d)", mdict, keys_len); @@ -124,7 +124,7 @@ void *xbt_multidict_get_ext(xbt_dict_t mdict, int keys_len = xbt_dynar_length(keys); xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens)); - xbt_assert0(xbt_dynar_length(keys) >= 1, + xbt_assert(xbt_dynar_length(keys) >= 1, "Can't get a zero-long key set in a multidict"); XBT_DEBUG("xbt_multidict_get(%p, %ld)", mdict, xbt_dynar_length(keys)); @@ -191,7 +191,7 @@ xbt_multidict_remove_ext(xbt_dict_t mdict, xbt_dynar_t keys, int keys_len = xbt_dynar_length(keys); xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens)); - xbt_assert0(xbt_dynar_length(keys), + xbt_assert(xbt_dynar_length(keys), "Can't remove a zero-long key set in a multidict"); for (i = 0, thislevel = mdict; i < keys_len - 1; diff --git a/src/xbt/dynar.c b/src/xbt/dynar.c index 4b69794ffa..52d11fbada 100644 --- a/src/xbt/dynar.c +++ b/src/xbt/dynar.c @@ -35,12 +35,12 @@ static XBT_INLINE void _dynar_unlock(xbt_dynar_t dynar) static XBT_INLINE void _sanity_check_dynar(xbt_dynar_t dynar) { - xbt_assert0(dynar, "dynar is NULL"); + xbt_assert(dynar, "dynar is NULL"); } static XBT_INLINE void _sanity_check_idx(int idx) { - xbt_assert1(idx >= 0, "dynar idx(=%d) < 0", (int) (idx)); + xbt_assert(idx >= 0, "dynar idx(=%d) < 0", (int) (idx)); } static XBT_INLINE void _check_inbound_idx(xbt_dynar_t dynar, int idx) diff --git a/src/xbt/fifo.c b/src/xbt/fifo.c index c7ca1ab15b..89ab25fa12 100644 --- a/src/xbt/fifo.c +++ b/src/xbt/fifo.c @@ -143,7 +143,7 @@ void *xbt_fifo_shift(xbt_fifo_t l) */ void xbt_fifo_push_item(xbt_fifo_t l, xbt_fifo_item_t new) { - xbt_assert0((new->next == NULL) && (new->prev == NULL), "Invalid item!"); + xbt_assert((new->next == NULL) && (new->prev == NULL), "Invalid item!"); (l->count)++; if (l->head == NULL) { l->head = new; @@ -191,7 +191,7 @@ xbt_fifo_item_t xbt_fifo_pop_item(xbt_fifo_t l) */ void xbt_fifo_unshift_item(xbt_fifo_t l, xbt_fifo_item_t new) { - xbt_assert0((new->next == NULL) && (new->prev == NULL), "Invalid item!"); + xbt_assert((new->next == NULL) && (new->prev == NULL), "Invalid item!"); (l->count)++; if (l->head == NULL) { l->head = new; @@ -293,7 +293,7 @@ int xbt_fifo_remove_all(xbt_fifo_t l, void *t) void xbt_fifo_remove_item(xbt_fifo_t l, xbt_fifo_item_t current) { if (l->head == l->tail) { /* special case */ - xbt_assert0((current == l->head), "This item is not in the list!"); + xbt_assert((current == l->head), "This item is not in the list!"); l->head = NULL; l->tail = NULL; (l->count)--; diff --git a/src/xbt/graph.c b/src/xbt/graph.c index a71e447536..7dc01d15c9 100644 --- a/src/xbt/graph.c +++ b/src/xbt/graph.c @@ -440,7 +440,7 @@ xbt_edge_t *xbt_graph_spanning_tree_prim(xbt_graph_t g) xbt_heap_t heap = xbt_heap_new(10, NULL); unsigned int cursor; - xbt_assert0(!(g->directed), + xbt_assert(!(g->directed), "Spanning trees do not make sense on directed graphs"); xbt_dynar_foreach(g->nodes, cursor, node) { @@ -628,7 +628,7 @@ xbt_graph_t xbt_graph_read(const char *filename, xbt_graph_parse_open(filename); int res; res = (*xbt_graph_parse) (); - xbt_assert1(!res, "Parse error in %s", filename); + xbt_assert(!res, "Parse error in %s", filename); xbt_graph_parse_close(); graph = parsed_graph; @@ -649,7 +649,7 @@ void xbt_graph_export_graphviz(xbt_graph_t g, const char *filename, const char *name = NULL; file = fopen(filename, "w"); - xbt_assert1(file, "Failed to open %s \n", filename); + xbt_assert(file, "Failed to open %s \n", filename); if (g->directed) fprintf(file, "digraph test {\n"); @@ -695,7 +695,7 @@ void xbt_graph_export_graphxml(xbt_graph_t g, const char *filename, const char *name = NULL; file = fopen(filename, "w"); - xbt_assert1(file, "Failed to open %s \n", filename); + xbt_assert(file, "Failed to open %s \n", filename); fprintf(file, "\n"); fprintf(file, "\n"); diff --git a/src/xbt/graphxml_parse.c b/src/xbt/graphxml_parse.c index 5951f2a201..34ada6c954 100644 --- a/src/xbt/graphxml_parse.c +++ b/src/xbt/graphxml_parse.c @@ -94,7 +94,7 @@ void xbt_graph_parse_open(const char *file) xbt_graph_file_to_parse_stack = xbt_dynar_new(sizeof(FILE *), NULL); xbt_graph_file_to_parse = fopen(file, "r"); /* FIXME should use something like surf_fopen */ - xbt_assert1((xbt_graph_file_to_parse), "Unable to open \"%s\"\n", file); + xbt_assert((xbt_graph_file_to_parse), "Unable to open \"%s\"\n", file); xbt_graph_input_buffer = xbt_graph_parse__create_buffer(xbt_graph_file_to_parse, 10); xbt_graph_parse__switch_to_buffer(xbt_graph_input_buffer); @@ -127,6 +127,6 @@ void xbt_graph_parse_get_double(double *value, const char *string) int ret = 0; ret = sscanf(string, "%lg", value); - xbt_assert2((ret == 1), "Parse error line %d : %s not a number", + xbt_assert((ret == 1), "Parse error line %d : %s not a number", xbt_graph_parse_lineno, string); } diff --git a/src/xbt/heap.c b/src/xbt/heap.c index 5468fc3c96..71a87a0a39 100644 --- a/src/xbt/heap.c +++ b/src/xbt/heap.c @@ -171,7 +171,7 @@ void *xbt_heap_remove(xbt_heap_t H, int i) */ XBT_INLINE double xbt_heap_maxkey(xbt_heap_t H) { - xbt_assert0(H->count != 0, "Empty heap"); + xbt_assert(H->count != 0, "Empty heap"); return KEY(H, 0); } @@ -184,7 +184,7 @@ XBT_INLINE double xbt_heap_maxkey(xbt_heap_t H) */ void *xbt_heap_maxcontent(xbt_heap_t H) { - xbt_assert0(H->count != 0, "Empty heap"); + xbt_assert(H->count != 0, "Empty heap"); return CONTENT(H, 0); } diff --git a/src/xbt/log.c b/src/xbt/log.c index 8ce7c5dbdd..f9cd22fc89 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -606,7 +606,7 @@ void _xbt_log_event_log(xbt_log_event_t ev, const char *fmt, ...) while (1) { xbt_log_appender_t appender = cat->appender; if (appender != NULL) { - xbt_assert1(cat->layout, + xbt_assert(cat->layout, "No valid layout for the appender of category %s", cat->name); cat->layout->do_layout(cat->layout, ev, fmt, appender); @@ -738,12 +738,12 @@ int _xbt_log_cat_init(xbt_log_category_t category, if (!xbt_log_settings) return priority >= category->threshold; - xbt_assert0(category, "NULL category"); + xbt_assert(category, "NULL category"); xbt_assert(category->name); xbt_dynar_foreach(xbt_log_settings, cursor, setting) { - xbt_assert0(setting, "Damnit, NULL cat in the list"); - xbt_assert1(setting->catname, "NULL setting(=%p)->catname", + xbt_assert(setting, "Damnit, NULL cat in the list"); + xbt_assert(setting->catname, "NULL setting(=%p)->catname", (void *) setting); if (!strcmp(setting->catname, category->name)) { @@ -769,8 +769,8 @@ int _xbt_log_cat_init(xbt_log_category_t category, void xbt_log_parent_set(xbt_log_category_t cat, xbt_log_category_t parent) { - xbt_assert0(cat, "NULL category to be given a parent"); - xbt_assert1(parent, "The parent category of %s is NULL", cat->name); + xbt_assert(cat, "NULL category to be given a parent"); + xbt_assert(parent, "The parent category of %s is NULL", cat->name); /* * if the threshold is initialized @@ -858,7 +858,7 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string) eq = control_string; control_string += strcspn(control_string, " "); - xbt_assert1(*dot == '.' && (*eq == '=' || *eq == ':'), + xbt_assert(*dot == '.' && (*eq == '=' || *eq == ':'), "Invalid control string '%s'", control_string); if (!strncmp(dot + 1, "thresh", (size_t) (eq - dot - 1))) { diff --git a/src/xbt/mallocator.c b/src/xbt/mallocator.c index 1111a344c1..f1972a00d0 100644 --- a/src/xbt/mallocator.c +++ b/src/xbt/mallocator.c @@ -40,8 +40,8 @@ xbt_mallocator_t xbt_mallocator_new(int size, xbt_mallocator_t m; - xbt_assert0(size > 0, "size must be positive"); - xbt_assert0(new_f != NULL && free_f != NULL + xbt_assert(size > 0, "size must be positive"); + xbt_assert(new_f != NULL && free_f != NULL && reset_f != NULL, "invalid parameter"); /* Let's force 0 size mallocator! (Dirty hack, blame Martin :) ) */ @@ -80,7 +80,7 @@ void xbt_mallocator_free(xbt_mallocator_t m) { int i; - xbt_assert0(m != NULL, "Invalid parameter"); + xbt_assert(m != NULL, "Invalid parameter"); XBT_VERB("Frees mallocator %p (size:%d/%d)", m, m->current_size, m->max_size); diff --git a/src/xbt/set.c b/src/xbt/set.c index daaafc9a17..f0d6b9082d 100644 --- a/src/xbt/set.c +++ b/src/xbt/set.c @@ -264,7 +264,7 @@ void xbt_set_cursor_first(xbt_set_t set, xbt_set_cursor_t * cursor) if (!*cursor) { XBT_DEBUG("Create the cursor on first use"); *cursor = xbt_new(s_xbt_set_cursor_t, 1); - xbt_assert0(*cursor, + xbt_assert(*cursor, "Malloc error during the creation of the cursor"); } (*cursor)->set = set; diff --git a/src/xbt/setset.c b/src/xbt/setset.c index 79d25575e9..056fb82e7a 100644 --- a/src/xbt/setset.c +++ b/src/xbt/setset.c @@ -64,7 +64,7 @@ void xbt_setset_elm_add(xbt_setset_t setset, void *obj) xbt_setset_elm_entry_t new_entry = NULL; xbt_setset_elm_entry_t first_elm = NULL; xbt_setset_elm_t e = (xbt_setset_elm_t) obj; - xbt_assert0(e->ID == 0, "Adding element with non NULL ID"); + xbt_assert(e->ID == 0, "Adding element with non NULL ID"); first_elm = (xbt_setset_elm_entry_t) xbt_dynar_get_ptr(setset->elm_array, 0); diff --git a/src/xbt/swag.c b/src/xbt/swag.c index 441023f604..5a11ab7fc5 100644 --- a/src/xbt/swag.c +++ b/src/xbt/swag.c @@ -71,7 +71,7 @@ XBT_INLINE void xbt_swag_insert(void *obj, xbt_swag_t swag) (swag->count)++; if (swag->head == NULL) { - xbt_assert0(!(swag->tail), "Inconsistent swag."); + xbt_assert(!(swag->tail), "Inconsistent swag."); swag->head = obj; swag->tail = obj; return; @@ -97,7 +97,7 @@ XBT_INLINE void xbt_swag_insert_at_head(void *obj, xbt_swag_t swag) (swag->count)++; if (swag->head == NULL) { - xbt_assert0(!(swag->tail), "Inconsistent swag."); + xbt_assert(!(swag->tail), "Inconsistent swag."); swag->head = obj; swag->tail = obj; return; @@ -123,7 +123,7 @@ XBT_INLINE void xbt_swag_insert_at_tail(void *obj, xbt_swag_t swag) (swag->count)++; if (swag->head == NULL) { - xbt_assert0(!(swag->tail), "Inconsistent swag."); + xbt_assert(!(swag->tail), "Inconsistent swag."); swag->head = obj; swag->tail = obj; return; diff --git a/src/xbt/xbt_log_layout_simple.c b/src/xbt/xbt_log_layout_simple.c index e56adc8e6f..f6a09be31c 100644 --- a/src/xbt/xbt_log_layout_simple.c +++ b/src/xbt/xbt_log_layout_simple.c @@ -71,9 +71,9 @@ static void xbt_log_layout_simple_doit(xbt_log_layout_t l, { char *p; const char *procname = NULL; - xbt_assert0(ev->priority >= 0, + xbt_assert(ev->priority >= 0, "Negative logging priority naturally forbidden"); - xbt_assert1(ev->priority < sizeof(xbt_log_priority_names), + xbt_assert(ev->priority < sizeof(xbt_log_priority_names), "Priority %d is greater than the biggest allowed value", ev->priority); diff --git a/src/xbt/xbt_matrix.c b/src/xbt/xbt_matrix.c index 0a07b4e077..80e60d3ca0 100644 --- a/src/xbt/xbt_matrix.c +++ b/src/xbt/xbt_matrix.c @@ -211,7 +211,7 @@ void xbt_matrix_double_addmult(xbt_matrix_t A, xbt_matrix_t B, { unsigned int i, j, k; - xbt_assert2(A->lines == C->lines, + xbt_assert(A->lines == C->lines, "A->lines != C->lines (%d vs %d)", A->lines, C->lines); xbt_assert(B->rows == C->rows); diff --git a/src/xbt/xbt_peer.c b/src/xbt/xbt_peer.c index a4625888eb..23d7ca4911 100644 --- a/src/xbt/xbt_peer.c +++ b/src/xbt/xbt_peer.c @@ -32,7 +32,7 @@ xbt_peer_t xbt_peer_from_string(const char *peerport) xbt_peer_t res = xbt_new(s_xbt_peer_t, 1); char *name = xbt_strdup(peerport); char *port_str = strchr(name, ':'); - xbt_assert1(port_str, + xbt_assert(port_str, "argument of xbt_peer_from_string should be of form :, it's '%s'", peerport); *port_str = '\0'; diff --git a/src/xbt/xbt_replay_trace_reader.c b/src/xbt/xbt_replay_trace_reader.c index ef70a1c34e..0c02352a0e 100644 --- a/src/xbt/xbt_replay_trace_reader.c +++ b/src/xbt/xbt_replay_trace_reader.c @@ -26,7 +26,7 @@ xbt_replay_trace_reader_t xbt_replay_trace_reader_new(const char *filename) { xbt_replay_trace_reader_t res = xbt_new0(s_xbt_replay_trace_reader_t,1); res->fp = fopen(filename, "r"); - xbt_assert2(res->fp != NULL, "Cannot open %s: %s", filename, + xbt_assert(res->fp != NULL, "Cannot open %s: %s", filename, strerror(errno)); res->filename = xbt_strdup(filename); return res; diff --git a/src/xbt/xbt_sg_synchro.c b/src/xbt/xbt_sg_synchro.c index ec377f65f8..34d22444b0 100644 --- a/src/xbt/xbt_sg_synchro.c +++ b/src/xbt/xbt_sg_synchro.c @@ -90,7 +90,7 @@ const char *xbt_thread_self_name(void) void xbt_thread_join(xbt_thread_t thread) { xbt_mutex_acquire(thread->mutex); - xbt_assert1(thread->joinable, + xbt_assert(thread->joinable, "Cannot join on %p: wasn't created joinable", thread); if (!thread->done) { xbt_cond_wait(thread->cond, thread->mutex); diff --git a/teshsuite/gras/datadesc/datadesc_usage.c b/teshsuite/gras/datadesc/datadesc_usage.c index ef451ab228..10a5e8b1e8 100644 --- a/teshsuite/gras/datadesc/datadesc_usage.c +++ b/teshsuite/gras/datadesc/datadesc_usage.c @@ -72,7 +72,7 @@ static void test_float(gras_socket_t sock, int direction) XBT_INFO("---- Test on float ----"); write_read("float", &i, &j, sock, direction); if (direction == READ || direction == COPY) - xbt_assert2(i == j, "%f != %f", i, j); + xbt_assert(i == j, "%f != %f", i, j); } static void test_double(gras_socket_t sock, int direction) @@ -82,7 +82,7 @@ static void test_double(gras_socket_t sock, int direction) XBT_INFO("---- Test on double ----"); write_read("double", &i, &j, sock, direction); if (direction == READ || direction == COPY) - xbt_assert2(i == j, "%f != %f", i, j); + xbt_assert(i == j, "%f != %f", i, j); } #define FIXED_ARRAY_SIZE 5 @@ -99,7 +99,7 @@ static void test_array(gras_socket_t sock, int direction) if (direction == READ || direction == COPY) { for (cpt = 0; cpt < FIXED_ARRAY_SIZE; cpt++) { XBT_DEBUG("Test spot %d", cpt); - xbt_assert4(i[cpt] == j[cpt], "i[%d]=%d != j[%d]=%d", + xbt_assert(i[cpt] == j[cpt], "i[%d]=%d != j[%d]=%d", cpt, i[cpt], cpt, j[cpt]); } } @@ -164,7 +164,7 @@ static void test_intref(gras_socket_t sock, int direction) write_read("int*", &i, &j, sock, direction); if (direction == READ || direction == COPY) { - xbt_assert2(*i == *j, "*i != *j (%d != %d)", *i, *j); + xbt_assert(*i == *j, "*i != *j (%d != %d)", *i, *j); free(j); } free(i); @@ -182,7 +182,7 @@ static void test_string(gras_socket_t sock, int direction) write_read("string", &i, &j, sock, direction); if (direction == READ || direction == COPY) { for (cpt = 0; cpt < strlen(i); cpt++) { - xbt_assert4(i[cpt] == j[cpt], "i[%d]=%c != j[%d]=%c", + xbt_assert(i[cpt] == j[cpt], "i[%d]=%c != j[%d]=%c", cpt, i[cpt], cpt, j[cpt]); } free(j); @@ -211,7 +211,7 @@ static void test_homostruct(gras_socket_t sock, int direction) write_read("homostruct*", &i, &j, sock, direction); if (direction == READ || direction == COPY) { - xbt_assert2(i->a == j->a, "i->a=%d != j->a=%d", i->a, j->a); + xbt_assert(i->a == j->a, "i->a=%d != j->a=%d", i->a, j->a); xbt_assert(i->b == j->b); xbt_assert(i->c == j->c); xbt_assert(i->d == j->d); @@ -245,7 +245,7 @@ static void test_hetestruct(gras_socket_t sock, int direction) if (direction == READ || direction == COPY) { xbt_assert(i->c1 == j->c1); xbt_assert(i->c2 == j->c2); - xbt_assert2(i->l1 == j->l1, "i->l1(=%ld) != j->l1(=%ld)", i->l1, + xbt_assert(i->l1 == j->l1, "i->l1(=%ld) != j->l1(=%ld)", i->l1, j->l1); xbt_assert(i->l2 == j->l2); free(j); @@ -273,7 +273,7 @@ static void test_hetestruct_array(gras_socket_t sock, int direction) for (cpt = 0, p = i, q = j; cpt < 10; cpt++, p++, q++) { xbt_assert(p->c1 == q->c1); xbt_assert(p->c2 == q->c2); - xbt_assert3(p->l1 == p->l1, + xbt_assert(p->l1 == p->l1, "for cpt=%d i->l1(=%ld) != j->l1(=%ld)", cpt, p->l1, q->l1); xbt_assert(q->l2 == p->l2); @@ -403,7 +403,7 @@ static void test_graph(gras_socket_t sock, int direction) XBT_DEBUG("j->l=%p", j->l); XBT_DEBUG("j->l->l=%p", j->l->l); XBT_DEBUG("j->l->l->l=%p", j->l->l->l); - xbt_assert4(j->l->l->l == j, + xbt_assert(j->l->l->l == j, "Received list is not cyclic. j=%p != j->l->l->l=%p\n" "j=%p; &j=%p", j, j->l->l->l, j, &j); j->l->l->l = NULL; @@ -444,7 +444,7 @@ static void test_dynar_ref(gras_socket_t sock, int direction) for (cpt = 0; cpt < 64; cpt++) { sprintf(buf, "%d", cpt); xbt_dynar_shift(j, &s2); - xbt_assert2(!strcmp(buf, s2), + xbt_assert(!strcmp(buf, s2), "The retrieved value is not the same than the injected one (%s!=%s)", buf, s2); free(s2); @@ -514,7 +514,7 @@ static void test_pbio(gras_socket_t sock, int direction) /* Check that the data match */ xbt_assert(i.Cnstatv == j.Cnstatv); for (cpt = 0; cpt < 12; cpt++) - xbt_assert4(i.Cstatev[cpt] == j.Cstatev[cpt], + xbt_assert(i.Cstatev[cpt] == j.Cstatev[cpt], "i.Cstatev[%d] (=%f) != j.Cstatev[%d] (=%f)", cpt, i.Cstatev[cpt], cpt, j.Cstatev[cpt]); xbt_assert(i.Cnprops == j.Cnprops); @@ -537,7 +537,7 @@ static void test_pbio(gras_socket_t sock, int direction) for (cpt = 0; cpt < 106; cpt++) { xbt_assert(i.Cstress[cpt] == j.Cstress[cpt]); for (cpt2 = 0; cpt2 < 106; cpt2++) - xbt_assert4(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2], + xbt_assert(i.Cddsdde[cpt][cpt2] == j.Cddsdde[cpt][cpt2], "%f=i.Cddsdde[%d][%d] != j.Cddsdde[cpt][cpt2]=%f", i.Cddsdde[cpt][cpt2], cpt, cpt2, j.Cddsdde[cpt][cpt2]); } diff --git a/teshsuite/gras/msg_handle/msg_handle.c b/teshsuite/gras/msg_handle/msg_handle.c index 5c4325a385..dcc37ce412 100644 --- a/teshsuite/gras/msg_handle/msg_handle.c +++ b/teshsuite/gras/msg_handle/msg_handle.c @@ -36,7 +36,7 @@ int server(int argc, char *argv[]) gras_init(&argc, argv); - xbt_assert0(argc == 3, "Usage: server "); + xbt_assert(argc == 3, "Usage: server "); myport = atoi(argv[1]); palstr = argv[2]; @@ -70,9 +70,9 @@ int server(int argc, char *argv[]) RETHROWF("Didn't got the expected timeout: %s"); } } - xbt_assert0(got_expected, + xbt_assert(got_expected, "gras_msg_handle(0) do not lead to any timeout exception"); - xbt_assert1(gras_os_time() - now < 0.01, + xbt_assert(gras_os_time() - now < 0.01, "gras_msg_handle(0) do not anwser immediately (%.4fsec)", gras_os_time() - now); XBT_INFO("gras_msg_handle(0) works as expected (immediate timeout)"); @@ -89,12 +89,12 @@ int server(int argc, char *argv[]) RETHROWF("Didn't got the expected timeout: %s"); } } - xbt_assert0(got_expected, + xbt_assert(got_expected, "gras_msg_handle(1) do not lead to any timeout exception"); - xbt_assert1(gras_os_time() - now < 1.5, + xbt_assert(gras_os_time() - now < 1.5, "gras_msg_handle(1) needs more than 1.5 sec to answer (%.4fsec)", gras_os_time() - now); - xbt_assert1(gras_os_time() - now >= 1.0, + xbt_assert(gras_os_time() - now >= 1.0, "gras_msg_handle(1) answers in less than one second (%.4fsec)", gras_os_time() - now); XBT_INFO("gras_msg_handle(1) works as expected (delayed timeout)"); @@ -122,7 +122,7 @@ int client(int argc, char *argv[]) gras_init(&argc, argv); - xbt_assert0(argc == 3, "Usage: client "); + xbt_assert(argc == 3, "Usage: client "); myport = atoi(argv[1]); palstr = argv[2]; diff --git a/teshsuite/msg/get_sender.c b/teshsuite/msg/get_sender.c index aa61ee09f2..aecfda8418 100644 --- a/teshsuite/msg/get_sender.c +++ b/teshsuite/msg/get_sender.c @@ -26,7 +26,7 @@ static int receive(int argc, char *argv[]) XBT_INFO("Receiving"); m_task_t task = NULL; MSG_task_get_with_timeout(&task, 0, DBL_MAX); - xbt_assert0(MSG_task_get_sender(task), "No sender received"); + xbt_assert(MSG_task_get_sender(task), "No sender received"); XBT_INFO("Got a message sent by '%s'", MSG_process_get_name(MSG_task_get_sender(task))); return 0; diff --git a/teshsuite/simdag/network/p2p/test_latency_bound.c b/teshsuite/simdag/network/p2p/test_latency_bound.c index 866ee27181..8f947bc02d 100644 --- a/teshsuite/simdag/network/p2p/test_latency_bound.c +++ b/teshsuite/simdag/network/p2p/test_latency_bound.c @@ -37,7 +37,7 @@ int main(int argc, char **argv) SD_init(&argc, argv); SD_create_environment(argv[1]); - // xbt_assert0( check max tcp win size, "MAX TCP WIN SIZE is 20000"); + // xbt_assert( check max tcp win size, "MAX TCP WIN SIZE is 20000"); root = SD_task_create("Root", NULL, 1.0); SD_task_schedule(root, 1, SD_workstation_get_list(), no_cost, no_cost, diff --git a/tools/gras/stub_generator.c b/tools/gras/stub_generator.c index 7d4d55729d..6c02c9d0eb 100644 --- a/tools/gras/stub_generator.c +++ b/tools/gras/stub_generator.c @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) } } - xbt_assert1((argc >= 3), + xbt_assert((argc >= 3), "Usage: %s project_name deployment_file [deployment_file...]\n", argv[0]); diff --git a/tools/gras/unix_stub_generator.c b/tools/gras/unix_stub_generator.c index 69d342ded7..fade69be39 100644 --- a/tools/gras/unix_stub_generator.c +++ b/tools/gras/unix_stub_generator.c @@ -122,7 +122,7 @@ void generate_sim(char *project) FICOUT = fopen(filename, "w"); - xbt_assert1(FICOUT, "Unable to open %s for writing", filename); + xbt_assert(FICOUT, "Unable to open %s for writing", filename); fprintf(FICOUT, "%s\n", warning); fprintf(FICOUT, "%s", SIM_PREEMBULE); @@ -185,7 +185,7 @@ void generate_rl(char *project) sprintf(filename, RL_SOURCENAME, project, key); FICOUT = fopen(filename, "w"); - xbt_assert1(FICOUT, "Unable to open %s for writing", filename); + xbt_assert(FICOUT, "Unable to open %s for writing", filename); fprintf(FICOUT, "\n%s\n", warning); fprintf(FICOUT, "/* specific to Borland Compiler */\n" @@ -228,7 +228,7 @@ void generate_makefile_am(char *project, char *deployment) sprintf(filename, MAKEFILE_FILENAME_AM, project); FICOUT = fopen(filename, "w"); - xbt_assert1(FICOUT, "Unable to open %s for writing", filename); + xbt_assert(FICOUT, "Unable to open %s for writing", filename); fprintf(FICOUT, "# AUTOMAKE variable definition\n"); fprintf(FICOUT, "INCLUDES= @CFLAGS_SimGrid@\n\n"); @@ -297,7 +297,7 @@ void generate_makefile_local(char *project, char *deployment) sprintf(filename, MAKEFILE_FILENAME_LOCAL, project); FICOUT = fopen(filename, "w"); - xbt_assert1(FICOUT, "Unable to open %s for writing", filename); + xbt_assert(FICOUT, "Unable to open %s for writing", filename); free(filename); fprintf(FICOUT, diff --git a/tools/tesh/tesh.c b/tools/tesh/tesh.c index e441b89701..cd963991e7 100644 --- a/tools/tesh/tesh.c +++ b/tools/tesh/tesh.c @@ -227,7 +227,7 @@ int main(int argc, char *argv[]) exit(1); } char *eq = strchr(argv[i+1], '='); - xbt_assert1(eq,"The argument of --setenv must contain a '=' (got %s instead)",argv[i+1]); + xbt_assert(eq,"The argument of --setenv must contain a '=' (got %s instead)",argv[i+1]); char *key = bprintf("%.*s", (int) (eq - argv[i+1]), argv[i+1]); xbt_dict_set(env, key, xbt_strdup(eq + 1), xbt_free_f); XBT_INFO("setting environment variable '%s' to '%s'", key, eq+1); -- 2.20.1