Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use existing XBT macro to declare enum class Simcall.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 8 Mar 2022 14:32:29 +0000 (15:32 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 8 Mar 2022 14:32:29 +0000 (15:32 +0100)
src/simix/popping.cpp
src/simix/popping_private.hpp

index 74bf611..135fdcc 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(simix, "transmuting from user request into kernel handlers");
 
-constexpr std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names{{
-    "Simcall::NONE",
-    "Simcall::RUN_ANSWERED",
-    "Simcall::RUN_BLOCKING",
-}};
-
 /** @private
  * @brief (in kernel mode) unpack the simcall and activate the handler
  *
@@ -49,6 +43,6 @@ const char* SIMIX_simcall_name(const s_smx_simcall& simcall)
       cname += 17; // strip prefix "simgrid::kernel::"
     return cname;
   } else {
-    return simcall_names.at(static_cast<int>(simcall.call_));
+    return to_c_str(simcall.call_);
   }
 }
index 308d3f3..3e574c9 100644 (file)
 namespace simgrid {
 namespace simix {
 /** All possible simcalls. */
-enum class Simcall {
-  NONE,
-  RUN_ANSWERED,
-  RUN_BLOCKING,
-};
-constexpr int NUM_SIMCALLS = 3;
+XBT_DECLARE_ENUM_CLASS(Simcall, NONE, RUN_ANSWERED, RUN_BLOCKING);
 } // namespace simix
 } // namespace simgrid