Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Let the xbt_log module register its finalizer itself
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 21 Feb 2023 15:00:06 +0000 (16:00 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 21 Feb 2023 15:00:31 +0000 (16:00 +0100)
And kill an internal header file that is now empty

MANIFEST.in
src/kernel/EngineImpl.cpp
src/kernel/context/ContextThread.cpp
src/xbt/dict.cpp
src/xbt/log.cpp
src/xbt/xbt_main.cpp
src/xbt/xbt_modinter.h [deleted file]
tools/cmake/DefinePackages.cmake

index c920f5d..89864b3 100644 (file)
@@ -2492,7 +2492,6 @@ include src/xbt/xbt_log_appender_file.cpp
 include src/xbt/xbt_log_layout_format.cpp
 include src/xbt/xbt_log_layout_simple.cpp
 include src/xbt/xbt_main.cpp
-include src/xbt/xbt_modinter.h
 include src/xbt/xbt_os_file.cpp
 include src/xbt/xbt_os_time.c
 include src/xbt/xbt_parse_units.cpp
index 518361d..6b2da71 100644 (file)
@@ -19,7 +19,6 @@
 #include "src/simgrid/math_utils.h"
 #include "src/simgrid/sg_config.hpp"
 #include "src/smpi/include/smpi_actor.hpp"
-#include "src/xbt/xbt_modinter.h" /* whether initialization was already done */
 
 #include "xbt/log.hpp"
 
@@ -142,12 +141,6 @@ static void install_signal_handlers()
 
 static simgrid::config::Flag<bool> cfg_dbg_clean_atexit{
     "debug/clean-atexit", "Whether to cleanup SimGrid at exit. Disable it if your code segfaults after its end.", true};
-static void xbt_postexit()
-{
-  if (not cfg_dbg_clean_atexit)
-    return;
-  xbt_log_postexit();
-}
 
 namespace simgrid::kernel {
 
@@ -188,7 +181,6 @@ void EngineImpl::initialize(int* argc, char** argv)
   static bool inited = false;
   if (not inited) {
     inited = true;
-    atexit(xbt_postexit);
     xbt_log_init(argc, argv);
 
     simgrid::xbt::install_exception_handler();
index 68bb417..40efb6b 100644 (file)
@@ -8,7 +8,6 @@
 #include "simgrid/Exception.hpp"
 #include "src/internal_config.h" /* loads context system definitions */
 #include "src/kernel/EngineImpl.hpp"
-#include "src/xbt/xbt_modinter.h" /* prototype of os thread module's init/exit in XBT */
 #include "xbt/function_types.h"
 
 #include <boost/core/demangle.hpp>
index 614d6b7..bbc4599 100644 (file)
@@ -8,7 +8,6 @@
 #include "xbt/dict.h"
 #include "dict_private.h"
 #include "simgrid/Exception.hpp"
-#include "src/xbt/xbt_modinter.h"
 #include "xbt/ex.h"
 #include "xbt/log.h"
 #include "xbt/mallocator.h"
index e9c6542..78fd4d5 100644 (file)
@@ -6,7 +6,6 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/xbt/log_private.hpp"
-#include "src/xbt/xbt_modinter.h"
 #include "xbt/string.hpp"
 #include "xbt/sysdep.h"
 
@@ -56,6 +55,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(log, xbt, "Loggings from the logging mechanism i
 
 static void xbt_log_help();
 static void xbt_log_help_categories();
+static void xbt_log_postexit();
 
 void xbt_log_init(int *argc, char **argv)
 {
@@ -64,6 +64,7 @@ void xbt_log_init(int *argc, char **argv)
   int parse_args          = 1; // Stop parsing the parameters once we found '--'
 
   xbt_log_control_set("xbt_help.app:stdout xbt_help.threshold:VERBOSE xbt_help.fmt:%m%n");
+  atexit(xbt_log_postexit);
 
   /* Set logs and init log submodule */
   for (int i = 1; i < *argc; i++) {
@@ -114,7 +115,7 @@ static void log_cat_exit(const s_xbt_log_category_t* cat)
     log_cat_exit(child);
 }
 
-void xbt_log_postexit(void)
+static void xbt_log_postexit(void)
 {
   XBT_VERB("Exiting log");
   log_cat_exit(&_XBT_LOGV(XBT_LOG_ROOT_CAT));
index 48e5edf..8c9b9c7 100644 (file)
@@ -12,7 +12,6 @@
 #include "src/simgrid/sg_config.hpp"
 #include "src/sthread/sthread.h" // sthread_inside_simgrid
 #include "src/xbt/coverage.h"
-#include "src/xbt/xbt_modinter.h" /* prototype of other module's init/exit in XBT */
 #include "xbt/config.hpp"
 #include "xbt/dynar.h"
 #include "xbt/log.h"
diff --git a/src/xbt/xbt_modinter.h b/src/xbt/xbt_modinter.h
deleted file mode 100644 (file)
index b715ae3..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* xbt_modinter - How to init/exit the XBT modules                          */
-
-/* Copyright (c) 2004-2023. The SimGrid Team. All rights reserved.          */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef XBT_MODINTER_H
-#define XBT_MODINTER_H
-#include "xbt/misc.h"
-
-SG_BEGIN_DECL
-
-/* Modules definitions */
-
-void xbt_log_postexit(void);
-
-SG_END_DECL
-
-#endif
index 874ea7d..9776b8c 100644 (file)
@@ -56,7 +56,6 @@ set(EXTRA_DIST
   src/xbt/log_private.hpp
   src/xbt/mallocator_private.h
   src/xbt/parmap.hpp
-  src/xbt/xbt_modinter.h
   
   src/xbt/mmalloc/mmalloc.h
   src/xbt/mmalloc/mfree.c