From ec16845133f5f1b5262d2d77d8ba22824fa8a446 Mon Sep 17 00:00:00 2001 From: agiersch Date: Thu, 24 Mar 2011 16:49:29 +0000 Subject: [PATCH] Use new macros THROWF and RETHROWF. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9856 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- doc/gtut-files/10-rpc.c | 2 +- examples/amok/saturate/env.c | 2 +- examples/amok/saturate/saturate.c | 2 +- examples/gras/console/ping_client.c | 6 +- examples/gras/console/ping_server.c | 2 +- examples/gras/mmrpc/mmrpc.c | 4 +- examples/gras/mmrpc/mmrpc_client.c | 2 +- examples/gras/mmrpc/mmrpc_server.c | 2 +- .../simple_token/simple_token.c | 4 +- examples/gras/p2p/can/can.c | 14 +- examples/gras/p2p/can/can_tests.c | 12 +- examples/gras/p2p/chord/chord.c | 22 +-- examples/gras/ping/ping_client.c | 6 +- examples/gras/ping/ping_server.c | 2 +- examples/gras/pmm/pmm.c | 6 +- examples/gras/replay/replay.c | 2 +- examples/gras/rpc/rpc.c | 14 +- examples/msg/actions/actions.c | 2 +- include/xbt/asserts.h | 16 +-- include/xbt/ex.h | 2 +- src/amok/Bandwidth/bandwidth.c | 18 +-- src/amok/Bandwidth/saturate.c | 6 +- src/gras/DataDesc/cbps.c | 2 +- src/gras/DataDesc/ddt_create.c | 2 +- src/gras/DataDesc/ddt_exchange.c | 6 +- src/gras/DataDesc/ddt_parse.c | 2 +- src/gras/Msg/gras_msg_exchange.c | 14 +- src/gras/Msg/gras_msg_types.c | 2 +- src/gras/Msg/rl_msg.c | 12 +- src/gras/Msg/timer.c | 8 +- src/gras/Transport/rl_transport.c | 14 +- src/gras/Transport/sg_transport.c | 8 +- src/gras/Transport/transport.c | 10 +- src/gras/Transport/transport_plugin_file.c | 12 +- src/gras/Transport/transport_plugin_sg.c | 16 +-- src/gras/Transport/transport_plugin_tcp.c | 26 ++-- src/gras/Virtu/process.c | 4 +- src/simdag/sd_task.c | 20 +-- src/simix/smx_context.c | 2 +- src/simix/smx_context_sysv.c | 2 +- src/simix/smx_host.c | 6 +- src/simix/smx_network.c | 14 +- src/simix/smx_process.c | 2 +- src/simix/smx_smurf.c | 2 +- src/simix/smx_synchro.c | 4 +- src/surf/random_mgr.c | 8 +- src/surf/surf_routing.c | 24 ++-- src/xbt/backtrace_linux.c | 8 +- src/xbt/config.c | 44 +++--- src/xbt/dict.c | 10 +- src/xbt/dynar.c | 8 +- src/xbt/ex.c | 10 +- src/xbt/graph.c | 2 +- src/xbt/log.c | 6 +- src/xbt/set.c | 14 +- src/xbt/xbt_os_thread.c | 130 +++++++++--------- src/xbt/xbt_queue.c | 10 +- src/xbt/xbt_str.c | 6 +- src/xbt/xbt_strbuff.c | 12 +- teshsuite/gras/msg_handle/msg_handle.c | 14 +- tools/tesh/run_context.c | 6 +- 61 files changed, 325 insertions(+), 325 deletions(-) diff --git a/doc/gtut-files/10-rpc.c b/doc/gtut-files/10-rpc.c index f00a06fc3b..a428e8d7de 100644 --- a/doc/gtut-files/10-rpc.c +++ b/doc/gtut-files/10-rpc.c @@ -57,7 +57,7 @@ int server_convert_a2i_cb(gras_msg_cb_ctx_t ctx, void *payload) result = strtol(string, &p, 10); if (*p != '\0') - THROW2(arg_error, 0, + THROWF(arg_error, 0, "Error while converting %s: this does not seem to be a valid number (problem at '%s')", string, p); diff --git a/examples/amok/saturate/env.c b/examples/amok/saturate/env.c index 02cd27a914..5ad45e392c 100644 --- a/examples/amok/saturate/env.c +++ b/examples/amok/saturate/env.c @@ -108,7 +108,7 @@ static void env_Pairwisehost_bw(int argc, char *argv[]) msg_size, 120); // sturation of the link with msg_size to compute a concurent bandwidth MA //MB } CATCH(e) { - RETHROW0("Cannot ask hosts to saturate the link: %s"); + RETHROWF("Cannot ask hosts to saturate the link: %s"); } // gras_os_sleep(1.0); diff --git a/examples/amok/saturate/saturate.c b/examples/amok/saturate/saturate.c index 6bb54ae6ab..8c033b1469 100644 --- a/examples/amok/saturate/saturate.c +++ b/examples/amok/saturate/saturate.c @@ -221,7 +221,7 @@ static void full_fledged_saturation(int argc, char *argv[]) 0 /* no timeout */ ); } CATCH(e) { - RETHROW0("Cannot ask peers to saturate the link: %s"); + RETHROWF("Cannot ask peers to saturate the link: %s"); } gras_os_sleep(5); diff --git a/examples/gras/console/ping_client.c b/examples/gras/console/ping_client.c index da1abfd937..8489cc39b0 100644 --- a/examples/gras/console/ping_client.c +++ b/examples/gras/console/ping_client.c @@ -41,7 +41,7 @@ int client(int argc, char *argv[]) CATCH(e) { if (e.category != system_error) /* dunno what happened, let the exception go through */ - RETHROW0("Unable to connect to the server: %s"); + RETHROWF("Unable to connect to the server: %s"); xbt_ex_free(e); gras_os_sleep(0.05); } @@ -64,7 +64,7 @@ int client(int argc, char *argv[]) } CATCH(e) { gras_socket_close(toserver); - RETHROW0("Failed to send PING to server: %s"); + RETHROWF("Failed to send PING to server: %s"); } XBT_INFO(">>>>>>>> Message PING(%d) sent to %s:%d <<<<<<<<", ping, @@ -76,7 +76,7 @@ int client(int argc, char *argv[]) } CATCH(e) { gras_socket_close(toserver); - RETHROW0("Why can't I get my PONG message like everyone else: %s"); + RETHROWF("Why can't I get my PONG message like everyone else: %s"); } /* 8. Keep the user informed of what's going on, again */ diff --git a/examples/gras/console/ping_server.c b/examples/gras/console/ping_server.c index 64819dfac6..8b52d85a4a 100644 --- a/examples/gras/console/ping_server.c +++ b/examples/gras/console/ping_server.c @@ -45,7 +45,7 @@ static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload) /* 6. Deal with errors: add some details to the exception */ } CATCH(e) { gras_socket_close(globals->sock); - RETHROW0("Unable answer with PONG: %s"); + RETHROWF("Unable answer with PONG: %s"); } XBT_INFO(">>>>>>>> Answered with PONG(4321) <<<<<<<<"); diff --git a/examples/gras/mmrpc/mmrpc.c b/examples/gras/mmrpc/mmrpc.c index c64f3239c9..4ee656766c 100644 --- a/examples/gras/mmrpc/mmrpc.c +++ b/examples/gras/mmrpc/mmrpc.c @@ -73,7 +73,7 @@ int server(int argc, char *argv[]) sock = gras_socket_server(port); } CATCH(e) { - RETHROW0("Unable to establish a server socket: %s"); + RETHROWF("Unable to establish a server socket: %s"); } /* 4. Register the known messages and payloads. */ @@ -126,7 +126,7 @@ int client(int argc, char *argv[]) toserver = gras_socket_client(host, port); } CATCH(e) { - RETHROW0("Unable to connect to the server: %s"); + RETHROWF("Unable to connect to the server: %s"); } XBT_INFO("Connected to %s:%d.", host, port); diff --git a/examples/gras/mmrpc/mmrpc_client.c b/examples/gras/mmrpc/mmrpc_client.c index 171369d0b6..e139989dd5 100644 --- a/examples/gras/mmrpc/mmrpc_client.c +++ b/examples/gras/mmrpc/mmrpc_client.c @@ -45,7 +45,7 @@ int client(int argc, char *argv[]) } CATCH(e) { if (e.category != system_error) - RETHROW0("Unable to connect to the server: %s"); + RETHROWF("Unable to connect to the server: %s"); xbt_ex_free(e); gras_os_sleep(0.05); } diff --git a/examples/gras/mmrpc/mmrpc_server.c b/examples/gras/mmrpc/mmrpc_server.c index 5072264b28..a675d3e1cd 100644 --- a/examples/gras/mmrpc/mmrpc_server.c +++ b/examples/gras/mmrpc/mmrpc_server.c @@ -58,7 +58,7 @@ int server(int argc, char *argv[]) sock = gras_socket_server(port); } CATCH(e) { - RETHROW0("Unable to establish a server socket: %s"); + RETHROWF("Unable to establish a server socket: %s"); } /* 4. Register the known messages and payloads. */ diff --git a/examples/gras/mutual_exclusion/simple_token/simple_token.c b/examples/gras/mutual_exclusion/simple_token/simple_token.c index 686d7ec4d9..65a7d2d05e 100644 --- a/examples/gras/mutual_exclusion/simple_token/simple_token.c +++ b/examples/gras/mutual_exclusion/simple_token/simple_token.c @@ -79,7 +79,7 @@ static int node_cb_stoken_handler(gras_msg_cb_ctx_t ctx, void *payload) } CATCH(e) { gras_socket_close(globals->sock); - RETHROW0("Unable to forward token: %s"); + RETHROWF("Unable to forward token: %s"); } } @@ -171,7 +171,7 @@ int node(int argc, char *argv[]) TRY { gras_msg_send(globals->tosuccessor, "stoken", &token); } CATCH(e) { - RETHROW0("Unable to send the freshly created token: %s"); + RETHROWF("Unable to send the freshly created token: %s"); } } diff --git a/examples/gras/p2p/can/can.c b/examples/gras/p2p/can/can.c index 4fafde01b3..cde05ab27f 100644 --- a/examples/gras/p2p/can/can.c +++ b/examples/gras/p2p/can/can.c @@ -58,12 +58,12 @@ static void forward_get_suc(get_suc_t msg, char host[1024], int port) TRY { temp_sock = gras_socket_client(host, port); } CATCH(e) { - RETHROW0("Unable to connect!: %s"); + RETHROWF("Unable to connect!: %s"); } TRY { gras_msg_send(temp_sock, "can_get_suc", &msg); } CATCH(e) { - RETHROW0("Unable to send!: %s"); + RETHROWF("Unable to send!: %s"); } XBT_INFO("Forwarding a get_successor message to %s for (%d;%d)", host, msg.xId, msg.yId); @@ -180,7 +180,7 @@ static int node_get_suc_handler(gras_msg_cb_ctx_t ctx, void *payload_data) temp_sock = gras_socket_client(incoming->host, incoming->port); } CATCH(e) { - RETHROW0 + RETHROWF ("Unable to connect to the node wich has requested for an area!: %s"); } TRY { @@ -188,7 +188,7 @@ static int node_get_suc_handler(gras_msg_cb_ctx_t ctx, void *payload_data) XBT_INFO("Environment informations sent!"); } CATCH(e) { - RETHROW2("%s:Timeout sending environment informations to %s: %s", + RETHROWF("%s:Timeout sending environment informations to %s: %s", globals->host, gras_socket_peer_name(expeditor)); } gras_socket_close(temp_sock); @@ -252,7 +252,7 @@ int node(int argc, char **argv) temp_sock = gras_socket_client(argv[4], atoi(argv[5])); } CATCH(e) { - RETHROW0("Unable to connect known host to request for an area!: %s"); + RETHROWF("Unable to connect known host to request for an area!: %s"); } @@ -265,7 +265,7 @@ int node(int argc, char **argv) } CATCH(e) { gras_socket_close(temp_sock); - RETHROW0("Unable to contact known host to get an area!: %s"); + RETHROWF("Unable to contact known host to get an area!: %s"); } gras_socket_close(temp_sock); @@ -276,7 +276,7 @@ int node(int argc, char **argv) gras_msg_wait(6000, "can_rep_suc", &temp_sock2, &rep_suc_msg); } CATCH(e) { - RETHROW1("%s: Error waiting for an area:%s", globals->host); + RETHROWF("%s: Error waiting for an area:%s", globals->host); } // retreiving the data of the response. diff --git a/examples/gras/p2p/can/can_tests.c b/examples/gras/p2p/can/can_tests.c index 69976228fa..947be6edc3 100644 --- a/examples/gras/p2p/can/can_tests.c +++ b/examples/gras/p2p/can/can_tests.c @@ -36,7 +36,7 @@ int start_war(int argc, char **argv) TRY { // contacting the bad guy that will launch the War. temp_sock = gras_socket_client(gras_os_myname(), atoi(argv[1])); } CATCH(e) { - RETHROW0("Unable to connect known host so as to declare WAR!: %s"); + RETHROWF("Unable to connect known host so as to declare WAR!: %s"); } @@ -50,7 +50,7 @@ int start_war(int argc, char **argv) gras_msg_send(temp_sock, "can_nuke", &nuke_msg); } CATCH(e) { gras_socket_close(temp_sock); - RETHROW0 + RETHROWF ("Unable to contact known host so as to declare WAR!!!!!!!!!!!!!!!!!!!!!: %s"); } gras_socket_close(temp_sock); // spare. @@ -96,14 +96,14 @@ static int send_nuke(nuke_t * msg, int xId, int yId) temp_sock = gras_socket_client(host, port); } CATCH(e) { - RETHROW0("Unable to connect the nuke!: %s"); + RETHROWF("Unable to connect the nuke!: %s"); } //XBT_INFO("%s ON %s %d %d <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<",globals->host,host,xId,yId); TRY { gras_msg_send(temp_sock, "can_nuke", msg); } CATCH(e) { - RETHROW0("Unable to send the nuke!: %s"); + RETHROWF("Unable to send the nuke!: %s"); } gras_socket_close(temp_sock); XBT_INFO("Nuke launched by %s to %s for (%d;%d)", globals->host, host, @@ -191,13 +191,13 @@ static int node_nuke_handler(gras_msg_cb_ctx_t ctx, void *payload_data) temp_sock = gras_socket_client(host, port); } CATCH(e) { - RETHROW0("Unable to connect the nuke!: %s"); + RETHROWF("Unable to connect the nuke!: %s"); } TRY { gras_msg_send(temp_sock, "can_nuke", incoming); } CATCH(e) { - RETHROW0("Unable to send the nuke!: %s"); + RETHROWF("Unable to send the nuke!: %s"); } XBT_INFO("Nuke re-aimed by %s to %s for (%d;%d)", globals->host, host, incoming->xId, incoming->yId); diff --git a/examples/gras/p2p/chord/chord.c b/examples/gras/p2p/chord/chord.c index 6538b1d69c..cf3d2c02cc 100644 --- a/examples/gras/p2p/chord/chord.c +++ b/examples/gras/p2p/chord/chord.c @@ -142,13 +142,13 @@ static int node_cb_get_suc_handler(gras_msg_cb_ctx_t ctx, globals->finger[contact].port); } CATCH(e) { - RETHROW0("Unable to connect!: %s"); + RETHROWF("Unable to connect!: %s"); } TRY { gras_msg_send(temp_sock, "chord_get_suc", &asking); } CATCH(e) { - RETHROW0("Unable to ask!: %s"); + RETHROWF("Unable to ask!: %s"); } gras_msg_wait(10., "chord_rep_suc", &temp_sock, &outgoing); } @@ -159,7 +159,7 @@ static int node_cb_get_suc_handler(gras_msg_cb_ctx_t ctx, XBT_INFO("Successor information sent!"); } CATCH(e) { - RETHROW2("%s:Timeout sending successor information to %s: %s", + RETHROWF("%s:Timeout sending successor information to %s: %s", globals->host, gras_socket_peer_name(expeditor)); } gras_socket_close(expeditor); @@ -210,7 +210,7 @@ static void fix_fingers() TRY { temp_sock = gras_socket_client(globals->host, globals->port); } CATCH(e) { - RETHROW0("Unable to contact known host: %s"); + RETHROWF("Unable to contact known host: %s"); } get_suc_msg.id = globals->id; @@ -218,14 +218,14 @@ static void fix_fingers() gras_msg_send(temp_sock, "chord_get_suc", &get_suc_msg); } CATCH(e) { gras_socket_close(temp_sock); - RETHROW0("Unable to contact known host to get successor!: %s"); + RETHROWF("Unable to contact known host to get successor!: %s"); } TRY { XBT_INFO("Waiting for reply!"); gras_msg_wait(6000, "chord_rep_suc", &temp_sock2, &rep_suc_msg); } CATCH(e) { - RETHROW1("%s: Error waiting for successor:%s", globals->host); + RETHROWF("%s: Error waiting for successor:%s", globals->host); } globals->finger[0].id = rep_suc_msg.id; snprintf(globals->finger[0].host, 1024, rep_suc_msg.host); @@ -335,7 +335,7 @@ int node(int argc, char **argv) temp_sock = gras_socket_client(other_host, other_port); } CATCH(e) { - RETHROW0("Unable to contact known host: %s"); + RETHROWF("Unable to contact known host: %s"); } get_suc_msg.id = globals->id; @@ -344,7 +344,7 @@ int node(int argc, char **argv) } CATCH(e) { gras_socket_close(temp_sock); - RETHROW0("Unable to contact known host to get successor!: %s"); + RETHROWF("Unable to contact known host to get successor!: %s"); } TRY { @@ -352,7 +352,7 @@ int node(int argc, char **argv) gras_msg_wait(10., "chord_rep_suc", &temp_sock2, &rep_suc_msg); } CATCH(e) { - RETHROW1("%s: Error waiting for successor:%s", globals->host); + RETHROWF("%s: Error waiting for successor:%s", globals->host); } globals->finger[0].id = rep_suc_msg.id; snprintf(globals->finger[0].host, 1024, rep_suc_msg.host); @@ -365,7 +365,7 @@ int node(int argc, char **argv) globals->finger[0].port); } CATCH(e) { - RETHROW0("Unable to contact successor: %s"); + RETHROWF("Unable to contact successor: %s"); } notify_msg.id = globals->id; @@ -375,7 +375,7 @@ int node(int argc, char **argv) gras_msg_send(temp_sock, "chord_notify", ¬ify_msg); } CATCH(e) { - RETHROW0("Unable to notify successor! %s"); + RETHROWF("Unable to notify successor! %s"); } } diff --git a/examples/gras/ping/ping_client.c b/examples/gras/ping/ping_client.c index 1c34881060..1b74e7035c 100644 --- a/examples/gras/ping/ping_client.c +++ b/examples/gras/ping/ping_client.c @@ -41,7 +41,7 @@ int client(int argc, char *argv[]) CATCH(e) { if (e.category != system_error) /* dunno what happened, let the exception go through */ - RETHROW0("Unable to connect to the server: %s"); + RETHROWF("Unable to connect to the server: %s"); xbt_ex_free(e); gras_os_sleep(0.05); } @@ -64,7 +64,7 @@ int client(int argc, char *argv[]) } CATCH(e) { gras_socket_close(toserver); - RETHROW0("Failed to send PING to server: %s"); + RETHROWF("Failed to send PING to server: %s"); } XBT_INFO(">>>>>>>> Message PING(%d) sent to %s:%d <<<<<<<<", ping, gras_socket_peer_name(toserver), gras_socket_peer_port(toserver)); @@ -75,7 +75,7 @@ int client(int argc, char *argv[]) } CATCH(e) { gras_socket_close(toserver); - RETHROW0("Why can't I get my PONG message like everyone else: %s"); + RETHROWF("Why can't I get my PONG message like everyone else: %s"); } /* 8. Keep the user informed of what's going on, again */ diff --git a/examples/gras/ping/ping_server.c b/examples/gras/ping/ping_server.c index d70e875711..885b4e5f21 100644 --- a/examples/gras/ping/ping_server.c +++ b/examples/gras/ping/ping_server.c @@ -45,7 +45,7 @@ static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload) /* 6. Deal with errors: add some details to the exception */ } CATCH(e) { gras_socket_close(globals->sock); - RETHROW0("Unable answer with PONG: %s"); + RETHROWF("Unable answer with PONG: %s"); } XBT_INFO(">>>>>>>> Answered with PONG(4321) <<<<<<<<"); diff --git a/examples/gras/pmm/pmm.c b/examples/gras/pmm/pmm.c index bb48e39a8d..c2f570664b 100644 --- a/examples/gras/pmm/pmm.c +++ b/examples/gras/pmm/pmm.c @@ -312,7 +312,7 @@ static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload) gras_msg_wait(600, "dataB", &from, &bB); } CATCH(e) { - RETHROW0("Can't get a data message from line : %s"); + RETHROWF("Can't get a data message from line : %s"); } XBT_VERB("LINE: step(%d) <> Myline(%d). Receive data from %s", step, myline, gras_socket_peer_name(from)); @@ -335,7 +335,7 @@ static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload) gras_msg_wait(1200, "dataA", &from, &bA); } CATCH(e) { - RETHROW0("Can't get a data message from row : %s"); + RETHROWF("Can't get a data message from row : %s"); } XBT_VERB("ROW: step(%d)<>myrow(%d). Receive data from %s", step, myrow, gras_socket_peer_name(from)); @@ -353,7 +353,7 @@ static int pmm_worker_cb(gras_msg_cb_ctx_t ctx, void *payload) gras_msg_send(master, "result", &result); } CATCH(e) { - RETHROW0("Failed to send answer to server: %s"); + RETHROWF("Failed to send answer to server: %s"); } XBT_VERB(">>>>>>>> Result sent to %s:%d <<<<<<<<", gras_socket_peer_name(master), gras_socket_peer_port(master)); diff --git a/examples/gras/replay/replay.c b/examples/gras/replay/replay.c index f915360295..cb5785a136 100644 --- a/examples/gras/replay/replay.c +++ b/examples/gras/replay/replay.c @@ -178,7 +178,7 @@ static void do_command(int rank, void *c) } CATCH(e) { SIMIX_display_process_status(); - RETHROW2("Exception while waiting for %f bytes from %s: %s", + RETHROWF("Exception while waiting for %f bytes from %s: %s", cmd->d_arg, cmd->str_arg); } xbt_workload_data_chunk_free(chunk); diff --git a/examples/gras/rpc/rpc.c b/examples/gras/rpc/rpc.c index 42b716f852..da1e116592 100644 --- a/examples/gras/rpc/rpc.c +++ b/examples/gras/rpc/rpc.c @@ -28,7 +28,7 @@ int forwarder(int argc, char *argv[]); int client(int argc, char *argv[]); #define exception_msg "Error for the client" -#define exception_raising() THROW0(unknown_error,42,exception_msg) +#define exception_raising() THROWF(unknown_error,42,exception_msg) static void exception_catching(void) { @@ -44,7 +44,7 @@ static void exception_catching(void) gotit = 1; } if (!gotit) { - THROW0(unknown_error, 0, "Didn't got the remote exception!"); + THROWF(unknown_error, 0, "Didn't got the remote exception!"); } xbt_assert2(e.category == unknown_error, "Got wrong category: %d (instead of %d)", e.category, @@ -98,7 +98,7 @@ int client(int argc, char *argv[]) toforwarder = gras_socket_client(argv[3], atoi(argv[4])); } CATCH(e) { - RETHROW0("Unable to connect to the server: %s"); + RETHROWF("Unable to connect to the server: %s"); } XBT_INFO("Connected to %s:%d.", host, port); @@ -121,7 +121,7 @@ int client(int argc, char *argv[]) } CATCH(e) { gras_socket_close(toserver); - RETHROW0("Failed to execute a PING rpc on the server: %s"); + RETHROWF("Failed to execute a PING rpc on the server: %s"); } exception_catching(); @@ -150,7 +150,7 @@ int client(int argc, char *argv[]) } if (!gotit) - THROW0(unknown_error, 0, "Didn't got the remote exception!"); + THROWF(unknown_error, 0, "Didn't got the remote exception!"); XBT_INFO("Called the exception raising RPC"); exception_catching(); @@ -167,7 +167,7 @@ int client(int argc, char *argv[]) xbt_ex_free(e); } if (!gotit) { - THROW0(unknown_error, 0, "Didn't got the remote exception!"); + THROWF(unknown_error, 0, "Didn't got the remote exception!"); } } /* doxygen_resume */ @@ -183,7 +183,7 @@ int client(int argc, char *argv[]) gotit = 1; } if (!gotit) { - THROW0(unknown_error, 0, "Didn't got the remote exception!"); + 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)), diff --git a/examples/msg/actions/actions.c b/examples/msg/actions/actions.c index 17bc3f4230..f764cb64e7 100644 --- a/examples/msg/actions/actions.c +++ b/examples/msg/actions/actions.c @@ -42,7 +42,7 @@ static double parse_double(const char *string) value = strtod(string, &endptr); if (*endptr != '\0') - THROW1(unknown_error, 0, "%s is not a double", string); + THROWF(unknown_error, 0, "%s is not a double", string); return value; } diff --git a/include/xbt/asserts.h b/include/xbt/asserts.h index 431ed94900..f3157f5349 100644 --- a/include/xbt/asserts.h +++ b/include/xbt/asserts.h @@ -40,21 +40,21 @@ SG_BEGIN_DECL() #else /** @brief The condition which failed will be displayed. @hideinitializer */ -#define xbt_assert(cond) do { if (!(cond)) THROW1(0,0,"Assertion %s failed", #cond); } while (0) +#define xbt_assert(cond) do { if (!(cond)) THROWF(0,0,"Assertion %s failed", #cond); } while (0) /** @hideinitializer */ -#define xbt_assert0(cond,msg) do { if (!(cond)) THROW0(0,0,msg); } while (0) +#define xbt_assert0(cond,msg) do { if (!(cond)) THROWF(0,0,msg); } while (0) /** @hideinitializer */ -#define xbt_assert1(cond,msg,a) do { if (!(cond)) THROW1(0,0,msg,a); } while (0) +#define xbt_assert1(cond,msg,a) do { if (!(cond)) THROWF(0,0,msg,a); } while (0) /** @hideinitializer */ -#define xbt_assert2(cond,msg,a,b) do { if (!(cond)) THROW2(0,0,msg,a,b); } while (0) +#define xbt_assert2(cond,msg,a,b) do { if (!(cond)) THROWF(0,0,msg,a,b); } while (0) /** @hideinitializer */ -#define xbt_assert3(cond,msg,a,b,c) do { if (!(cond)) THROW3(0,0,msg,a,b,c); } while (0) +#define xbt_assert3(cond,msg,a,b,c) do { if (!(cond)) THROWF(0,0,msg,a,b,c); } while (0) /** @hideinitializer */ -#define xbt_assert4(cond,msg,a,b,c,d) do { if (!(cond)) THROW4(0,0,msg,a,b,c,d); } while (0) +#define xbt_assert4(cond,msg,a,b,c,d) do { if (!(cond)) THROWF(0,0,msg,a,b,c,d); } while (0) /** @hideinitializer */ -#define xbt_assert5(cond,msg,a,b,c,d,e) do { if (!(cond)) THROW5(0,0,msg,a,b,c,d,e); } while (0) +#define xbt_assert5(cond,msg,a,b,c,d,e) do { if (!(cond)) THROWF(0,0,msg,a,b,c,d,e); } while (0) /** @hideinitializer */ -#define xbt_assert6(cond,msg,a,b,c,d,e,f) do { if (!(cond)) THROW6(0,0,msg,a,b,c,d,e,f); } while (0) +#define xbt_assert6(cond,msg,a,b,c,d,e,f) do { if (!(cond)) THROWF(0,0,msg,a,b,c,d,e,f); } while (0) #endif /** @} */ SG_END_DECL() diff --git a/include/xbt/ex.h b/include/xbt/ex.h index 11d4037d78..e15422eaa1 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -501,7 +501,7 @@ XBT_PUBLIC(void) xbt_backtrace_current(xbt_ex_t * e); /** @brief Display a previously captured backtrace */ XBT_PUBLIC(void) xbt_backtrace_display(xbt_ex_t * e); -#if 1 || defined(XBT_USE_DEPRECATED) +#ifdef XBT_USE_DEPRECATED /* Kept for backward compatibility. */ diff --git a/src/amok/Bandwidth/bandwidth.c b/src/amok/Bandwidth/bandwidth.c index fbf9f99995..2aca9c1875 100644 --- a/src/amok/Bandwidth/bandwidth.c +++ b/src/amok/Bandwidth/bandwidth.c @@ -154,7 +154,7 @@ void amok_bw_test(gras_socket_t peer, CATCH(e) { measMasterIn = NULL; if (port == 10000 - 1) { - RETHROW0("Error caught while opening a measurement socket: %s"); + RETHROWF("Error caught while opening a measurement socket: %s"); } else { xbt_ex_free(e); } @@ -177,7 +177,7 @@ void amok_bw_test(gras_socket_t peer, gras_msg_rpccall(peer, 15, "BW handshake", &request, &request_ack); } CATCH(e) { - RETHROW0("Error encountered while sending the BW request: %s"); + RETHROWF("Error encountered while sending the BW request: %s"); } measIn = gras_socket_meas_accept(measMasterIn); @@ -187,7 +187,7 @@ void amok_bw_test(gras_socket_t peer, request->buf_size, 1); } CATCH(e) { - RETHROW2 + RETHROWF ("Error encountered while opening the measurement socket to %s:%d for BW test: %s", gras_socket_peer_name(peer), request_ack->peer.port); } @@ -248,7 +248,7 @@ void amok_bw_test(gras_socket_t peer, gras_socket_close(measOut); gras_socket_close(measMasterIn); gras_socket_close(measIn); - RETHROW0("Unable to conduct the experiment: %s"); + RETHROWF("Unable to conduct the experiment: %s"); } *sec = gras_os_time() - *sec; if (*sec != 0.0) { @@ -315,7 +315,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload) xbt_ex_free(e); else /* FIXME: tell error to remote */ - RETHROW0 + RETHROWF ("Error encountered while opening a measurement server socket: %s"); } } @@ -331,7 +331,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload) CATCH(e) { gras_socket_close(measMasterIn); /* FIXME: tell error to remote */ - RETHROW0("Error encountered while sending the answer: %s"); + RETHROWF("Error encountered while sending the answer: %s"); } @@ -342,7 +342,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload) request->buf_size, 1); } CATCH(e) { - RETHROW2 + RETHROWF ("Error encountered while opening a measurement socket back to %s:%d : %s", gras_socket_peer_name(expeditor), request->peer.port); /* FIXME: tell error to remote */ @@ -360,7 +360,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload) gras_socket_close(measIn); gras_socket_close(measOut); /* FIXME: tell error to remote ? */ - RETHROW0("Error encountered while opening the meas socket: %s"); + RETHROWF("Error encountered while opening the meas socket: %s"); } if (!msgtwaited) { @@ -381,7 +381,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload) gras_socket_close(measIn); gras_socket_close(measOut); /* FIXME: tell error to remote ? */ - RETHROW0("Error encountered while receiving the experiment: %s"); + RETHROWF("Error encountered while receiving the experiment: %s"); } gras_msg_wait_or(60, msgtwaited, &ctx_reask, &msggot, &payload); switch (msggot) { diff --git a/src/amok/Bandwidth/saturate.c b/src/amok/Bandwidth/saturate.c index d20e142396..9b941995c4 100644 --- a/src/amok/Bandwidth/saturate.c +++ b/src/amok/Bandwidth/saturate.c @@ -277,7 +277,7 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload) if (port < 10000) xbt_ex_free(e); else - RETHROW0 + RETHROWF ("Error encountered while opening a measurement server socket: %s"); } if (measMaster == NULL) @@ -296,7 +296,7 @@ static int amok_bw_cb_sat_begin(gras_msg_cb_ctx_t ctx, void *payload) } CATCH(e) { gras_socket_close(measMaster); - RETHROW0("Error during saturation handshake: %s"); + RETHROWF("Error during saturation handshake: %s"); } while (saturate_further) { @@ -338,7 +338,7 @@ void amok_bw_saturate_stop(const char *from_name, unsigned int from_port, TRY { gras_msg_rpccall(sock, 60, "amok_bw_sat stop", NULL, &answer); } CATCH(e) { - RETHROW2("Cannot ask %s:%d to stop saturation: %s", from_name, + RETHROWF("Cannot ask %s:%d to stop saturation: %s", from_name, from_port); } gras_socket_close(sock); diff --git a/src/gras/DataDesc/cbps.c b/src/gras/DataDesc/cbps.c index 0bae0a250c..91fe07790e 100644 --- a/src/gras/DataDesc/cbps.c +++ b/src/gras/DataDesc/cbps.c @@ -133,7 +133,7 @@ gras_cbps_v_pop(gras_cbps_t ps, RETHROW; xbt_ex_free(e); - THROW1(not_found_error, 1, "Asked to pop the non-existant %s", name); + THROWF(not_found_error, 1, "Asked to pop the non-existant %s", name); } xbt_dynar_pop(varstack, &var); diff --git a/src/gras/DataDesc/ddt_create.c b/src/gras/DataDesc/ddt_create.c index 3d6e18aff8..f76e217fdb 100644 --- a/src/gras/DataDesc/ddt_create.c +++ b/src/gras/DataDesc/ddt_create.c @@ -81,7 +81,7 @@ gras_datadesc_type_t gras_datadesc_by_name(const char *name) xbt_ex_free(e); } if (!found) - THROW1(not_found_error, 0, "No registred datatype of that name: %s", + THROWF(not_found_error, 0, "No registred datatype of that name: %s", name); return res; diff --git a/src/gras/DataDesc/ddt_exchange.c b/src/gras/DataDesc/ddt_exchange.c index a30334d171..4e4e510593 100644 --- a/src/gras/DataDesc/ddt_exchange.c +++ b/src/gras/DataDesc/ddt_exchange.c @@ -742,10 +742,10 @@ gras_datadesc_recv_rec(gras_socket_t sock, /* retrieve the field number */ gras_dd_recv_int(sock, r_arch, &field_num); if (field_num < 0) - THROW1(mismatch_error, 0, + THROWF(mismatch_error, 0, "Received union field for %s is negative", type->name); if (field_num > xbt_dynar_length(union_data.fields)) - THROW3(mismatch_error, 0, + THROWF(mismatch_error, 0, "Received union field for %s is said to be #%d but there is only %lu fields", type->name, field_num, xbt_dynar_length(union_data.fields)); @@ -875,7 +875,7 @@ gras_datadesc_recv_rec(gras_socket_t sock, if (count == -1) gras_dd_recv_int(sock, r_arch, &count); if (count == -1) - THROW1(mismatch_error, 0, + THROWF(mismatch_error, 0, "Invalid (=-1) array size for type %s", type->name); /* receive the content */ diff --git a/src/gras/DataDesc/ddt_parse.c b/src/gras/DataDesc/ddt_parse.c index 2966cce5d2..fc02a6f23d 100644 --- a/src/gras/DataDesc/ddt_parse.c +++ b/src/gras/DataDesc/ddt_parse.c @@ -240,7 +240,7 @@ static void parse_statement(char *definition, gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump(); if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_RA) { XBT_OUT(); - THROW0(mismatch_error, 0, "End of the englobing structure or union"); + THROWF(mismatch_error, 0, "End of the englobing structure or union"); } if (XBT_LOG_ISENABLED(gras_ddt_parse, xbt_log_priority_debug)) { diff --git a/src/gras/Msg/gras_msg_exchange.c b/src/gras/Msg/gras_msg_exchange.c index c8dc08d14d..d2178bc290 100644 --- a/src/gras/Msg/gras_msg_exchange.c +++ b/src/gras/Msg/gras_msg_exchange.c @@ -122,7 +122,7 @@ gras_msg_wait_ext_(double timeout, now = gras_os_time(); if (now - start + 0.001 > timeout) { - THROW1(timeout_error, now - start + 0.001 - timeout, + THROWF(timeout_error, now - start + 0.001 - timeout, "Timeout while waiting for msg '%s'", msgt_want ? msgt_want->name : "(any)"); } @@ -274,7 +274,7 @@ void gras_msg_handleall(double period) } CATCH(e) { if (e.category != timeout_error) - RETHROW0("Error while waiting for messages: %s"); + RETHROWF("Error while waiting for messages: %s"); xbt_ex_free(e); } /* Epsilon to avoid numerical stability issues were the waited interval is so small that the global clock cannot notice the increment */ @@ -357,14 +357,14 @@ void gras_msg_handle(double timeOut) XBT_WARN ("No timer elapsed, in contrary to expectations (next in %f sec)", untiltimer); - THROW1(timeout_error, 0, + THROWF(timeout_error, 0, "No timer elapsed, in contrary to expectations (next in %f sec)", untiltimer); } } else { /* select timeouted, and no timer elapsed. Nothing to do */ - THROW1(timeout_error, 0, "No new message or timer (delay was %f)", + THROWF(timeout_error, 0, "No new message or timer (delay was %f)", timeOut); } @@ -438,7 +438,7 @@ void gras_msg_handle(double timeOut) ctx.answer_due = 0; ran_ok = 1; } else { - RETHROW4 + RETHROWF ("Callback #%d (@%p) to message '%s' (payload size: %d) raised an exception: %s", cpt + 1, cb, msg.type->name, msg.payl_size); } @@ -453,7 +453,7 @@ void gras_msg_handle(double timeOut) "AND IN SIMGRID (process wasn't killed by an assert)", msg.type->name); if (!ran_ok) - THROW1(mismatch_error, 0, + THROWF(mismatch_error, 0, "Message '%s' refused by all registered callbacks (maybe your callback misses a 'return 0' at the end)", msg.type->name); /* FIXME: gras_datadesc_free not implemented => leaking the payload */ @@ -477,7 +477,7 @@ void gras_msg_handle(double timeOut) return; default: - THROW1(unknown_error, 0, + THROWF(unknown_error, 0, "Cannot handle messages of kind %d yet", msg.type->kind); } diff --git a/src/gras/Msg/gras_msg_types.c b/src/gras/Msg/gras_msg_types.c index 1756661dc8..83a606c2c8 100644 --- a/src/gras/Msg/gras_msg_types.c +++ b/src/gras/Msg/gras_msg_types.c @@ -204,7 +204,7 @@ gras_msgtype_t gras_msgtype_by_namev(const char *name, short int version) xbt_ex_free(e); } if (!found) - THROW1(not_found_error, 0, "No registred message of that name: %s", + THROWF(not_found_error, 0, "No registred message of that name: %s", name); free(namev); diff --git a/src/gras/Msg/rl_msg.c b/src/gras/Msg/rl_msg.c index 82b7ad4a66..fead6dfa6f 100644 --- a/src/gras/Msg/rl_msg.c +++ b/src/gras/Msg/rl_msg.c @@ -62,7 +62,7 @@ void gras_msg_send_ext(gras_socket_t sock, break; default: - THROW1(unknown_error, 0, "Unknown msg kind %d", kind); + THROWF(unknown_error, 0, "Unknown msg kind %d", kind); } gras_datadesc_send(sock, string_type, &msgtype->name); @@ -118,17 +118,17 @@ void gras_msg_recv(gras_socket_t sock, gras_msg_t msg) msg->kind = (e_gras_msg_kind_t) c_kind; } CATCH(e) { - RETHROW0 + RETHROWF ("Exception caught while trying to get the message header: %s"); } for (cpt = 0; cpt < 4; cpt++) if (header[cpt] != _GRAS_header[cpt]) - THROW2(mismatch_error, 0, + THROWF(mismatch_error, 0, "Incoming bytes do not look like a GRAS message (header='%s' not '%.4s')", hexa_str((unsigned char *) header, 4, 0), _GRAS_header); if (header[4] != _GRAS_header[4]) - THROW2(mismatch_error, 0, "GRAS protocol mismatch (got %d, use %d)", + THROWF(mismatch_error, 0, "GRAS protocol mismatch (got %d, use %d)", (int) header[4], (int) _GRAS_header[4]); r_arch = (int) header[5]; @@ -159,11 +159,11 @@ void gras_msg_recv(gras_socket_t sock, gras_msg_t msg) /* FIXME: Survive unknown messages */ if (e.category == not_found_error) { xbt_ex_free(e); - THROW1(not_found_error, 0, + THROWF(not_found_error, 0, "Received an unknown message: %s (FIXME: should survive to these)", msg_name); } else - RETHROW1 + RETHROWF ("Exception caught while retrieving the type associated to messages '%s' : %s", msg_name); } diff --git a/src/gras/Msg/timer.c b/src/gras/Msg/timer.c index 989fa84030..3c97260740 100644 --- a/src/gras/Msg/timer.c +++ b/src/gras/Msg/timer.c @@ -65,7 +65,7 @@ void gras_timer_cancel_delay(double interval, void_f_void_t action) } if (!found) - THROW2(mismatch_error, 0, + THROWF(mismatch_error, 0, "Cannot remove the action %p delayed of %f second: not found", action, interval); @@ -91,7 +91,7 @@ void gras_timer_cancel_repeat(double interval, void_f_void_t action) } if (!found) - THROW2(mismatch_error, 0, + THROWF(mismatch_error, 0, "Cannot remove the action %p delayed of %f second: not found", action, interval); } @@ -115,7 +115,7 @@ void gras_timer_cancel_delay_all(void) } if (!found) - THROW0(mismatch_error, 0, "No delayed action to remove"); + THROWF(mismatch_error, 0, "No delayed action to remove"); } @@ -138,7 +138,7 @@ void gras_timer_cancel_repeat_all(void) } if (!found) - THROW0(mismatch_error, 0, "No repetitive action to remove"); + THROWF(mismatch_error, 0, "No repetitive action to remove"); } /** @brief Cancel all delayed and repetitive tasks */ diff --git a/src/gras/Transport/rl_transport.c b/src/gras/Transport/rl_transport.c index d1db33016b..eed89d0eff 100644 --- a/src/gras/Transport/rl_transport.c +++ b/src/gras/Transport/rl_transport.c @@ -74,7 +74,7 @@ gras_socket_t gras_trp_select(double timeout) XBT_DEBUG("wakeup=%f now=%f", wakeup, now); if (now == -1 || now >= wakeup) { /* didn't find anything; no need to update _gras_lastly_selected_socket since its moredata is 0 (or we would have returned it directly) */ - THROW1(timeout_error, 0, + THROWF(timeout_error, 0, "Timeout (%f) elapsed with selecting for incomming connexions", timeout); } @@ -107,11 +107,11 @@ gras_socket_t gras_trp_select(double timeout) if (timeout > 0) { XBT_DEBUG("No socket to select onto. Sleep %f sec instead.", timeout); gras_os_sleep(timeout); - THROW1(timeout_error, 0, + THROWF(timeout_error, 0, "No socket to select onto. Sleep %f sec instead", timeout); } else { XBT_DEBUG("No socket to select onto. Return directly."); - THROW0(timeout_error, 0, + THROWF(timeout_error, 0, "No socket to select onto. Return directly."); } } @@ -156,13 +156,13 @@ gras_socket_t gras_trp_select(double timeout) /* if we cared, we would have set an handler */ continue; case EINVAL: /* invalid value */ - THROW3(system_error, EINVAL, + THROWF(system_error, EINVAL, "invalid select: nb fds: %d, timeout: %d.%d", max_fds, (int) tout.tv_sec, (int) tout.tv_usec); case ENOMEM: xbt_die("Malloc error during the select"); default: - THROW2(system_error, errno, "Error during select: %s (%d)", + THROWF(system_error, errno, "Error during select: %s (%d)", strerror(errno), errno); } THROW_IMPOSSIBLE; @@ -236,10 +236,10 @@ gras_socket_t gras_trp_select(double timeout) /* No socket found. Maybe we had timeout=0 and nothing to do */ XBT_DEBUG("TIMEOUT"); - THROW0(timeout_error, 0, "Timeout"); + THROWF(timeout_error, 0, "Timeout"); } void gras_trp_sg_setup(gras_trp_plugin_t plug) { - THROW0(mismatch_error, 0, "No SG transport on live platforms"); + THROWF(mismatch_error, 0, "No SG transport on live platforms"); } diff --git a/src/gras/Transport/sg_transport.c b/src/gras/Transport/sg_transport.c index 4416c09a04..276501ac18 100644 --- a/src/gras/Transport/sg_transport.c +++ b/src/gras/Transport/sg_transport.c @@ -52,7 +52,7 @@ gras_socket_t gras_trp_select(double timeout) if (active_socket == NULL) { XBT_DEBUG("TIMEOUT"); - THROW0(timeout_error, 0, "Timeout"); + THROWF(timeout_error, 0, "Timeout"); } active_socket_data = (gras_trp_sg_sock_data_t *) active_socket->data; @@ -131,17 +131,17 @@ gras_socket_t gras_trp_select(double timeout) void gras_trp_tcp_setup(gras_trp_plugin_t plug) { - THROW0(mismatch_error, 0, NULL); + THROW(mismatch_error, 0); } void gras_trp_file_setup(gras_trp_plugin_t plug) { - THROW0(mismatch_error, 0, NULL); + THROW(mismatch_error, 0); } void gras_trp_iov_setup(gras_trp_plugin_t plug) { - THROW0(mismatch_error, 0, NULL); + THROW(mismatch_error, 0); } gras_socket_t gras_trp_buf_init_sock(gras_socket_t sock) diff --git a/src/gras/Transport/transport.c b/src/gras/Transport/transport.c index 7936bf1614..c0552823c2 100644 --- a/src/gras/Transport/transport.c +++ b/src/gras/Transport/transport.c @@ -430,7 +430,7 @@ gras_trp_plugin_t gras_trp_plugin_get_by_name(const char *name) int gras_socket_my_port(gras_socket_t sock) { if (!sock->plugin->my_port) - THROW1(unknown_error,0,"Function my_port unimplemented in plugin %s",sock->plugin->name); + THROWF(unknown_error,0,"Function my_port unimplemented in plugin %s",sock->plugin->name); return (*sock->plugin->my_port)(sock); } @@ -438,7 +438,7 @@ int gras_socket_my_port(gras_socket_t sock) int gras_socket_peer_port(gras_socket_t sock) { if (!sock->plugin->peer_port) - THROW1(unknown_error,0,"Function peer_port unimplemented in plugin %s",sock->plugin->name); + THROWF(unknown_error,0,"Function peer_port unimplemented in plugin %s",sock->plugin->name); return (*sock->plugin->peer_port)(sock); } @@ -492,7 +492,7 @@ void gras_socket_meas_send(gras_socket_t peer, unsigned long int sent_sofar; XBT_IN(""); - THROW0(unknown_error,0,"measurement sockets were broken in this release of SimGrid and should be ported back in the future." + 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..."); if (gras_if_RL()) chunk = xbt_malloc0(msg_size); @@ -540,7 +540,7 @@ void gras_socket_meas_recv(gras_socket_t peer, unsigned long int got_sofar; XBT_IN(""); - THROW0(unknown_error,0,"measurement sockets were broken in this release of SimGrid and should be ported back in the future." + 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..."); if (gras_if_RL()) @@ -582,7 +582,7 @@ void gras_socket_meas_recv(gras_socket_t peer, gras_socket_t gras_socket_meas_accept(gras_socket_t peer) { gras_socket_t res; - THROW0(unknown_error,0,"measurement sockets were broken in this release of SimGrid and should be ported back in the future." + 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, diff --git a/src/gras/Transport/transport_plugin_file.c b/src/gras/Transport/transport_plugin_file.c index a151d0dc7e..c48b063f0a 100644 --- a/src/gras/Transport/transport_plugin_file.c +++ b/src/gras/Transport/transport_plugin_file.c @@ -108,7 +108,7 @@ gras_socket_t gras_socket_client_from_file(const char *path) S_IRUSR | S_IWUSR | S_IRGRP); if (res->sd < 0) { - THROW2(system_error, 0, + THROWF(system_error, 0, "Cannot create a client socket from file %s: %s", path, strerror(errno)); } @@ -149,7 +149,7 @@ gras_socket_t gras_socket_server_from_file(const char *path) res->sd = open(path, O_RDONLY | O_BINARY); if (res->sd < 0) { - THROW2(system_error, 0, + THROWF(system_error, 0, "Cannot create a server socket from file %s: %s", path, strerror(errno)); } @@ -221,7 +221,7 @@ gras_trp_file_chunk_send_raw(gras_socket_t sock, status = write(sock->sd, data, (long int) size); if (status == -1) { - THROW4(system_error, 0, "write(%d,%p,%d) failed: %s", + THROWF(system_error, 0, "write(%d,%p,%d) failed: %s", sock->sd, data, (int) size, strerror(errno)); } @@ -229,7 +229,7 @@ gras_trp_file_chunk_send_raw(gras_socket_t sock, size -= status; data += status; } else { - THROW0(system_error, 0, "file descriptor closed"); + THROWF(system_error, 0, "file descriptor closed"); } } } @@ -264,7 +264,7 @@ gras_trp_file_chunk_recv(gras_socket_t sock, XBT_DEBUG("read(%d, %p, %ld);", sock->sd, data + got, size); if (status < 0) { - THROW4(system_error, 0, "read(%d,%p,%d) failed: %s", + THROWF(system_error, 0, "read(%d,%p,%d) failed: %s", sock->sd, data + got, (int) size, strerror(errno)); } @@ -272,7 +272,7 @@ gras_trp_file_chunk_recv(gras_socket_t sock, size -= status; got += status; } else { - THROW1(system_error, errno, "file descriptor closed after %d bytes", + THROWF(system_error, errno, "file descriptor closed after %d bytes", got); } } diff --git a/src/gras/Transport/transport_plugin_sg.c b/src/gras/Transport/transport_plugin_sg.c index fe83110648..9439b6a542 100644 --- a/src/gras/Transport/transport_plugin_sg.c +++ b/src/gras/Transport/transport_plugin_sg.c @@ -140,31 +140,31 @@ void gras_trp_sg_socket_client(gras_trp_plugin_t self, /* make sure this socket will reach someone */ if (!(peer = SIMIX_req_host_get_by_name(host))) - THROW1(mismatch_error, 0, + THROWF(mismatch_error, 0, "Can't connect to %s: no such host.\n", host); if (!(hd = (gras_hostdata_t *) SIMIX_req_host_get_data(peer))) - THROW1(mismatch_error, 0, + THROWF(mismatch_error, 0, "can't connect to %s: no process on this host", host); pr = find_port(hd, port); if (pr == NULL) { - THROW2(mismatch_error, 0, + THROWF(mismatch_error, 0, "can't connect to %s:%d, no process listen on this port", host, port); } /* Ensure that the listener is expecting the kind of stuff we want to send */ if (pr->meas && !sock->meas) { - THROW2(mismatch_error, 0, + THROWF(mismatch_error, 0, "can't connect to %s:%d in regular mode, the process listen " "in measurement mode on this port", host, port); } if (!pr->meas && sock->meas) { - THROW2(mismatch_error, 0, + THROWF(mismatch_error, 0, "can't connect to %s:%d in measurement mode, the process listen " "in regular mode on this port", host, port); @@ -208,7 +208,7 @@ void gras_trp_sg_socket_server(gras_trp_plugin_t self, int port, gras_socket_t s pr = find_port(hd, port); if (pr) - THROW2(mismatch_error, 0, + THROWF(mismatch_error, 0, "can't listen on address %s:%d: port already in use.", SIMIX_host_self_get_name(), port); @@ -348,7 +348,7 @@ int gras_trp_sg_chunk_recv(gras_socket_t sock, &remote_socket, 60); if (remote_socket == NULL) { - THROW0(timeout_error, 0, "Timeout"); + THROWF(timeout_error, 0, "Timeout"); } remote_sock_data = (gras_trp_sg_sock_data_t *) remote_socket->data; @@ -364,7 +364,7 @@ int gras_trp_sg_chunk_recv(gras_socket_t sock, SIMIX_req_cond_wait(remote_sock_data->cond, remote_sock_data->mutex); if (msg_got->payl_size != size) - THROW5(mismatch_error, 0, + THROWF(mismatch_error, 0, "Got %d bytes when %ld where expected (in %s->%s:%d)", msg_got->payl_size, size, SIMIX_req_host_get_name(sock_data->to_host), diff --git a/src/gras/Transport/transport_plugin_tcp.c b/src/gras/Transport/transport_plugin_tcp.c index 0835ece385..90c4715a44 100644 --- a/src/gras/Transport/transport_plugin_tcp.c +++ b/src/gras/Transport/transport_plugin_tcp.c @@ -105,7 +105,7 @@ void gras_trp_sock_socket_client(gras_trp_plugin_t ignored, sock->sd = socket(AF_INET, SOCK_STREAM, 0); if (sock->sd < 0) { - THROW1(system_error, 0, "Failed to create socket: %s", + THROWF(system_error, 0, "Failed to create socket: %s", sock_errstr(sock_errno)); } @@ -119,7 +119,7 @@ void gras_trp_sock_socket_client(gras_trp_plugin_t ignored, he = gethostbyname(sockdata->peer_name); if (he == NULL) { - THROW2(system_error, 0, "Failed to lookup hostname %s: %s", + THROWF(system_error, 0, "Failed to lookup hostname %s: %s", sockdata->peer_name, sock_errstr(sock_errno)); } @@ -132,7 +132,7 @@ void gras_trp_sock_socket_client(gras_trp_plugin_t ignored, if (connect(sock->sd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { tcp_close(sock->sd); - THROW3(system_error, 0, + THROWF(system_error, 0, "Failed to connect socket to %s:%d (%s)", sockdata->peer_name, sockdata->peer_port, sock_errstr(sock_errno)); } @@ -171,12 +171,12 @@ void gras_trp_sock_socket_server(gras_trp_plugin_t ignored, server.sin_addr.s_addr = INADDR_ANY; server.sin_family = AF_INET; if ((sock->sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) - THROW1(system_error, 0, "Socket allocation failed: %s", + THROWF(system_error, 0, "Socket allocation failed: %s", sock_errstr(sock_errno)); if (setsockopt (sock->sd, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on))) - THROW1(system_error, 0, + THROWF(system_error, 0, "setsockopt failed, cannot condition the socket: %s", sock_errstr(sock_errno)); @@ -190,7 +190,7 @@ void gras_trp_sock_socket_server(gras_trp_plugin_t ignored, if (bind(sock->sd, (struct sockaddr *) &server, sizeof(server)) == -1) { tcp_close(sock->sd); - THROW2(system_error, 0, + THROWF(system_error, 0, "Cannot bind to port %d: %s", sockdata->port, sock_errstr(sock_errno)); } @@ -198,7 +198,7 @@ void gras_trp_sock_socket_server(gras_trp_plugin_t ignored, XBT_DEBUG("Listen on port %d (sd=%d)", sockdata->port, sock->sd); if (listen(sock->sd, 5) < 0) { tcp_close(sock->sd); - THROW2(system_error, 0, + THROWF(system_error, 0, "Cannot listen on port %d: %s", sockdata->port, sock_errstr(sock_errno)); } @@ -231,7 +231,7 @@ static gras_socket_t gras_trp_sock_socket_accept(gras_socket_t sock) if (sd == -1) { gras_socket_close(sock); - THROW1(system_error, 0, + THROWF(system_error, 0, "Accept failed (%s). Droping server socket.", sock_errstr(tmp_errno)); } @@ -239,7 +239,7 @@ static gras_socket_t gras_trp_sock_socket_accept(gras_socket_t sock) if (setsockopt(sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &i, s) || setsockopt(sd, _gras_tcp_proto_number(), TCP_NODELAY, (char *) &i, s)) - THROW1(system_error, 0, + THROWF(system_error, 0, "setsockopt failed, cannot condition the socket: %s", sock_errstr(tmp_errno)); @@ -335,7 +335,7 @@ static XBT_INLINE void gras_trp_tcp_send(gras_socket_t sock, #endif continue; - THROW4(system_error, 0, "write(%d,%p,%ld) failed: %s", + THROWF(system_error, 0, "write(%d,%p,%ld) failed: %s", sock->sd, data, size, sock_errstr(sock_errno)); } @@ -343,7 +343,7 @@ static XBT_INLINE void gras_trp_tcp_send(gras_socket_t sock, size -= status; data += status; } else { - THROW1(system_error, 0, "file descriptor closed (%s)", + THROWF(system_error, 0, "file descriptor closed (%s)", sock_errstr(sock_errno)); } } @@ -374,7 +374,7 @@ gras_trp_tcp_recv_withbuffer(gras_socket_t sock, status = tcp_read(sock->sd, data + got, (size_t) bufsize); if (status < 0) { - THROW7(system_error, 0, + THROWF(system_error, 0, "read(%d,%p,%d) from %s:%d failed: %s; got %d so far", sock->sd, data + got, (int) size, gras_socket_peer_name(sock), gras_socket_peer_port(sock), sock_errstr(sock_errno), got); @@ -386,7 +386,7 @@ gras_trp_tcp_recv_withbuffer(gras_socket_t sock, bufsize -= status; got += status; } else { - THROW1(system_error, errno, + THROWF(system_error, errno, "Socket closed by remote side (got %d bytes before this)", got); } diff --git a/src/gras/Virtu/process.c b/src/gras/Virtu/process.c index 8a90f119ad..39615deceb 100644 --- a/src/gras/Virtu/process.c +++ b/src/gras/Virtu/process.c @@ -100,7 +100,7 @@ void *gras_libdata_by_name_from_procdata(const char *name, res = xbt_set_get_by_name(pd->libdata, name); } CATCH(e) { - RETHROW1("Cannot retrieve the libdata associated to %s: %s", name); + RETHROWF("Cannot retrieve the libdata associated to %s: %s", name); } return res; } @@ -156,7 +156,7 @@ void gras_procdata_init() found = 0; } if (found) - THROW1(unknown_error, 0, + THROWF(unknown_error, 0, "MayDay: two modules use '%s' as libdata name", fab.name); /* Add the data in place, after some more sanity checking */ diff --git a/src/simdag/sd_task.c b/src/simdag/sd_task.c index 896d84b86c..44982dc97c 100644 --- a/src/simdag/sd_task.c +++ b/src/simdag/sd_task.c @@ -407,19 +407,19 @@ void SD_task_dependency_add(const char *name, void *data, SD_task_t src, length = xbt_dynar_length(dynar); if (src == dst) - THROW1(arg_error, 0, + THROWF(arg_error, 0, "Cannot add a dependency between task '%s' and itself", SD_task_get_name(src)); if (!__SD_task_is_not_scheduled(src) && !__SD_task_is_schedulable(src) && !__SD_task_is_scheduled_or_runnable(src)) - THROW1(arg_error, 0, + THROWF(arg_error, 0, "Task '%s' must be SD_NOT_SCHEDULED, SD_SCHEDULABLE, SD_SCHEDULED or SD_RUNNABLE", SD_task_get_name(src)); if (!__SD_task_is_not_scheduled(dst) && !__SD_task_is_schedulable(dst) && !__SD_task_is_scheduled_or_runnable(dst)) - THROW1(arg_error, 0, + THROWF(arg_error, 0, "Task '%s' must be SD_NOT_SCHEDULED, SD_SCHEDULABLE, SD_SCHEDULED or SD_RUNNABLE", SD_task_get_name(dst)); @@ -433,7 +433,7 @@ void SD_task_dependency_add(const char *name, void *data, SD_task_t src, } if (found) - THROW2(arg_error, 0, + THROWF(arg_error, 0, "A dependency already exists between task '%s' and task '%s'", SD_task_get_name(src), SD_task_get_name(dst)); @@ -529,7 +529,7 @@ void SD_task_dependency_remove(SD_task_t src, SD_task_t dst) } } if (!found) - THROW4(arg_error, 0, + THROWF(arg_error, 0, "No dependency found between task '%s' and '%s': task '%s' is not a successor of task '%s'", SD_task_get_name(src), SD_task_get_name(dst), SD_task_get_name(dst), SD_task_get_name(src)); @@ -600,7 +600,7 @@ void *SD_task_dependency_get_data(SD_task_t src, SD_task_t dst) found = (dependency->dst == dst); } if (!found) - THROW2(arg_error, 0, "No dependency found between task '%s' and '%s'", + THROWF(arg_error, 0, "No dependency found between task '%s' and '%s'", SD_task_get_name(src), SD_task_get_name(dst)); return dependency->data; } @@ -646,7 +646,7 @@ void SD_task_watch(SD_task_t task, e_SD_task_state_t state) xbt_assert0(task != NULL, "Invalid parameter"); if (state & SD_NOT_SCHEDULED) - THROW0(arg_error, 0, + THROWF(arg_error, 0, "Cannot add a watch point for state SD_NOT_SCHEDULED"); task->watch_points = task->watch_points | state; @@ -728,7 +728,7 @@ static XBT_INLINE void SD_task_do_schedule(SD_task_t task) SD_CHECK_INIT_DONE(); if (!__SD_task_is_not_scheduled(task) && !__SD_task_is_schedulable(task)) - THROW1(arg_error, 0, "Task '%s' has already been scheduled", + THROWF(arg_error, 0, "Task '%s' has already been scheduled", SD_task_get_name(task)); /* update the task state */ @@ -815,7 +815,7 @@ void SD_task_unschedule(SD_task_t task) task->state_set != sd_global->runnable_task_set && task->state_set != sd_global->running_task_set && task->state_set != sd_global->failed_task_set) - THROW1(arg_error, 0, + THROWF(arg_error, 0, "Task %s: the state must be SD_SCHEDULED, SD_RUNNABLE, SD_RUNNING or SD_FAILED", SD_task_get_name(task)); @@ -842,7 +842,7 @@ static void __SD_task_destroy_scheduling_data(SD_task_t task) SD_CHECK_INIT_DONE(); if (!__SD_task_is_scheduled_or_runnable(task) && !__SD_task_is_in_fifo(task)) - THROW1(arg_error, 0, + THROWF(arg_error, 0, "Task '%s' must be SD_SCHEDULED, SD_RUNNABLE or SD_IN_FIFO", SD_task_get_name(task)); diff --git a/src/simix/smx_context.c b/src/simix/smx_context.c index f775099955..810f7fb5f9 100644 --- a/src/simix/smx_context.c +++ b/src/simix/smx_context.c @@ -90,7 +90,7 @@ XBT_INLINE void SIMIX_context_set_nthreads(int nb_threads) { if (nb_threads > 1) { #ifndef CONTEXT_THREADS - THROW0(arg_error, 0, "No thread support for parallel context execution"); + THROWF(arg_error, 0, "No thread support for parallel context execution"); #endif } diff --git a/src/simix/smx_context_sysv.c b/src/simix/smx_context_sysv.c index 568cd0f48e..5759fa60e9 100644 --- a/src/simix/smx_context_sysv.c +++ b/src/simix/smx_context_sysv.c @@ -70,7 +70,7 @@ void SIMIX_ctx_sysv_factory_init(smx_context_factory_t *factory) (*factory)->self = smx_ctx_sysv_self_parallel; (*factory)->get_thread_id = smx_ctx_sysv_get_thread_id; #else - THROW0(arg_error, 0, "No thread support for parallel context execution"); + THROWF(arg_error, 0, "No thread support for parallel context execution"); #endif }else{ (*factory)->runall = smx_ctx_sysv_runall; diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 62e11134a5..fe3f5642e3 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -65,7 +65,7 @@ void SIMIX_host_destroy(void *h) msg = tmp; } SIMIX_display_process_status(); - THROW1(arg_error, 0, "%s", msg); + THROWF(arg_error, 0, "%s", msg); } xbt_swag_free(host->process_list); @@ -353,7 +353,7 @@ void SIMIX_execution_finish(smx_action_t action) case SIMIX_FAILED: TRY { XBT_DEBUG("SIMIX_execution_finished: host '%s' failed", req->issuer->smx_host->name); - THROW0(host_error, 0, "Host failed"); + THROWF(host_error, 0, "Host failed"); } CATCH(req->issuer->running_ctx->exception) { req->issuer->doexception = 1; @@ -363,7 +363,7 @@ void SIMIX_execution_finish(smx_action_t action) case SIMIX_CANCELED: TRY { XBT_DEBUG("SIMIX_execution_finished: execution canceled"); - THROW0(cancel_error, 0, "Canceled"); + THROWF(cancel_error, 0, "Canceled"); } CATCH(req->issuer->running_ctx->exception) { req->issuer->doexception = 1; diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index f2b2258087..2e81c90d82 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -585,7 +585,7 @@ void SIMIX_comm_finish(smx_action_t action) case SIMIX_SRC_TIMEOUT: TRY { - THROW0(timeout_error, 0, "Communication timeouted because of sender"); + THROWF(timeout_error, 0, "Communication timeouted because of sender"); } CATCH(req->issuer->running_ctx->exception) { req->issuer->doexception = 1; @@ -594,7 +594,7 @@ void SIMIX_comm_finish(smx_action_t action) case SIMIX_DST_TIMEOUT: TRY { - THROW0(timeout_error, 0, "Communication timeouted because of receiver"); + THROWF(timeout_error, 0, "Communication timeouted because of receiver"); } CATCH(req->issuer->running_ctx->exception) { req->issuer->doexception = 1; @@ -604,9 +604,9 @@ void SIMIX_comm_finish(smx_action_t action) case SIMIX_SRC_HOST_FAILURE: TRY { if (req->issuer == action->comm.src_proc) - THROW0(host_error, 0, "Host failed"); + THROWF(host_error, 0, "Host failed"); else - THROW0(network_error, 0, "Remote peer failed"); + THROWF(network_error, 0, "Remote peer failed"); } CATCH(req->issuer->running_ctx->exception) { req->issuer->doexception = 1; @@ -616,9 +616,9 @@ void SIMIX_comm_finish(smx_action_t action) case SIMIX_DST_HOST_FAILURE: TRY { if (req->issuer == action->comm.dst_proc) - THROW0(host_error, 0, "Host failed"); + THROWF(host_error, 0, "Host failed"); else - THROW0(network_error, 0, "Remote peer failed"); + THROWF(network_error, 0, "Remote peer failed"); } CATCH(req->issuer->running_ctx->exception) { req->issuer->doexception = 1; @@ -630,7 +630,7 @@ void SIMIX_comm_finish(smx_action_t action) XBT_DEBUG("Link failure in action %p between '%s' and '%s': posting an exception to the issuer: %s (%p)", action, action->comm.src_proc->smx_host->name, action->comm.dst_proc->smx_host->name, req->issuer->name, req->issuer); - THROW0(network_error, 0, "Link failure"); + THROWF(network_error, 0, "Link failure"); } CATCH(req->issuer->running_ctx->exception) { req->issuer->doexception = 1; diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 168a00ff23..a9e96fabfc 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -423,7 +423,7 @@ smx_action_t SIMIX_process_sleep(smx_process_t process, double duration) /* check if the host is active */ if (surf_workstation_model->extension. workstation.get_state(host->host) != SURF_RESOURCE_ON) { - THROW1(host_error, 0, "Host %s failed, you cannot call this function", + THROWF(host_error, 0, "Host %s failed, you cannot call this function", host->name); } diff --git a/src/simix/smx_smurf.c b/src/simix/smx_smurf.c index 8ac0b0c4db..cc612ae01a 100644 --- a/src/simix/smx_smurf.c +++ b/src/simix/smx_smurf.c @@ -535,7 +535,7 @@ void SIMIX_request_pre(smx_req_t req, int value) break; case REQ_NO_REQ: - THROW2(arg_error,0,"Asked to do the noop syscall on %s@%s", + THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s", SIMIX_process_get_name(req->issuer), SIMIX_host_get_name(SIMIX_process_get_host(req->issuer)) ); diff --git a/src/simix/smx_synchro.c b/src/simix/smx_synchro.c index 3aef38486c..378e904d8f 100644 --- a/src/simix/smx_synchro.c +++ b/src/simix/smx_synchro.c @@ -89,7 +89,7 @@ static void SIMIX_synchro_finish(smx_action_t action) case SIMIX_SRC_TIMEOUT: TRY { - THROW0(timeout_error, 0, "Synchro's wait timeout"); + THROWF(timeout_error, 0, "Synchro's wait timeout"); } CATCH(req->issuer->running_ctx->exception) { req->issuer->doexception = 1; } @@ -97,7 +97,7 @@ static void SIMIX_synchro_finish(smx_action_t action) case SIMIX_FAILED: TRY { - THROW0(host_error, 0, "Host failed"); + THROWF(host_error, 0, "Host failed"); } CATCH(req->issuer->running_ctx->exception) { req->issuer->doexception = 1; } diff --git a/src/surf/random_mgr.c b/src/surf/random_mgr.c index e65576afa7..6fb652d53f 100644 --- a/src/surf/random_mgr.c +++ b/src/surf/random_mgr.c @@ -264,12 +264,12 @@ random_data_t random_new(Generator generator, long int seed, /* Check user stupidities */ if (max < min) - THROW2(arg_error, 0, "random->max < random->min (%f < %f)", max, min); + THROWF(arg_error, 0, "random->max < random->min (%f < %f)", max, min); if (mean < min) - THROW2(arg_error, 0, "random->mean < random->min (%f < %f)", mean, + THROWF(arg_error, 0, "random->mean < random->min (%f < %f)", mean, min); if (mean > max) - THROW2(arg_error, 0, "random->mean > random->max (%f > %f)", mean, + THROWF(arg_error, 0, "random->mean > random->max (%f > %f)", mean, max); /* normalize the mean and standard deviation before storing */ @@ -277,7 +277,7 @@ random_data_t random_new(Generator generator, long int seed, random->std = std / (max - min); if (random->mean * (1 - random->mean) < random->std * random->std) - THROW2(arg_error, 0, "Invalid mean and standard deviation (%f and %f)", + THROWF(arg_error, 0, "Invalid mean and standard deviation (%f and %f)", random->mean, random->std); return random; diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 28d9d733f1..0493a951fd 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -326,7 +326,7 @@ static void parse_S_router_lua(const char* router_id) static void parse_S_route_new_and_endpoints(const char *src_id, const char *dst_id) { if (src != NULL && dst != NULL && link_list != NULL) - THROW2(arg_error, 0, "Route between %s to %s can not be defined", + THROWF(arg_error, 0, "Route between %s to %s can not be defined", src_id, dst_id); src = src_id; dst = dst_id; @@ -359,7 +359,7 @@ static void parse_S_route_new_and_endpoints_lua(const char *id_src, const char * static void parse_S_ASroute_new_and_endpoints(void) { if (src != NULL && dst != NULL && link_list != NULL) - THROW2(arg_error, 0, "Route between %s to %s can not be defined", + THROWF(arg_error, 0, "Route between %s to %s can not be defined", A_surfxml_ASroute_src, A_surfxml_ASroute_dst); src = A_surfxml_ASroute_src; dst = A_surfxml_ASroute_dst; @@ -378,7 +378,7 @@ static void parse_S_ASroute_new_and_endpoints(void) static void parse_S_bypassRoute_new_and_endpoints(void) { if (src != NULL && dst != NULL && link_list != NULL) - THROW2(arg_error, 0, + THROWF(arg_error, 0, "Bypass Route between %s to %s can not be defined", A_surfxml_bypassRoute_src, A_surfxml_bypassRoute_dst); src = A_surfxml_bypassRoute_src; @@ -550,7 +550,7 @@ static void parse_S_AS(char *AS_id, char *AS_routing) (*(current_routing->routing->unload)) (); } else { - THROW0(arg_error, 0, "All defined components must be belong to a AS"); + THROWF(arg_error, 0, "All defined components must be belong to a AS"); } /* set the new parse rules */ (*(new_routing->routing->load)) (); @@ -593,7 +593,7 @@ static void parse_E_AS(const char *AS_id) { if (current_routing == NULL) { - THROW1(arg_error, 0, "Close AS(%s), that never open", 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), @@ -2672,7 +2672,7 @@ static route_extended_t rulebased_get_route(routing_component_t rc, if (link) xbt_dynar_push(links_list, &link); else - THROW1(mismatch_error, 0, "Link %s not found", new_link_name); + THROWF(mismatch_error, 0, "Link %s not found", new_link_name); xbt_free(new_link_name); } } @@ -3147,7 +3147,7 @@ generic_new_route(e_surf_routing_hierarchy_t hierarchy, else xbt_dynar_unshift(links_id, &link); } else - THROW1(mismatch_error, 0, "Link %s not found", link_name); + THROWF(mismatch_error, 0, "Link %s not found", link_name); } return new_route; @@ -3203,7 +3203,7 @@ generic_new_extended_route(e_surf_routing_hierarchy_t hierarchy, else xbt_dynar_unshift(links_id, &link); } else - THROW1(mismatch_error, 0, "Link %s not found", link_name); + THROWF(mismatch_error, 0, "Link %s not found", link_name); } return new_e_route; @@ -3944,12 +3944,12 @@ static void routing_parse_Srandom(void) /* Check user stupidities */ if (max < min) - THROW2(arg_error, 0, "random->max < random->min (%f < %f)", max, min); + THROWF(arg_error, 0, "random->max < random->min (%f < %f)", max, min); if (mean < min) - THROW2(arg_error, 0, "random->mean < random->min (%f < %f)", mean, + THROWF(arg_error, 0, "random->mean < random->min (%f < %f)", mean, min); if (mean > max) - THROW2(arg_error, 0, "random->mean > random->max (%f > %f)", mean, + THROWF(arg_error, 0, "random->mean > random->max (%f > %f)", mean, max); /* normalize the mean and standard deviation before storing */ @@ -3957,7 +3957,7 @@ static void routing_parse_Srandom(void) random->std = std / (max - min); if (random->mean * (1 - random->mean) < random->std * random->std) - THROW2(arg_error, 0, "Invalid mean and standard deviation (%f and %f)", + THROWF(arg_error, 0, "Invalid mean and standard deviation (%f and %f)", random->mean, random->std); XBT_DEBUG("id = '%s' min = '%f' max = '%f' mean = '%f' std_deviatinon = '%f' generator = '%d' seed = '%ld' radical = '%s'", diff --git a/src/xbt/backtrace_linux.c b/src/xbt/backtrace_linux.c index 1c6b5bca01..9cfea876db 100644 --- a/src/xbt/backtrace_linux.c +++ b/src/xbt/backtrace_linux.c @@ -153,13 +153,13 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) XBT_DEBUG("Looking for symbol %d, addr = '%s'", i, addrs[i]); fgets_res = fgets(line_func, 1024, pipe); if (fgets_res == NULL) - THROW2(system_error, 0, + THROWF(system_error, 0, "Cannot run fgets to look for symbol %d, addr %s", i, addrs[i]); line_func[strlen(line_func) - 1] = '\0'; fgets_res = fgets(line_pos, 1024, pipe); if (fgets_res == NULL) - THROW2(system_error, 0, + THROWF(system_error, 0, "Cannot run fgets to look for symbol %d, addr %s", i, addrs[i]); line_pos[strlen(line_pos) - 1] = '\0'; @@ -261,12 +261,12 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) } fgets_res = fgets(line_func, 1024, subpipe); if (fgets_res == NULL) - THROW1(system_error, 0, "Cannot read result of subcommand %s", + THROWF(system_error, 0, "Cannot read result of subcommand %s", subcmd); line_func[strlen(line_func) - 1] = '\0'; fgets_res = fgets(line_pos, 1024, subpipe); if (fgets_res == NULL) - THROW1(system_error, 0, "Cannot read result of subcommand %s", + THROWF(system_error, 0, "Cannot read result of subcommand %s", subcmd); line_pos[strlen(line_pos) - 1] = '\0'; pclose(subpipe); diff --git a/src/xbt/config.c b/src/xbt/config.c index fc93278e78..4ec5c93461 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -433,7 +433,7 @@ void xbt_cfg_check(xbt_cfg_t cfg) size = xbt_dynar_length(variable->content); if (variable->min > size) { xbt_dict_cursor_free(&cursor); - THROW4(mismatch_error, 0, + THROWF(mismatch_error, 0, "Config elem %s needs at least %d %s, but there is only %d values.", name, variable->min, xbt_cfgelm_type_name[variable->type], size); @@ -441,7 +441,7 @@ void xbt_cfg_check(xbt_cfg_t cfg) if (variable->max > 0 && variable->max < size) { xbt_dict_cursor_free(&cursor); - THROW4(mismatch_error, 0, + THROWF(mismatch_error, 0, "Config elem %s accepts at most %d %s, but there is %d values.", name, variable->max, xbt_cfgelm_type_name[variable->type], size); @@ -460,7 +460,7 @@ static xbt_cfgelm_t xbt_cfgelm_get(xbt_cfg_t cfg, res = xbt_dict_get_or_null((xbt_dict_t) cfg, name); if (!res) { xbt_cfg_help(cfg); - THROW1(not_found_error, 0, + THROWF(not_found_error, 0, "No registered variable '%s' in this config set", name); } @@ -487,7 +487,7 @@ e_xbt_cfgelm_type_t xbt_cfg_get_type(xbt_cfg_t cfg, const char *name) variable = xbt_dict_get_or_null((xbt_dict_t) cfg, name); if (!variable) - THROW1(not_found_error, 0, + THROWF(not_found_error, 0, "Can't get the type of '%s' since this variable does not exist", name); @@ -519,7 +519,7 @@ void xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa) } CATCH(e) { if (e.category == not_found_error) { xbt_ex_free(e); - THROW1(not_found_error, 0, + THROWF(not_found_error, 0, "Can't set the property '%s' since it's not registered", name); } @@ -675,7 +675,7 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) free(optionlist_cpy); if (e.category == not_found_error) { xbt_ex_free(e); - THROW1(not_found_error, 0, + THROWF(not_found_error, 0, "No registered variable corresponding to '%s'.", name); } RETHROW; @@ -728,7 +728,7 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) break; default: - THROW1(unknown_error, 0, "Type of config element %s is not valid.", + THROWF(unknown_error, 0, "Type of config element %s is not valid.", name); } } @@ -841,7 +841,7 @@ void xbt_cfg_set_int(xbt_cfg_t cfg, const char *name, int val) if (variable->max && xbt_dynar_length(variable->content) == (unsigned long) variable->max) - THROW3(mismatch_error, 0, + THROWF(mismatch_error, 0, "Cannot add value %d to the config element %s since it's already full (size=%d)", val, name, variable->max); @@ -875,7 +875,7 @@ void xbt_cfg_set_double(xbt_cfg_t cfg, const char *name, double val) } else { if (variable->max && xbt_dynar_length(variable->content) == variable->max) - THROW3(mismatch_error, 0, + THROWF(mismatch_error, 0, "Cannot add value %f to the config element %s since it's already full (size=%d)", val, name, variable->max); @@ -920,7 +920,7 @@ void xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, const char *val) } else { if (variable->max && xbt_dynar_length(variable->content) == variable->max) - THROW3(mismatch_error, 0, + THROWF(mismatch_error, 0, "Cannot add value %s to the config element %s since it's already full (size=%d)", name, val, variable->max); @@ -961,7 +961,7 @@ xbt_cfg_set_peer(xbt_cfg_t cfg, const char *name, const char *peer, } else { if (variable->max && xbt_dynar_length(variable->content) == variable->max) - THROW4(mismatch_error, 0, + THROWF(mismatch_error, 0, "Cannot add value %s:%d to the config element %s since it's already full (size=%d)", peer, port, name, variable->max); @@ -991,7 +991,7 @@ void xbt_cfg_rm_int(xbt_cfg_t cfg, const char *name, int val) variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int); if (xbt_dynar_length(variable->content) == variable->min) - THROW3(mismatch_error, 0, + THROWF(mismatch_error, 0, "Cannot remove value %d from the config element %s since it's already at its minimal size (=%d)", val, name, variable->min); @@ -1004,7 +1004,7 @@ void xbt_cfg_rm_int(xbt_cfg_t cfg, const char *name, int val) } } - THROW2(not_found_error, 0, + THROWF(not_found_error, 0, "Can't remove the value %d of config element %s: value not found.", val, name); } @@ -1025,7 +1025,7 @@ void xbt_cfg_rm_double(xbt_cfg_t cfg, const char *name, double val) variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double); if (xbt_dynar_length(variable->content) == variable->min) - THROW3(mismatch_error, 0, + THROWF(mismatch_error, 0, "Cannot remove value %f from the config element %s since it's already at its minimal size (=%d)", val, name, variable->min); @@ -1038,7 +1038,7 @@ void xbt_cfg_rm_double(xbt_cfg_t cfg, const char *name, double val) } } - THROW2(not_found_error, 0, + THROWF(not_found_error, 0, "Can't remove the value %f of config element %s: value not found.", val, name); } @@ -1058,7 +1058,7 @@ void xbt_cfg_rm_string(xbt_cfg_t cfg, const char *name, const char *val) variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string); if (xbt_dynar_length(variable->content) == variable->min) - THROW3(mismatch_error, 0, + THROWF(mismatch_error, 0, "Cannot remove value %s from the config element %s since it's already at its minimal size (=%d)", name, val, variable->min); @@ -1071,7 +1071,7 @@ void xbt_cfg_rm_string(xbt_cfg_t cfg, const char *name, const char *val) } } - THROW2(not_found_error, 0, + THROWF(not_found_error, 0, "Can't remove the value %s of config element %s: value not found.", val, name); } @@ -1095,7 +1095,7 @@ xbt_cfg_rm_peer(xbt_cfg_t cfg, const char *name, const char *peer, variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_peer); if (xbt_dynar_length(variable->content) == variable->min) - THROW4(mismatch_error, 0, + THROWF(mismatch_error, 0, "Cannot remove value %s:%d from the config element %s since it's already at its minimal size (=%d)", peer, port, name, variable->min); @@ -1108,7 +1108,7 @@ xbt_cfg_rm_peer(xbt_cfg_t cfg, const char *name, const char *peer, } } - THROW3(not_found_error, 0, + THROWF(not_found_error, 0, "Can't remove the value %s:%d of config element %s: value not found.", peer, port, name); } @@ -1123,7 +1123,7 @@ void xbt_cfg_rm_at(xbt_cfg_t cfg, const char *name, int pos) variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_any); if (xbt_dynar_length(variable->content) == variable->min) - THROW3(mismatch_error, 0, + THROWF(mismatch_error, 0, "Cannot remove %dth value from the config element %s since it's already at its minimal size (=%d)", pos, name, variable->min); @@ -1150,7 +1150,7 @@ void xbt_cfg_empty(xbt_cfg_t cfg, const char *name) RETHROW; xbt_ex_free(e); - THROW1(not_found_error, 0, + THROWF(not_found_error, 0, "Can't empty '%s' since this config element does not exist", name); } @@ -1309,7 +1309,7 @@ xbt_dynar_t xbt_cfg_get_dynar(xbt_cfg_t cfg, const char *name) } CATCH(e) { if (e.category == not_found_error) { xbt_ex_free(e); - THROW1(not_found_error, 0, + THROWF(not_found_error, 0, "No registered variable %s in this config set", name); } RETHROW; diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 7f1c91a3c3..19dd281fb1 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -323,7 +323,7 @@ XBT_INLINE void *xbt_dict_get_ext(xbt_dict_t dict, const char *key, } if (current == NULL) - THROW2(not_found_error, 0, "key %.*s not found", key_len, key); + THROWF(not_found_error, 0, "key %.*s not found", key_len, key); return current->content; } @@ -401,7 +401,7 @@ XBT_INLINE void *xbt_dict_get(xbt_dict_t dict, const char *key) current = current->next; if (current == NULL) - THROW1(not_found_error, 0, "key %s not found", key); + THROWF(not_found_error, 0, "key %s not found", key); return current->content; } @@ -457,7 +457,7 @@ XBT_INLINE void xbt_dict_remove_ext(xbt_dict_t dict, const char *key, } if (current == NULL) - THROW2(not_found_error, 0, "key %.*s not found", key_len, key); + THROWF(not_found_error, 0, "key %.*s not found", key_len, key); if (previous != NULL) { previous->next = current->next; @@ -591,7 +591,7 @@ XBT_INLINE void xbt_dicti_remove(xbt_dict_t dict, uintptr_t key) } if (current == NULL) - THROW1(not_found_error, 0, "key %zu not found", key); + THROWF(not_found_error, 0, "key %zu not found", key); if (previous != NULL) { previous->next = current->next; @@ -939,7 +939,7 @@ static void search_not_found(xbt_dict_t head, const char *data) TRY { data = xbt_dict_get(head, data); - THROW1(unknown_error, 0, + THROWF(unknown_error, 0, "Found something which shouldn't be there (%s)", data); } CATCH(e) { if (e.category != not_found_error) diff --git a/src/xbt/dynar.c b/src/xbt/dynar.c index 21254064eb..4b69794ffa 100644 --- a/src/xbt/dynar.c +++ b/src/xbt/dynar.c @@ -47,7 +47,7 @@ static XBT_INLINE void _check_inbound_idx(xbt_dynar_t dynar, int idx) { if (idx < 0 || idx >= dynar->used) { _dynar_unlock(dynar); - THROW2(bound_error, idx, + THROWF(bound_error, idx, "dynar is not that long. You asked %d, but it's only %lu long", (int) (idx), (unsigned long) dynar->used); } @@ -58,7 +58,7 @@ static XBT_INLINE void _check_sloppy_inbound_idx(xbt_dynar_t dynar, { if (idx > dynar->used) { _dynar_unlock(dynar); - THROW2(bound_error, idx, + THROWF(bound_error, idx, "dynar is not that long. You asked %d, but it's only %lu long (could have been equal to it)", (int) (idx), (unsigned long) dynar->used); } @@ -68,7 +68,7 @@ static XBT_INLINE void _check_populated_dynar(xbt_dynar_t dynar) { if (dynar->used == 0) { _dynar_unlock(dynar); - THROW1(bound_error, 0, "dynar %p is empty", dynar); + THROWF(bound_error, 0, "dynar %p is empty", dynar); } } @@ -571,7 +571,7 @@ unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void *const elem) } _dynar_unlock(dynar); - THROW2(not_found_error, 0, "Element %p not part of dynar %p", elem, + THROWF(not_found_error, 0, "Element %p not part of dynar %p", elem, dynar); } diff --git a/src/xbt/ex.c b/src/xbt/ex.c index ade191bd8b..5087b0c92f 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -251,7 +251,7 @@ XBT_TEST_UNIT("controlflow", test_controlflow, "basic nested control flow") if (n != 2) xbt_test_fail("M2: n=%d (!= 2)", n); n++; - THROW0(unknown_error, 0, "something"); + THROWF(unknown_error, 0, "something"); } CATCH(ex) { if (n != 3) @@ -264,7 +264,7 @@ XBT_TEST_UNIT("controlflow", test_controlflow, "basic nested control flow") if (n != 5) xbt_test_fail("M2: n=%d (!= 5)", n); n++; - THROW0(unknown_error, 0, "something"); + THROWF(unknown_error, 0, "something"); } CATCH(ex) { if (n != 6) @@ -290,7 +290,7 @@ XBT_TEST_UNIT("value", test_value, "exception value passing") xbt_ex_t ex; TRY { - THROW0(unknown_error, 2, "toto"); + THROWF(unknown_error, 2, "toto"); } CATCH(ex) { xbt_test_add("exception value passing"); @@ -314,7 +314,7 @@ XBT_TEST_UNIT("variables", test_variables, "variable value preservation") TRY { r2 = 5678; v2 = 5678; - THROW0(unknown_error, 0, "toto"); + THROWF(unknown_error, 0, "toto"); } CATCH(ex) { xbt_test_add("variable preservation"); if (r1 != 1234) @@ -340,7 +340,7 @@ XBT_TEST_UNIT("cleanup", test_cleanup, "cleanup handling") c = 0; TRY { v1 = 5678; - THROW0(1, 2, "blah"); + THROWF(1, 2, "blah"); } TRY_CLEANUP { if (v1 != 5678) xbt_test_fail("v1 = %d (!= 5678)", v1); diff --git a/src/xbt/graph.c b/src/xbt/graph.c index 8fdec17743..a71e447536 100644 --- a/src/xbt/graph.c +++ b/src/xbt/graph.c @@ -528,7 +528,7 @@ void xbt_graph_depth_visit(xbt_graph_t g, xbt_node_t n, if (*((int *) (n->xbtdata)) == ALREADY_EXPLORED) return; else if (*((int *) (n->xbtdata)) == CURRENTLY_EXPLORING) - THROW0(0, 0, "There is a cycle"); + THROWF(0, 0, "There is a cycle"); else { *((int *) (n->xbtdata)) = CURRENTLY_EXPLORING; diff --git a/src/xbt/log.c b/src/xbt/log.c index dab6fd5084..8ce7c5dbdd 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -882,7 +882,7 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string) if (i < xbt_log_priority_infinite) { set->thresh = (e_xbt_log_priority_t) i; } else { - THROW1(arg_error, 0, + THROWF(arg_error, 0, "Unknown priority name: %s (must be one of: trace,debug,verbose,info,warning,error,critical)", eq + 1); } @@ -913,7 +913,7 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string) if (!strncmp(neweq, "file:", 5)) { set->appender = xbt_log_appender_file_new(neweq + 5); } else { - THROW1(arg_error, 0, "Unknown appender log type: '%s'", neweq); + THROWF(arg_error, 0, "Unknown appender log type: '%s'", neweq); } free(neweq); } else if (!strncmp(dot + 1, "fmt", (size_t) (eq - dot - 1))) { @@ -921,7 +921,7 @@ static xbt_log_setting_t _xbt_log_parse_setting(const char *control_string) } else { char buff[512]; snprintf(buff, min(512, eq - dot), "%s", dot + 1); - THROW1(arg_error, 0, "Unknown setting of the log category: '%s'", + THROWF(arg_error, 0, "Unknown setting of the log category: '%s'", buff); } set->catname = (char *) xbt_malloc(dot - name + 1); diff --git a/src/xbt/set.c b/src/xbt/set.c index 2577b2537d..daaafc9a17 100644 --- a/src/xbt/set.c +++ b/src/xbt/set.c @@ -229,7 +229,7 @@ xbt_set_elm_t xbt_set_get_by_id(xbt_set_t set, int id) res = xbt_dynar_get_as(set->dynar, id, xbt_set_elm_t); if (res == NULL) { - THROW1(not_found_error, 0, "Invalid id: %d", id); + THROWF(not_found_error, 0, "Invalid id: %d", id); } XBT_DEBUG("Lookup type of id %d (of %lu): %s", id, xbt_dynar_length(set->dynar), res->name); @@ -383,10 +383,10 @@ static void search_name(xbt_set_t head, const char *key) xbt_test_log(" Found %s (under ID %d)\n", elm ? elm->data : "(null)", elm ? elm->ID : -1); if (strcmp(key, elm->name)) - THROW2(mismatch_error, 0, "The key (%s) is not the one expected (%s)", + THROWF(mismatch_error, 0, "The key (%s) is not the one expected (%s)", key, elm->name); if (strcmp(elm->name, elm->data)) - THROW2(mismatch_error, 0, "The name (%s) != data (%s)", key, + THROWF(mismatch_error, 0, "The name (%s) != data (%s)", key, elm->name); fflush(stdout); } @@ -400,13 +400,13 @@ static void search_id(xbt_set_t head, int id, const char *key) xbt_test_log("Found %s (data %s)", elm ? elm->name : "(null)", elm ? elm->data : "(null)"); if (id != elm->ID) - THROW2(mismatch_error, 0, + THROWF(mismatch_error, 0, "The found ID (%d) is not the one expected (%d)", elm->ID, id); if (strcmp(key, elm->name)) - THROW2(mismatch_error, 0, "The key (%s) is not the one expected (%s)", + THROWF(mismatch_error, 0, "The key (%s) is not the one expected (%s)", elm->name, key); if (strcmp(elm->name, elm->data)) - THROW2(mismatch_error, 0, "The name (%s) != data (%s)", + THROWF(mismatch_error, 0, "The name (%s) != data (%s)", elm->name, elm->data); } @@ -432,7 +432,7 @@ static void search_not_found(xbt_set_t set, const char *data) xbt_test_add("Search %s (expected not to be found)", data); TRY { xbt_set_get_by_name(set, data); - THROW1(unknown_error, 0, + THROWF(unknown_error, 0, "Found something which shouldn't be there (%s)", data); } CATCH(e) { if (e.category != not_found_error) diff --git a/src/xbt/xbt_os_thread.c b/src/xbt/xbt_os_thread.c index 2cd9d8751d..2efd81eb2d 100644 --- a/src/xbt/xbt_os_thread.c +++ b/src/xbt/xbt_os_thread.c @@ -88,7 +88,7 @@ void xbt_os_thread_mod_preinit(void) return; if ((errcode = pthread_key_create(&xbt_self_thread_key, NULL))) - THROW0(system_error, errcode, + THROWF(system_error, errcode, "pthread_key_create failed for xbt_self_thread_key"); main_thread = xbt_new(s_xbt_os_thread_t, 1); @@ -99,7 +99,7 @@ void xbt_os_thread_mod_preinit(void) XBT_RUNNING_CTX_INITIALIZE(main_thread->running_ctx); if ((errcode = pthread_setspecific(xbt_self_thread_key, main_thread))) - THROW0(system_error, errcode, + THROWF(system_error, errcode, "pthread_setspecific failed for xbt_self_thread_key"); @@ -121,7 +121,7 @@ void xbt_os_thread_mod_postexit(void) // int errcode; // if ((errcode=pthread_key_delete(xbt_self_thread_key))) - // THROW0(system_error,errcode,"pthread_key_delete failed for xbt_self_thread_key"); + // THROWF(system_error,errcode,"pthread_key_delete failed for xbt_self_thread_key"); free(main_thread->running_ctx); free(main_thread); main_thread = NULL; @@ -147,7 +147,7 @@ static void *wrapper_start_routine(void *s) int errcode; if ((errcode = pthread_setspecific(xbt_self_thread_key, t))) - THROW0(system_error, errcode, + THROWF(system_error, errcode, "pthread_setspecific failed for xbt_self_thread_key"); void *res = (*(t->start_routine)) (t->param); @@ -174,7 +174,7 @@ xbt_os_thread_t xbt_os_thread_create(const char *name, if ((errcode = pthread_create(&(res_thread->t), NULL, wrapper_start_routine, res_thread))) - THROW1(system_error, errcode, + THROWF(system_error, errcode, "pthread_create failed: %s", strerror(errcode)); return res_thread; @@ -197,7 +197,7 @@ void xbt_os_thread_join(xbt_os_thread_t thread, void **thread_return) int errcode; if ((errcode = pthread_join(thread->t, thread_return))) - THROW1(system_error, errcode, "pthread_join failed: %s", + THROWF(system_error, errcode, "pthread_join failed: %s", strerror(errcode)); xbt_os_thread_free_thread_data(thread); } @@ -251,7 +251,7 @@ xbt_os_mutex_t xbt_os_mutex_init(void) int errcode; if ((errcode = pthread_mutex_init(&(res->m), NULL))) - THROW1(system_error, errcode, "pthread_mutex_init() failed: %s", + THROWF(system_error, errcode, "pthread_mutex_init() failed: %s", strerror(errcode)); return res; @@ -262,7 +262,7 @@ void xbt_os_mutex_acquire(xbt_os_mutex_t mutex) int errcode; if ((errcode = pthread_mutex_lock(&(mutex->m)))) - THROW2(system_error, errcode, "pthread_mutex_lock(%p) failed: %s", + THROWF(system_error, errcode, "pthread_mutex_lock(%p) failed: %s", mutex, strerror(errcode)); } @@ -281,9 +281,9 @@ void xbt_os_mutex_timedacquire(xbt_os_mutex_t mutex, double delay) case 0: return; case ETIMEDOUT: - THROW1(timeout_error, 0, "mutex %p not ready", mutex); + THROWF(timeout_error, 0, "mutex %p not ready", mutex); default: - THROW2(system_error, errcode, + THROWF(system_error, errcode, "xbt_mutex_timedacquire(%p) failed: %s", mutex, strerror(errcode)); } @@ -319,11 +319,11 @@ void xbt_os_mutex_timedacquire(xbt_os_mutex_t mutex, double delay) return; case ETIMEDOUT: - THROW2(timeout_error, delay, + THROWF(timeout_error, delay, "mutex %p wasn't signaled before timeout (%f)", mutex, delay); default: - THROW3(system_error, errcode, + THROWF(system_error, errcode, "pthread_mutex_timedlock(%p,%f) failed: %s", mutex, delay, strerror(errcode)); } @@ -335,7 +335,7 @@ void xbt_os_mutex_release(xbt_os_mutex_t mutex) int errcode; if ((errcode = pthread_mutex_unlock(&(mutex->m)))) - THROW2(system_error, errcode, "pthread_mutex_unlock(%p) failed: %s", + THROWF(system_error, errcode, "pthread_mutex_unlock(%p) failed: %s", mutex, strerror(errcode)); } @@ -347,7 +347,7 @@ void xbt_os_mutex_destroy(xbt_os_mutex_t mutex) return; if ((errcode = pthread_mutex_destroy(&(mutex->m)))) - THROW2(system_error, errcode, "pthread_mutex_destroy(%p) failed: %s", + THROWF(system_error, errcode, "pthread_mutex_destroy(%p) failed: %s", mutex, strerror(errcode)); free(mutex); } @@ -363,7 +363,7 @@ xbt_os_cond_t xbt_os_cond_init(void) xbt_os_cond_t res = xbt_new(s_xbt_os_cond_t, 1); int errcode; if ((errcode = pthread_cond_init(&(res->c), NULL))) - THROW1(system_error, errcode, "pthread_cond_init() failed: %s", + THROWF(system_error, errcode, "pthread_cond_init() failed: %s", strerror(errcode)); return res; @@ -373,7 +373,7 @@ void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex) { int errcode; if ((errcode = pthread_cond_wait(&(cond->c), &(mutex->m)))) - THROW3(system_error, errcode, "pthread_cond_wait(%p,%p) failed: %s", + THROWF(system_error, errcode, "pthread_cond_wait(%p,%p) failed: %s", cond, mutex, strerror(errcode)); } @@ -397,11 +397,11 @@ void xbt_os_cond_timedwait(xbt_os_cond_t cond, xbt_os_mutex_t mutex, case 0: return; case ETIMEDOUT: - THROW3(timeout_error, errcode, + THROWF(timeout_error, errcode, "condition %p (mutex %p) wasn't signaled before timeout (%f)", cond, mutex, delay); default: - THROW4(system_error, errcode, + THROWF(system_error, errcode, "pthread_cond_timedwait(%p,%p,%f) failed: %s", cond, mutex, delay, strerror(errcode)); } @@ -412,7 +412,7 @@ void xbt_os_cond_signal(xbt_os_cond_t cond) { int errcode; if ((errcode = pthread_cond_signal(&(cond->c)))) - THROW2(system_error, errcode, "pthread_cond_signal(%p) failed: %s", + THROWF(system_error, errcode, "pthread_cond_signal(%p) failed: %s", cond, strerror(errcode)); } @@ -420,7 +420,7 @@ void xbt_os_cond_broadcast(xbt_os_cond_t cond) { int errcode; if ((errcode = pthread_cond_broadcast(&(cond->c)))) - THROW2(system_error, errcode, "pthread_cond_broadcast(%p) failed: %s", + THROWF(system_error, errcode, "pthread_cond_broadcast(%p) failed: %s", cond, strerror(errcode)); } @@ -432,7 +432,7 @@ void xbt_os_cond_destroy(xbt_os_cond_t cond) return; if ((errcode = pthread_cond_destroy(&(cond->c)))) - THROW2(system_error, errcode, "pthread_cond_destroy(%p) failed: %s", + THROWF(system_error, errcode, "pthread_cond_destroy(%p) failed: %s", cond, strerror(errcode)); free(cond); } @@ -465,7 +465,7 @@ xbt_os_sem_t xbt_os_sem_init(unsigned int value) */ #ifdef HAVE_SEM_INIT if (sem_init(&(res->s), 0, value) != 0) - THROW1(system_error, errno, "sem_init() failed: %s", strerror(errno)); + THROWF(system_error, errno, "sem_init() failed: %s", strerror(errno)); res->ps = &(res->s); #else /* damn, no sem_init(). Reimplement it */ @@ -481,11 +481,11 @@ xbt_os_sem_t xbt_os_sem_init(unsigned int value) res->ps = sem_open(res->name, O_CREAT, 0644, 1); } if ((res->ps == (sem_t *) SEM_FAILED)) - THROW1(system_error, errno, "sem_open() failed: %s", strerror(errno)); + THROWF(system_error, errno, "sem_open() failed: %s", strerror(errno)); /* Remove the name from the semaphore namespace: we never join on it */ if (sem_unlink(res->name) < 0) - THROW1(system_error, errno, "sem_unlink() failed: %s", + THROWF(system_error, errno, "sem_unlink() failed: %s", strerror(errno)); #endif @@ -496,9 +496,9 @@ xbt_os_sem_t xbt_os_sem_init(unsigned int value) void xbt_os_sem_acquire(xbt_os_sem_t sem) { if (!sem) - THROW0(arg_error, EINVAL, "Cannot acquire of the NULL semaphore"); + THROWF(arg_error, EINVAL, "Cannot acquire of the NULL semaphore"); if (sem_wait(sem->ps) < 0) - THROW1(system_error, errno, "sem_wait() failed: %s", strerror(errno)); + THROWF(system_error, errno, "sem_wait() failed: %s", strerror(errno)); } void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double delay) @@ -506,7 +506,7 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double delay) int errcode; if (!sem) - THROW0(arg_error, EINVAL, "Cannot acquire of the NULL semaphore"); + THROWF(arg_error, EINVAL, "Cannot acquire of the NULL semaphore"); if (delay < 0) { xbt_os_sem_acquire(sem); @@ -517,9 +517,9 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double delay) case 0: return; case ETIMEDOUT: - THROW1(timeout_error, 0, "semaphore %p not ready", sem); + THROWF(timeout_error, 0, "semaphore %p not ready", sem); default: - THROW2(system_error, errcode, + THROWF(system_error, errcode, "xbt_os_sem_timedacquire(%p) failed: %s", sem, strerror(errcode)); } @@ -551,12 +551,12 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double delay) return; case ETIMEDOUT: - THROW2(timeout_error, delay, + THROWF(timeout_error, delay, "semaphore %p wasn't signaled before timeout (%f)", sem, delay); default: - THROW3(system_error, errcode, "sem_timedwait(%p,%f) failed: %s", sem, + THROWF(system_error, errcode, "sem_timedwait(%p,%f) failed: %s", sem, delay, strerror(errcode)); } } @@ -565,24 +565,24 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double delay) void xbt_os_sem_release(xbt_os_sem_t sem) { if (!sem) - THROW0(arg_error, EINVAL, "Cannot release of the NULL semaphore"); + THROWF(arg_error, EINVAL, "Cannot release of the NULL semaphore"); if (sem_post(sem->ps) < 0) - THROW1(system_error, errno, "sem_post() failed: %s", strerror(errno)); + THROWF(system_error, errno, "sem_post() failed: %s", strerror(errno)); } void xbt_os_sem_destroy(xbt_os_sem_t sem) { if (!sem) - THROW0(arg_error, EINVAL, "Cannot destroy the NULL sempahore"); + THROWF(arg_error, EINVAL, "Cannot destroy the NULL sempahore"); #ifdef HAVE_SEM_INIT if (sem_destroy(sem->ps) < 0) - THROW1(system_error, errno, "sem_destroy() failed: %s", + THROWF(system_error, errno, "sem_destroy() failed: %s", strerror(errno)); #else if (sem_close(sem->ps) < 0) - THROW1(system_error, errno, "sem_close() failed: %s", strerror(errno)); + THROWF(system_error, errno, "sem_close() failed: %s", strerror(errno)); xbt_free(sem->name); #endif @@ -592,11 +592,11 @@ void xbt_os_sem_destroy(xbt_os_sem_t sem) void xbt_os_sem_get_value(xbt_os_sem_t sem, int *svalue) { if (!sem) - THROW0(arg_error, EINVAL, + THROWF(arg_error, EINVAL, "Cannot get the value of the NULL semaphore"); if (sem_getvalue(&(sem->s), svalue) < 0) - THROW1(system_error, errno, "sem_getvalue() failed: %s", + THROWF(system_error, errno, "sem_getvalue() failed: %s", strerror(errno)); } @@ -635,7 +635,7 @@ void xbt_os_thread_mod_postexit(void) { if (!TlsFree(xbt_self_thread_key)) - THROW0(system_error, (int) GetLastError(), + THROWF(system_error, (int) GetLastError(), "TlsFree() failed to cleanup the thread submodule"); } @@ -651,7 +651,7 @@ static DWORD WINAPI wrapper_start_routine(void *s) DWORD *rv; if (!TlsSetValue(xbt_self_thread_key, t)) - THROW0(system_error, (int) GetLastError(), + THROWF(system_error, (int) GetLastError(), "TlsSetValue of data describing the created thread failed"); rv = (DWORD *) ((t->start_routine) (t->param)); @@ -679,7 +679,7 @@ xbt_os_thread_t xbt_os_thread_create(const char *name, if (!t->handle) { xbt_free(t); - THROW0(system_error, (int) GetLastError(), "CreateThread failed"); + THROWF(system_error, (int) GetLastError(), "CreateThread failed"); } return t; @@ -700,13 +700,13 @@ void xbt_os_thread_join(xbt_os_thread_t thread, void **thread_return) { if (WAIT_OBJECT_0 != WaitForSingleObject(thread->handle, INFINITE)) - THROW0(system_error, (int) GetLastError(), + THROWF(system_error, (int) GetLastError(), "WaitForSingleObject failed"); if (thread_return) { if (!GetExitCodeThread(thread->handle, (DWORD *) (*thread_return))) - THROW0(system_error, (int) GetLastError(), + THROWF(system_error, (int) GetLastError(), "GetExitCodeThread failed"); } @@ -752,7 +752,7 @@ void xbt_os_thread_yield(void) void xbt_os_thread_cancel(xbt_os_thread_t t) { if (!TerminateThread(t->handle, 0)) - THROW0(system_error, (int) GetLastError(), "TerminateThread failed"); + THROWF(system_error, (int) GetLastError(), "TerminateThread failed"); } /****** mutex related functions ******/ @@ -831,7 +831,7 @@ xbt_os_cond_t xbt_os_cond_init(void) if (!res->events[SIGNAL]) { DeleteCriticalSection(&res->waiters_count_lock); free(res); - THROW0(system_error, 0, "CreateEvent failed for the signals"); + THROWF(system_error, 0, "CreateEvent failed for the signals"); } /* Create a manual-reset event. */ @@ -842,7 +842,7 @@ xbt_os_cond_t xbt_os_cond_init(void) DeleteCriticalSection(&res->waiters_count_lock); CloseHandle(res->events[SIGNAL]); free(res); - THROW0(system_error, 0, "CreateEvent failed for the broadcasts"); + THROWF(system_error, 0, "CreateEvent failed for the broadcasts"); } return res; @@ -866,7 +866,7 @@ void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex) wait_result = WaitForMultipleObjects(2, cond->events, FALSE, INFINITE); if (wait_result == WAIT_FAILED) - THROW0(system_error, 0, + THROWF(system_error, 0, "WaitForMultipleObjects failed, so we cannot wait on the condition"); /* we have a signal lock the condition */ @@ -885,7 +885,7 @@ void xbt_os_cond_wait(xbt_os_cond_t cond, xbt_os_mutex_t mutex) */ if (is_last_waiter) if (!ResetEvent(cond->events[BROADCAST])) - THROW0(system_error, 0, "ResetEvent failed"); + THROWF(system_error, 0, "ResetEvent failed"); /* relock the mutex associated with the condition in accordance with the posix thread specification */ EnterCriticalSection(&mutex->lock); @@ -919,11 +919,11 @@ void xbt_os_cond_timedwait(xbt_os_cond_t cond, xbt_os_mutex_t mutex, switch (wait_result) { case WAIT_TIMEOUT: - THROW3(timeout_error, GetLastError(), + THROWF(timeout_error, GetLastError(), "condition %p (mutex %p) wasn't signaled before timeout (%f)", cond, mutex, delay); case WAIT_FAILED: - THROW0(system_error, GetLastError(), + THROWF(system_error, GetLastError(), "WaitForMultipleObjects failed, so we cannot wait on the condition"); } @@ -943,7 +943,7 @@ void xbt_os_cond_timedwait(xbt_os_cond_t cond, xbt_os_mutex_t mutex, */ if (is_last_waiter) if (!ResetEvent(cond->events[BROADCAST])) - THROW0(system_error, 0, "ResetEvent failed"); + THROWF(system_error, 0, "ResetEvent failed"); /* relock the mutex associated with the condition in accordance with the posix thread specification */ EnterCriticalSection(&mutex->lock); @@ -961,7 +961,7 @@ void xbt_os_cond_signal(xbt_os_cond_t cond) if (have_waiters) if (!SetEvent(cond->events[SIGNAL])) - THROW0(system_error, 0, "SetEvent failed"); + THROWF(system_error, 0, "SetEvent failed"); xbt_os_thread_yield(); } @@ -996,7 +996,7 @@ void xbt_os_cond_destroy(xbt_os_cond_t cond) xbt_free(cond); if (error) - THROW0(system_error, 0, "Error while destroying the condition"); + THROWF(system_error, 0, "Error while destroying the condition"); } typedef struct xbt_os_sem_ { @@ -1014,14 +1014,14 @@ xbt_os_sem_t xbt_os_sem_init(unsigned int value) xbt_os_sem_t res; if (value > INT_MAX) - THROW1(arg_error, value, + THROWF(arg_error, value, "Semaphore initial value too big: %ud cannot be stored as a signed int", value); res = (xbt_os_sem_t) xbt_new0(s_xbt_os_sem_t, 1); if (!(res->h = CreateSemaphore(NULL, value, (long) INT_MAX, NULL))) { - THROW1(system_error, GetLastError(), "CreateSemaphore() failed: %s", + THROWF(system_error, GetLastError(), "CreateSemaphore() failed: %s", strerror(GetLastError())); return NULL; } @@ -1036,11 +1036,11 @@ xbt_os_sem_t xbt_os_sem_init(unsigned int value) void xbt_os_sem_acquire(xbt_os_sem_t sem) { if (!sem) - THROW0(arg_error, EINVAL, "Cannot acquire the NULL semaphore"); + THROWF(arg_error, EINVAL, "Cannot acquire the NULL semaphore"); /* wait failure */ if (WAIT_OBJECT_0 != WaitForSingleObject(sem->h, INFINITE)) - THROW1(system_error, GetLastError(), + THROWF(system_error, GetLastError(), "WaitForSingleObject() failed: %s", strerror(GetLastError())); EnterCriticalSection(&(sem->value_lock)); sem->value--; @@ -1054,7 +1054,7 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double timeout) double end = timeout + xbt_os_time(); if (!sem) - THROW0(arg_error, EINVAL, "Cannot acquire the NULL semaphore"); + THROWF(arg_error, EINVAL, "Cannot acquire the NULL semaphore"); if (timeout < 0) { xbt_os_sem_acquire(sem); @@ -1073,13 +1073,13 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double timeout) return; case WAIT_TIMEOUT: - THROW2(timeout_error, GetLastError(), + THROWF(timeout_error, GetLastError(), "semaphore %p wasn't signaled before timeout (%f)", sem, timeout); return; default: - THROW3(system_error, GetLastError(), + THROWF(system_error, GetLastError(), "WaitForSingleObject(%p,%f) failed: %s", sem, timeout, strerror(GetLastError())); } @@ -1089,10 +1089,10 @@ void xbt_os_sem_timedacquire(xbt_os_sem_t sem, double timeout) void xbt_os_sem_release(xbt_os_sem_t sem) { if (!sem) - THROW0(arg_error, EINVAL, "Cannot release the NULL semaphore"); + THROWF(arg_error, EINVAL, "Cannot release the NULL semaphore"); if (!ReleaseSemaphore(sem->h, 1, NULL)) - THROW1(system_error, GetLastError(), "ReleaseSemaphore() failed: %s", + THROWF(system_error, GetLastError(), "ReleaseSemaphore() failed: %s", strerror(GetLastError())); EnterCriticalSection(&(sem->value_lock)); sem->value++; @@ -1102,10 +1102,10 @@ void xbt_os_sem_release(xbt_os_sem_t sem) void xbt_os_sem_destroy(xbt_os_sem_t sem) { if (!sem) - THROW0(arg_error, EINVAL, "Cannot destroy the NULL semaphore"); + THROWF(arg_error, EINVAL, "Cannot destroy the NULL semaphore"); if (!CloseHandle(sem->h)) - THROW1(system_error, GetLastError(), "CloseHandle() failed: %s", + THROWF(system_error, GetLastError(), "CloseHandle() failed: %s", strerror(GetLastError())); DeleteCriticalSection(&(sem->value_lock)); @@ -1117,7 +1117,7 @@ void xbt_os_sem_destroy(xbt_os_sem_t sem) void xbt_os_sem_get_value(xbt_os_sem_t sem, int *svalue) { if (!sem) - THROW0(arg_error, EINVAL, + THROWF(arg_error, EINVAL, "Cannot get the value of the NULL semaphore"); EnterCriticalSection(&(sem->value_lock)); diff --git a/src/xbt/xbt_queue.c b/src/xbt/xbt_queue.c index ee9df908bd..ad6027b2a0 100644 --- a/src/xbt/xbt_queue.c +++ b/src/xbt/xbt_queue.c @@ -168,7 +168,7 @@ void xbt_queue_push_timed(xbt_queue_t queue, const void *src, double delay) queue->capacity == xbt_dynar_length(queue->data)) { xbt_mutex_release(queue->mutex); - THROW2(timeout_error, 0, + THROWF(timeout_error, 0, "Capacity of %p exceded (=%d), and delay = 0", queue, queue->capacity); } @@ -211,7 +211,7 @@ void xbt_queue_pop_timed(xbt_queue_t queue, void *const dst, double delay) if (delay == 0) { if (xbt_dynar_length(queue->data) == 0) { xbt_mutex_release(queue->mutex); - THROW0(timeout_error, 0, "Delay = 0, and queue is empty"); + THROWF(timeout_error, 0, "Delay = 0, and queue is empty"); } } else { while ((xbt_dynar_length(queue->data) == 0) && @@ -250,7 +250,7 @@ void xbt_queue_unshift_timed(xbt_queue_t queue, const void *src, queue->capacity == xbt_dynar_length(queue->data)) { xbt_mutex_release(queue->mutex); - THROW2(timeout_error, 0, + THROWF(timeout_error, 0, "Capacity of %p exceded (=%d), and delay = 0", queue, queue->capacity); } @@ -294,7 +294,7 @@ void xbt_queue_shift_timed(xbt_queue_t queue, void *const dst, if (delay == 0) { if (xbt_dynar_length(queue->data) == 0) { xbt_mutex_release(queue->mutex); - THROW0(timeout_error, 0, "Delay = 0, and queue is empty"); + THROWF(timeout_error, 0, "Delay = 0, and queue is empty"); } } else { while ((xbt_dynar_length(queue->data) == 0) && @@ -313,7 +313,7 @@ void xbt_queue_shift_timed(xbt_queue_t queue, void *const dst, if (xbt_dynar_length(queue->data) == 0) { xbt_mutex_release(queue->mutex); - THROW1(timeout_error, 0, "Timeout (%f) elapsed, but queue still empty", + THROWF(timeout_error, 0, "Timeout (%f) elapsed, but queue still empty", delay); } diff --git a/src/xbt/xbt_str.c b/src/xbt/xbt_str.c index 83fb7b1de9..9ec3dde089 100644 --- a/src/xbt/xbt_str.c +++ b/src/xbt/xbt_str.c @@ -350,7 +350,7 @@ xbt_dynar_t xbt_str_split_quoted_in_place(char *s) { /* Protected char; move it closer */ memmove(end, end + 1, strlen(end)); if (*end == '\0') - THROW0(arg_error, 0, "String ends with \\"); + THROWF(arg_error, 0, "String ends with \\"); end++; /* Pass the protected char */ break; @@ -380,7 +380,7 @@ xbt_dynar_t xbt_str_split_quoted_in_place(char *s) { case '\n': case '\0': if (*end == '\0' && (in_simple_quote || in_double_quote)) { - THROW2(arg_error, 0, + THROWF(arg_error, 0, "End of string found while searching for %c in %s", (in_simple_quote ? '\'' : '"'), s); } @@ -720,7 +720,7 @@ static void diff_build_diff(xbt_dynar_t res, } else if (i <= 0 && j <= 0) { return; } else { - THROW2(arg_error, 0, "Invalid values: i=%d, j=%d", i, j); + THROWF(arg_error, 0, "Invalid values: i=%d, j=%d", i, j); } } diff --git a/src/xbt/xbt_strbuff.c b/src/xbt/xbt_strbuff.c index 269f8c1678..6f470ed7cc 100644 --- a/src/xbt/xbt_strbuff.c +++ b/src/xbt/xbt_strbuff.c @@ -73,7 +73,7 @@ void xbt_strbuff_append(xbt_strbuff_t b, const char *toadd) int needed_space; if (!b) - THROW0(arg_error, 0, "Asked to append stuff to NULL buffer"); + THROWF(arg_error, 0, "Asked to append stuff to NULL buffer"); addlen = strlen(toadd); needed_space = b->used + addlen + 1; @@ -133,7 +133,7 @@ void xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns) /* Protected char; pass the protection */ end++; if (*end == '\0') - THROW0(arg_error, 0, "String ends with \\"); + THROWF(arg_error, 0, "String ends with \\"); break; case '\'': @@ -173,7 +173,7 @@ void xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns) while (*p != '\0' && *p != '}') p++; if (*p == '\0') - THROW0(arg_error, 0, + THROWF(arg_error, 0, "Variable default value not terminated ('}' missing)"); default_value = xbt_malloc(p - end_var - 1); @@ -187,14 +187,14 @@ void xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns) end_var++; } if (*end_var == '\0') - THROW0(arg_error, 0, + THROWF(arg_error, 0, "Variable name not terminated ('}' missing)"); if (!end_subst) /* already set if there's a default value */ end_subst = end_var + 1; /* also kill the } in the name */ if (end_var == beg_var) - THROW0(arg_error, 0, "Variable name empty (${} is not valid)"); + THROWF(arg_error, 0, "Variable name empty (${} is not valid)"); } else { @@ -206,7 +206,7 @@ void xbt_strbuff_varsubst(xbt_strbuff_t b, xbt_dict_t patterns) end_var++; end_subst = end_var; if (end_var == beg_var) - THROW0(arg_error, 0, "Variable name empty ($ is not valid)"); + THROWF(arg_error, 0, "Variable name empty ($ is not valid)"); } /* XBT_DEBUG("var='%.*s'; subst='%.*s'; End_var = '%s'", end_var-beg_var,beg_var, diff --git a/teshsuite/gras/msg_handle/msg_handle.c b/teshsuite/gras/msg_handle/msg_handle.c index 903b18aa48..5c4325a385 100644 --- a/teshsuite/gras/msg_handle/msg_handle.c +++ b/teshsuite/gras/msg_handle/msg_handle.c @@ -47,13 +47,13 @@ int server(int argc, char *argv[]) TRY { me = gras_socket_server(myport); } CATCH(e) { - RETHROW0("Unable to establish a server socket: %s"); + RETHROWF("Unable to establish a server socket: %s"); } gras_os_sleep(1); /* Wait for pal to startup */ TRY { pal = gras_socket_client_from_string(palstr); } CATCH(e) { - RETHROW1("Unable to establish a socket to %s: %s", palstr); + RETHROWF("Unable to establish a socket to %s: %s", palstr); } XBT_INFO("Initialization done."); now = gras_os_time(); @@ -67,7 +67,7 @@ int server(int argc, char *argv[]) got_expected = 1; xbt_ex_free(e); } else { - RETHROW0("Didn't got the expected timeout: %s"); + RETHROWF("Didn't got the expected timeout: %s"); } } xbt_assert0(got_expected, @@ -86,7 +86,7 @@ int server(int argc, char *argv[]) got_expected = 1; xbt_ex_free(e); } else { - RETHROW0("Didn't got the expected timeout: %s"); + RETHROWF("Didn't got the expected timeout: %s"); } } xbt_assert0(got_expected, @@ -133,13 +133,13 @@ int client(int argc, char *argv[]) TRY { me = gras_socket_server(myport); } CATCH(e) { - RETHROW0("Unable to establish a server socket: %s"); + RETHROWF("Unable to establish a server socket: %s"); } gras_os_sleep(1); /* Wait for pal to startup */ TRY { pal = gras_socket_client_from_string(palstr); } CATCH(e) { - RETHROW1("Unable to establish a socket to %s: %s", palstr); + RETHROWF("Unable to establish a socket to %s: %s", palstr); } XBT_INFO("Initialization done."); @@ -148,7 +148,7 @@ int client(int argc, char *argv[]) TRY { gras_msg_handle(-1); } CATCH(e) { - RETHROW0("No exception expected during handle(-1), but got %s"); + RETHROWF("No exception expected during handle(-1), but got %s"); } XBT_INFO("gras_msg_handle(-1) works as expected (locked)"); diff --git a/tools/tesh/run_context.c b/tools/tesh/run_context.c index d0a6b1026e..60b38bf0e1 100644 --- a/tools/tesh/run_context.c +++ b/tools/tesh/run_context.c @@ -470,13 +470,13 @@ static void rctx_mkfile(void) xbt_str_trim(filename, NULL); OUT = fopen(filename, "w"); if (!OUT) { - THROW3(system_error, errno, "%s: Cannot create file %s: %s", + THROWF(system_error, errno, "%s: Cannot create file %s: %s", rctx->filepos, filename, strerror(errno)); } err = (fprintf(OUT, "%s", rctx->input->data) < 0); err = (fclose(OUT) == -1) || err; if (err) { - THROW3(system_error, errno, "%s: Cannot write file %s: %s", + THROWF(system_error, errno, "%s: Cannot write file %s: %s", rctx->filepos, filename, strerror(errno)); } free(filename); @@ -677,7 +677,7 @@ void *rctx_wait(void *r) rctx_dump(rctx, "wait"); if (!rctx->is_stoppable) - THROW1(unknown_error, 0, "Cmd '%s' not started yet. Cannot wait it", + THROWF(unknown_error, 0, "Cmd '%s' not started yet. Cannot wait it", rctx->cmd); /* Wait for the child to die or the timeout to happen (or an armageddon to happen) */ -- 2.20.1