瀏覽代碼

Fix warning with simgrid >= 3.26

Samuel Thibault 4 年之前
父節點
當前提交
85504e5f63
共有 3 個文件被更改,包括 25 次插入10 次删除
  1. 0 2
      src/common/thread.c
  2. 15 8
      src/core/simgrid.c
  3. 10 0
      src/core/simgrid.h

+ 0 - 2
src/common/thread.c

@@ -57,8 +57,6 @@ static int _starpu_futex_wake = FUTEX_WAKE;
 
 #ifdef STARPU_SIMGRID
 
-extern int _starpu_simgrid_thread_start(int argc, char *argv[]);
-
 int starpu_pthread_equal(starpu_pthread_t t1, starpu_pthread_t t2)
 {
 	return t1 == t2;

+ 15 - 8
src/core/simgrid.c

@@ -376,9 +376,8 @@ void _starpu_start_simgrid(int *argc, char **argv)
 	simgrid_transfer_cost = starpu_get_env_number_default("STARPU_SIMGRID_TRANSFER_COST", 1);
 }
 
-static int main_ret;
-
-int do_starpu_main(int argc, char *argv[])
+static int
+run_starpu_main(int argc, char *argv[])
 {
 	/* FIXME: Ugly work-around for bug in simgrid: the MPI context is not properly set at MSG process startup */
 	starpu_sleep(0.000001);
@@ -389,8 +388,16 @@ int do_starpu_main(int argc, char *argv[])
 		_STARPU_ERROR("In simgrid mode, the file containing the main() function of this application needs to be compiled with starpu.h or starpu_simgrid_wrap.h included, to properly rename it into starpu_main\n");
 	}
 
-	main_ret = starpu_main(argc, argv);
-	return main_ret;
+	return starpu_main(argc, argv);
+}
+
+static int main_ret;
+
+static _starpu_simgrid_main_ret
+do_starpu_main(int argc, char *argv[])
+{
+	main_ret = run_starpu_main(argc, argv);
+	_STARPU_SIMGRID_MAIN_RETURN;
 }
 
 /* We need it only when using smpi */
@@ -427,7 +434,7 @@ int main(int argc, char **argv)
          * constructor and MSG_process_attach, directly jump to real main */
 	if (simgrid_started == 3)
 	{
-		return do_starpu_main(argc, argv);
+		return run_starpu_main(argc, argv);
 	}
 
 	/* Managed to catch application's main, initialize simgrid first */
@@ -1205,7 +1212,7 @@ void _starpu_simgrid_sync_gpus(void)
 	_starpu_simgrid_wait_transfers();
 }
 
-int
+_starpu_simgrid_main_ret
 _starpu_simgrid_thread_start(int argc STARPU_ATTRIBUTE_UNUSED, char *argv[])
 {
 	void *(*f)(void*) = (void*) (uintptr_t) strtol(argv[0], NULL, 16);
@@ -1217,7 +1224,7 @@ _starpu_simgrid_thread_start(int argc STARPU_ATTRIBUTE_UNUSED, char *argv[])
 
 	/* _args is freed with process context */
 	f(arg);
-	return 0;
+	_STARPU_SIMGRID_MAIN_RETURN;
 }
 
 starpu_pthread_t _starpu_simgrid_actor_create(const char *name, xbt_main_func_t code, starpu_sg_host_t host, int argc, char *argv[])

+ 10 - 0
src/core/simgrid.h

@@ -55,6 +55,16 @@ struct _starpu_pthread_args
 	void *arg;
 };
 
+#if (SIMGRID_VERSION >= 32600)
+typedef void _starpu_simgrid_main_ret;
+#define _STARPU_SIMGRID_MAIN_RETURN do { } while (0)
+#else
+typedef int _starpu_simgrid_main_ret;
+#define _STARPU_SIMGRID_MAIN_RETURN return 0
+#endif
+_starpu_simgrid_main_ret
+_starpu_simgrid_thread_start(int argc, char *argv[]);
+
 #define MAX_TSD 16
 
 #define STARPU_MPI_AS_PREFIX "StarPU-MPI"