From 8bfb1e3d92b23469588bf9a6ff0e4e6b3f561097 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Mon, 3 Aug 2020 11:48:48 +1000 Subject: [PATCH] log: make once_flag constinit This ensures we'll error out at compile time rather than encounter a static initialisation ordering error. --- log/log.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/log/log.cpp b/log/log.cpp index b4e2096d..a61c5fe3 100644 --- a/log/log.cpp +++ b/log/log.cpp @@ -45,10 +45,8 @@ cruft::log::needs_break (level_t level) /////////////////////////////////////////////////////////////////////////////// -// mingw#xxx: MinGW doesn't have once_flag so we just use an atomic bool. -// Pray that multiple threads don't run into an issue here. -static std::once_flag s_sink_init; -static std::unique_ptr s_default_sink; +static constinit std::once_flag s_sink_init; +static constinit std::unique_ptr s_default_sink; //-----------------------------------------------------------------------------