Author: manx
Date: Mon Mar 4 13:34:19 2024
New Revision: 20236
URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20236
Log:
[Ref] build: Makefile: Clang: Enable -Wexit-time-destructors.
Modified:
trunk/OpenMPT/build/make/warnings-clang.mk
trunk/OpenMPT/common/ComponentManager.h
trunk/OpenMPT/common/mptRandom.cpp
Modified: trunk/OpenMPT/build/make/warnings-clang.mk
==============================================================================
--- trunk/OpenMPT/build/make/warnings-clang.mk Mon Mar 4 11:30:58 2024 (r20235)
+++ trunk/OpenMPT/build/make/warnings-clang.mk Mon Mar 4 13:34:19 2024 (r20236)
@@ -2,8 +2,8 @@
CXXFLAGS_WARNINGS += -Wcast-align -Wcast-qual -Wdouble-promotion -Wfloat-conversion -Wmissing-prototypes -Wshift-count-negative -Wshift-count-overflow -Wshift-op-parentheses -Wshift-overflow -Wshift-sign-overflow -Wundef
CFLAGS_WARNINGS += -Wcast-align -Wcast-qual -Wdouble-promotion -Wfloat-conversion -Wmissing-prototypes -Wshift-count-negative -Wshift-count-overflow -Wshift-op-parentheses -Wshift-overflow -Wshift-sign-overflow -Wundef
-CXXFLAGS_WARNINGS += -Wdeprecated -Wextra-semi -Wframe-larger-than=16000 -Wglobal-constructors -Wimplicit-fallthrough -Wmissing-declarations -Wnon-virtual-dtor -Wreserved-id-macro
-CFLAGS_WARNINGS += -Wframe-larger-than=4000
+CXXFLAGS_WARNINGS += -Wdeprecated -Wexit-time-destructors -Wextra-semi -Wframe-larger-than=16000 -Wglobal-constructors -Wimplicit-fallthrough -Wmissing-declarations -Wnon-virtual-dtor -Wreserved-id-macro
+CFLAGS_WARNINGS += -Wframe-larger-than=4000
#CXXFLAGS_WARNINGS += -Wfloat-equal
#CXXFLAGS_WARNINGS += -Wdocumentation
Modified: trunk/OpenMPT/common/ComponentManager.h
==============================================================================
--- trunk/OpenMPT/common/ComponentManager.h Mon Mar 4 11:30:58 2024 (r20235)
+++ trunk/OpenMPT/common/ComponentManager.h Mon Mar 4 13:34:19 2024 (r20236)
@@ -438,8 +438,15 @@
template <typename type>
std::shared_ptr<const type> GetComponent()
{
+#if MPT_COMPILER_CLANG
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif // MPT_COMPILER_CLANG
static std::weak_ptr<type> cache;
static mpt::mutex m;
+#if MPT_COMPILER_CLANG
+#pragma clang diagnostic pop
+#endif // MPT_COMPILER_CLANG mpt::lock_guard<mpt::mutex> l(m);
mpt::lock_guard<mpt::mutex> l(m);
std::shared_ptr<type> component = cache.lock();
if(!component)
Modified: trunk/OpenMPT/common/mptRandom.cpp
==============================================================================
--- trunk/OpenMPT/common/mptRandom.cpp Mon Mar 4 11:30:58 2024 (r20235)
+++ trunk/OpenMPT/common/mptRandom.cpp Mon Mar 4 13:34:19 2024 (r20236)
@@ -45,13 +45,27 @@
mpt::random_device & global_random_device()
{
+#if MPT_COMPILER_CLANG
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif // MPT_COMPILER_CLANG
static mpt::random_device g_rd;
+#if MPT_COMPILER_CLANG
+#pragma clang diagnostic pop
+#endif // MPT_COMPILER_CLANG
return g_rd;
}
mpt::thread_safe_prng<mpt::default_prng> & global_prng()
{
+#if MPT_COMPILER_CLANG
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif // MPT_COMPILER_CLANG
static mpt::thread_safe_prng<mpt::default_prng> g_global_prng(mpt::make_prng<mpt::default_prng>(global_random_device()));
+#if MPT_COMPILER_CLANG
+#pragma clang diagnostic pop
+#endif // MPT_COMPILER_CLANG
return g_global_prng;
}
|