#define SMPI_VARGET_GLOBAL(name) name[smpi_process_index()]
/* The following handle local static variables */
-
+/** @brief Make sure that the passed pointer is freed on process exit.
+ *
+ * This function is rather internal, mainly used for the
+ * privatization of global variables through coccinelle.
+ *
+ * Since its implementation relies on the on_exit() function that
+ * is not implemented on Mac, this function is a no-op on that
+ * architecture. But the only issue raised is that the memory is
+ * not raised right before the process terminaison. This is only
+ * important if you want to run valgrind on the code, or
+ * equivalent.
+ */
XBT_PUBLIC(void) smpi_register_static(void* arg);
#define SMPI_VARINIT_STATIC(name,type) \
}
void smpi_register_static(void* arg) {
-
#ifndef __APPLE__
-// FIXME
-// On Apple this error occurs:
-// Undefined symbols for architecture x86_64:
-// "_on_exit", referenced from:
-// _smpi_register_static in smpi_c99.c.o
+ // on_exit is not implemented on Apple.
+ // That's fine, the memory won't be released on UNIX process terminaison.
+ // This means that valgrind will report it as leaked (but who cares?)
on_exit(&smpi_free_static, arg);
#endif
}