Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Deprecate functions MSG_global_init() / MSG_global_init_args() in flavor of MSG_init()
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 21 Jun 2012 09:19:32 +0000 (11:19 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 21 Jun 2012 09:19:43 +0000 (11:19 +0200)
44 files changed:
ChangeLog
examples/msg/actions/actions.c
examples/msg/chord/chord.c
examples/msg/cloud/masterslave_virtual_machines.c
examples/msg/gpu/test_MSG_gpu_task_create.c
examples/msg/gtnets/gtnets.c
examples/msg/icomms/peer.c
examples/msg/icomms/peer2.c
examples/msg/icomms/peer3.c
examples/msg/io/file.c
examples/msg/masterslave/masterslave_arg.c
examples/msg/masterslave/masterslave_bypass.c
examples/msg/masterslave/masterslave_cluster.c
examples/msg/masterslave/masterslave_console.c
examples/msg/masterslave/masterslave_failure.c
examples/msg/masterslave/masterslave_forwarder.c
examples/msg/masterslave/masterslave_kill.c
examples/msg/masterslave/masterslave_mailbox.c
examples/msg/migration/migration.c
examples/msg/parallel_task/parallel_task.c
examples/msg/parallel_task/test_ptask.c
examples/msg/pmm/msg_pmm.c
examples/msg/priority/priority.c
examples/msg/properties/msg_prop.c
examples/msg/sendrecv/sendrecv.c
examples/msg/start_kill_time/sk_time.c
examples/msg/suspend/suspend.c
examples/msg/token_ring/ring_call.c
examples/msg/tracing/categories.c
examples/msg/tracing/link_srcdst_user_variables.c
examples/msg/tracing/link_user_variables.c
examples/msg/tracing/ms.c
examples/msg/tracing/procmig.c
examples/msg/tracing/simple.c
examples/msg/tracing/trace_platform.c
examples/msg/tracing/user_variables.c
include/msg/msg.h
include/simgrid_config.h.in
src/bindings/lua/simgrid_lua.c
src/msg/msg_global.c
teshsuite/msg/get_sender.c
teshsuite/msg/trace/test_trace_integration.c
teshsuite/simdag/platforms/basic_tracing.c
tools/graphicator/graphicator.c

index ff535f7..3b5d1c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,10 @@ SimGrid (3.8) NOT RELEASED; urgency=low
    process groups with very few intrinsic semantic, but they should
    allow you to build the semantic you want easily.
  * New function: MSG_host_set_property_value()
+ * Deprecate functions MSG_global_init() / MSG_global_init_args()
+   Please use MSG_init() instead. (reducing the amount of entry 
+   points in the library helps us).
+ * Make it impossible to link against the wrong version of the lib
 
  Simix:
  * Bug fixes around the resource failures: don't let the processes
index 6d73615..4454147 100644 (file)
@@ -549,7 +549,7 @@ int main(int argc, char *argv[])
   MSG_error_t res = MSG_OK;
 
   /* Check the given arguments */
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file [action_files]\n",
            argv[0]);
index d9f9995..40e941f 100644 (file)
@@ -884,7 +884,7 @@ static void random_lookup(node_t node)
  */
 int main(int argc, char *argv[])
 {
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s [-nb_bits=n] [-timeout=t] platform_file deployment_file\n", argv[0]);
     printf("example: %s ../msg_platform.xml chord.xml\n", argv[0]);
index 2ed5704..1bc53a2 100644 (file)
@@ -176,7 +176,7 @@ int main(int argc, char *argv[])
   int i;
 
   /* Get the arguments */
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 2) {
     printf("Usage: %s platform_file\n", argv[0]);
     printf("example: %s msg_platform.xml\n", argv[0]);
index a490f15..9d176fd 100644 (file)
@@ -24,7 +24,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
 
   m_gpu_task_t mytask = NULL;
 
index aab840b..8d889c6 100644 (file)
@@ -231,7 +231,7 @@ int main(int argc, char *argv[])
   MSG_error_t res = MSG_OK;
   bool_printed = 0;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     exit(1);
index 9f882a4..445a700 100644 (file)
@@ -171,7 +171,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
index 651e3db..8d59024 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
index 128d01f..17ba947 100644 (file)
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
index ed8e91a..e8830de 100644 (file)
@@ -71,8 +71,8 @@ int host(int argc, char *argv[])
 
 int main(int argc, char **argv)
 {
-    int i,res;
-  MSG_global_init(&argc, argv);
+  int i,res;
+  MSG_init(&argc, argv);
   MSG_create_environment(argv[1]);
   xbt_dynar_t hosts =  MSG_hosts_as_dynar();
   MSG_function_register("host", host);
index 58c7d7b..4fd570a 100644 (file)
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
   MSG_error_t res = MSG_OK;
   long i;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 4) {
     printf("Usage: %s platform_file number_of_jobs number_of_slaves\n", argv[0]);
     printf("example: %s msg_platform.xml 10 5\n", argv[0]);
index 3b4f97c..62a86bd 100644 (file)
@@ -281,7 +281,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   res = test_all();
   MSG_clean();
 
index e45876f..6d78433 100644 (file)
@@ -218,7 +218,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   res = test_all(argv[1]);
   MSG_clean();
 
index 0b54bfa..6a1aec9 100644 (file)
@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 2) {
     printf("Usage: %s platform_script[.lua]\n", argv[0]);
     printf("example: %s platform_script.lua\n", argv[0]);
index 39e7d7e..c567f4c 100644 (file)
@@ -203,7 +203,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
index 3e3560e..e0bfee0 100644 (file)
@@ -207,7 +207,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
index 7baf1e6..ae4a14d 100644 (file)
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
     XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
index 1273e90..3543f23 100644 (file)
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
   const char *platform_file;
   const char *application_file;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
index 898ac25..eb3c78a 100644 (file)
@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
   MSG_error_t res = MSG_OK;
 
   /* Argument checking */
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
     XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
index 7811e91..8a72806 100644 (file)
@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 2) {
     printf("Usage: %s platform_file\n", argv[0]);
     printf("example: %s msg_platform.xml\n", argv[0]);
index 4417558..07c340f 100644 (file)
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     exit(1);
index 243657d..6ff6d1a 100644 (file)
@@ -260,7 +260,7 @@ int main(int argc, char *argv[])
   xbt_os_timer_t timer = xbt_os_timer_new();
 #endif
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
 
   char **options = &argv[1];
   const char* platform_file = options[0];
index 02f0758..8690ec5 100644 (file)
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
 #endif
 
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
index 63f1e5f..1889aa6 100644 (file)
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     printf("example: %s msg_platform.xml msg_deployment.xml\n", argv[0]);
index a59aa54..1e2dc06 100644 (file)
@@ -165,7 +165,7 @@ int main(int argc, char *argv[])
       _set_output_format(_TWO_DIGIT_EXPONENT);
 #endif
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
 
 
   if (argc != 3) {
index 255e18d..1b293b3 100644 (file)
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
     XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
index a60c03f..1c794a5 100644 (file)
@@ -68,7 +68,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
     XBT_CRITICAL("example: %s msg_platform.xml msg_deployment_suspend.xml\n",
index 3de124d..243445c 100644 (file)
@@ -63,7 +63,7 @@ int host(int argc, char *argv[])
 int main(int argc, char **argv)
 {
   int i,res;
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   MSG_create_environment(argv[1]);
   xbt_dynar_t hosts = MSG_hosts_as_dynar();
   nb_hosts =  xbt_dynar_length(hosts);
index 3451219..d85e651 100644 (file)
@@ -88,7 +88,7 @@ int slave(int argc, char *argv[])
 /** Main function */
 int main(int argc, char *argv[])
 {
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     exit(1);
index 15d6eb3..912697a 100644 (file)
@@ -75,7 +75,7 @@ int master(int argc, char *argv[])
 /** Main function */
 int main(int argc, char *argv[])
 {
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     exit(1);
index 7cdcbf4..5e255ea 100644 (file)
@@ -67,7 +67,7 @@ int master(int argc, char *argv[])
 /** Main function */
 int main(int argc, char *argv[])
 {
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     exit(1);
index d15b876..6d82eb4 100644 (file)
@@ -99,7 +99,7 @@ int slave(int argc, char *argv[])
 /** Main function */
 int main(int argc, char *argv[])
 {
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     exit(1);
index 26a7eff..2666d84 100644 (file)
@@ -80,7 +80,7 @@ static int master(int argc, char *argv[])
 int main(int argc, char *argv[])
 {
   /* Argument checking */
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
     exit(1);
index 00f428a..5842689 100644 (file)
@@ -38,7 +38,7 @@ int simple_func(int argc, char *argv[])
 /** Main function */
 int main(int argc, char *argv[])
 {
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     exit(1);
index ffcfaa1..685a8bf 100644 (file)
@@ -26,7 +26,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example")
 /** Main function */
 int main(int argc, char *argv[])
 {
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 2) {
     printf("Usage: %s platform_file\n", argv[0]);
     exit(1);
index 6c63b9d..c2d7573 100644 (file)
@@ -59,7 +59,7 @@ int master(int argc, char *argv[])
 /** Main function */
 int main(int argc, char *argv[])
 {
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file\n", argv[0]);
     exit(1);
index 2fb6435..e62db85 100644 (file)
@@ -35,8 +35,28 @@ typedef enum {
 
 /************************** Global ******************************************/
 XBT_PUBLIC(void) MSG_config(const char *name, ...);
-XBT_PUBLIC(void) MSG_global_init(int *argc, char **argv);
-XBT_PUBLIC(void) MSG_global_init_args(int *argc, char **argv);
+/** \ingroup msg_simulation
+ *  \brief Initialize the MSG internal data.
+ *  \hideinitializer
+ *
+ *  It also check that the link-time and compile-time versions of SimGrid do
+ *  match, so you should use this version instead of the #MSG_init_nocheck
+ *  function that does the same initializations, but without this check.
+ *
+ *  We allow to link against compiled versions that differ in the patch level.
+ */
+#define MSG_init(argc,argv)  {                      \
+         int ver_major,ver_minor,ver_patch;              \
+         sg_version(&ver_major,&ver_minor,&ver_patch);   \
+         if ((ver_major != SIMGRID_VERSION_MAJOR) ||     \
+             (ver_minor != SIMGRID_VERSION_MINOR)) {     \
+           fprintf(stderr,"FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, and then linked against SimGrid %d.%d.%d. Please fix this.\n", \
+               SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH,ver_major,ver_minor,ver_patch);                          \
+         }                                               \
+         MSG_init_nocheck(argc,argv);                    \
+       }
+
+XBT_PUBLIC(void) MSG_init_nocheck(int *argc, char **argv);
 XBT_PUBLIC(MSG_error_t) MSG_main(void);
 XBT_PUBLIC(MSG_error_t) MSG_main_stateful(void);
 XBT_PUBLIC(MSG_error_t) MSG_main_liveness(xbt_automaton_t a);
@@ -246,6 +266,9 @@ XBT_PUBLIC(MSG_error_t)
 MSG_error_t MSG_action_trace_run(char *path);
 
 #ifdef MSG_USE_DEPRECATED
+#define MSG_global_init(argc, argv)      MSG_init(argc,argv)
+#define MSG_global_init_args(argc, argv) MSG_init(argc,argv)
+
 /* these are the functions which are deprecated. Do not use them, they may get removed in future releases */
 XBT_PUBLIC(int) MSG_get_host_number(void);
 XBT_PUBLIC(m_host_t *) MSG_get_host_table(void);
index a1b3414..a12421b 100644 (file)
@@ -33,20 +33,6 @@ SG_BEGIN_DECL()
     SIMGRID_VERSION_MAJOR and friends give the version numbers of the used header files */
 XBT_PUBLIC(void) sg_version(int *major,int *minor,int *patch);
 
-/** Check that the link-time and compile-time versions of SimGrid do match.
-  * There is no need to call it yourself, it's done automatically during the SimGrid initialization */
-#define sg_check_version() {                      \
-  int ver_major,ver_minor,ver_patch;              \
-  sg_version(&ver_major,&ver_minor,&ver_patch);   \
-  if ((ver_major != SIMGRID_VERSION_MAJOR) ||     \
-      (ver_minor != SIMGRID_VERSION_MINOR) ||     \
-      (ver_patch != SIMGRID_VERSION_PATCH)) {     \
-    fprintf(stderr,"FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, and then linked against SimGrid %d.%d.%d. Please fix this.\n", \
-        SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH,ver_major,ver_minor,ver_patch);                          \
-  }                                               \
-} 
-  
-
 /* take care of DLL usage madness */
 
 #ifdef _XBT_DLL_EXPORT
index 11e4bad..09d96d8 100644 (file)
@@ -318,7 +318,7 @@ int luaopen_simgrid(lua_State *L)
     argv[argc--] = NULL;
 
     /* Initialize the MSG core */
-    MSG_global_init(&argc, argv);
+    MSG_init(&argc, argv);
     MSG_process_set_data_cleanup((void_f_pvoid_t) lua_close);
     XBT_DEBUG("Still %d arguments on command line", argc); // FIXME: update the lua's arg table to reflect the changes from SimGrid
   }
index 555f8aa..243057c 100644 (file)
@@ -21,19 +21,12 @@ MSG_Global_t msg_global = NULL;
 
 /********************************* MSG **************************************/
 
-/** \ingroup msg_simulation
- * \brief Initialize some MSG internal data.
+/* @brief Initialize MSG with less verifications
+ *
+ * You should use the MSG_init() function instead. Failing to do so may turn into PEBKAC some day. You've been warned.
  */
-void MSG_global_init_args(int *argc, char **argv)
-{
-  MSG_global_init(argc, argv);
-}
+void MSG_init_nocheck(int *argc, char **argv) {
 
-/** \ingroup msg_simulation
- * \brief Initialize some MSG internal data.
- */
-void MSG_global_init(int *argc, char **argv)
-{
 #ifdef HAVE_TRACING
   TRACE_global_init(argc, argv);
 #endif
@@ -68,7 +61,6 @@ void MSG_global_init(int *argc, char **argv)
 
   XBT_DEBUG("ADD MSG LEVELS");
   MSG_HOST_LEVEL = xbt_lib_add_level(host_lib, (void_f_pvoid_t) __MSG_host_destroy);
-
 }
 
 #ifdef MSG_USE_DEPRECATED
index 6a766c5..705e9dc 100644 (file)
@@ -36,7 +36,7 @@ int main(int argc, char *argv[])
 {
   MSG_error_t res = MSG_OK;
 
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
 
   /*   Application deployment */
   MSG_function_register("send", &send);
index 9556b41..396dda2 100644 (file)
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
   MSG_error_t res = MSG_OK;
 
   /* Verify if the platform xml file was passed by command line. */
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 2) {
     printf("Usage: %s test_trace_integration_model.xml\n", argv[0]);
     exit(1);
index 293aa6e..7804aec 100644 (file)
@@ -25,7 +25,7 @@ int main(int argc, char **argv)
   int res;
   xbt_dynar_t all_hosts;
   m_host_t first_host;
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   MSG_create_environment(argv[1]);
   MSG_function_register("host", host);
   all_hosts = MSG_hosts_as_dynar();
index b418639..ae54a73 100644 (file)
@@ -18,7 +18,7 @@ int main(int argc, char **argv)
 {
   XBT_LOG_CONNECT(graphicator);
 #ifdef HAVE_TRACING
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
 
   if (argc < 3){
     XBT_INFO("Usage: %s <platform_file.xml> <graphviz_file.dot>", argv[0]);