// std::call_once from libc++ is used on all Unix platforms. Other
// implementations like libstdc++ are known to have problems on NetBSD,
// OpenBSD and PowerPC. #if defined(LLVM_ON_UNIX) && (defined(_LIBCPP_VERSION) ||
\
!(defined(__NetBSD__) || defined(__OpenBSD__) || defined(__ppc__))) #define LLVM_THREADING_USE_STD_CALL_ONCE 1 #else #define LLVM_THREADING_USE_STD_CALL_ONCE 0 #endif
This check defined(LLVM_ON_UNIX) looks wrong it assumes that Windows
needs call_once walkaround.
Being that this was over 2 years ago, I suspect it was when we were supporting MSVC2012 and 2013. Now that we’re requiring MSVC2015, is it time to reconsider? I don’t see any links to an MS Connect issue, so I don’t know what the original bug was to know if it has been fixed.
It was forgotten - I wanted to use consistently llvm:: namespace for
these functions across the LLDB codebase, especially since duplicated
code can be refactored to be shared and it would silently break in the
std:: version.
I think we can. MSVC’s std::once_flag default constructor is constexpr now. It still generates dynamic initialization code if you use it as a static local, but MSVC defaults to using thread safe static initialization, so that isn’t a problem unless you disable it, which we don’t. We disable it in compiler-rt (/Zc:threadSafeInit-), but that doesn’t use this code.
Should we do that now, as a way to fix this issue, or should we try to get another fix in first so we have more time to think about using std call_once?