Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove a useless lib constructor (simpler is better)
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 20 Feb 2023 09:00:22 +0000 (10:00 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 21 Feb 2023 14:16:28 +0000 (15:16 +0100)
src/xbt/xbt_main.cpp

index a985d2f..d8a906e 100644 (file)
@@ -48,11 +48,6 @@ simgrid::config::Flag<bool> cfg_dbg_clean_atexit{
 const int xbt_pagesize = static_cast<int>(sysconf(_SC_PAGESIZE));
 const int xbt_pagebits = static_cast<int>(log2(xbt_pagesize));
 
-/* Declare xbt_preinit and xbt_postexit as constructor/destructor of the library.
- * This is crude and rather compiler-specific, unfortunately.
- */
-static void xbt_preinit() XBT_ATTRIB_CONSTRUCTOR(200);
-static void xbt_postexit();
 XBT_ATTRIB_NOINLINE void sthread_enable()
 { // These symbols are used from ContextSwapped in any case, but they are only useful
   asm("");
@@ -62,11 +57,6 @@ XBT_ATTRIB_NOINLINE void sthread_disable()
   asm("");
 }
 
-static void xbt_preinit()
-{
-  atexit(xbt_postexit);
-}
-
 static void xbt_postexit()
 {
   if (not cfg_dbg_clean_atexit)
@@ -83,6 +73,7 @@ void xbt_init(int *argc, char **argv)
     XBT_DEBUG("XBT has been initialized %d times.", xbt_initialized);
     return;
   }
+  atexit(xbt_postexit);
 
   simgrid::xbt::install_exception_handler();