Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move datadesc and TCP sockets from GRAS to XBT.
[simgrid.git] / teshsuite / gras / msg_handle / msg_handle.c
index 2ded662..675cb00 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id: mmrpc.c 3399 2007-04-11 19:34:43Z cherierm $ */
-
 /* msg_handle - ensures the semantic of gras_msg_handle(i) for i<0,=0 or >0 */
 
 /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
@@ -25,13 +23,13 @@ static int server_cb_hello_handler(gras_msg_cb_ctx_t ctx,
 
 int server(int argc, char *argv[])
 {
-  gras_socket_t me = NULL, pal = NULL;
+  volatile xbt_socket_t me = NULL, pal = NULL;
   int myport;
   char *palstr;
 
   xbt_ex_t e;
-  int got_expected;
-  double now;
+  _XBT_GNUC_UNUSED int got_expected;
+  _XBT_GNUC_UNUSED double now;
 
 
   gras_init(&argc, argv);
@@ -46,13 +44,15 @@ int server(int argc, char *argv[])
   XBT_INFO("Launch server (port=%d)", myport);
   TRY {
     me = gras_socket_server(myport);
-  } CATCH(e) {
+  }
+  CATCH_ANONYMOUS {
     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) {
+  }
+  CATCH_ANONYMOUS {
     RETHROWF("Unable to establish a socket to %s: %s", palstr);
   }
   XBT_INFO("Initialization done.");
@@ -62,7 +62,8 @@ int server(int argc, char *argv[])
   got_expected = 0;
   TRY {
     gras_msg_handle(0);
-  } CATCH(e) {
+  }
+  CATCH(e) {
     if (e.category == timeout_error) {
       got_expected = 1;
       xbt_ex_free(e);
@@ -113,10 +114,9 @@ int server(int argc, char *argv[])
 
 int client(int argc, char *argv[])
 {
-  gras_socket_t me = NULL, pal = NULL;
+  volatile xbt_socket_t me = NULL, pal = NULL;
   int myport;
   char *palstr;
-  xbt_ex_t e;
 
   gras_init(&argc, argv);
   xbt_assert(argc == 3, "Usage: client <myport> <server>");
@@ -129,13 +129,15 @@ int client(int argc, char *argv[])
   XBT_INFO("Launch client (port=%d)", myport);
   TRY {
     me = gras_socket_server(myport);
-  } CATCH(e) {
+  }
+  CATCH_ANONYMOUS {
     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) {
+  }
+  CATCH_ANONYMOUS {
     RETHROWF("Unable to establish a socket to %s: %s", palstr);
   }
   XBT_INFO("Initialization done.");
@@ -143,7 +145,8 @@ int client(int argc, char *argv[])
   /* Launch handle(-1). Lock until message from server expected */
   TRY {
     gras_msg_handle(-1);
-  } CATCH(e) {
+  }
+  CATCH_ANONYMOUS {
     RETHROWF("No exception expected during handle(-1), but got %s");
   }
   XBT_INFO("gras_msg_handle(-1) works as expected (locked)");