Skip to content

Commit

Permalink
[Ref] build: Makefile: Clang: Enable -Wexit-time-destructors.
Browse files Browse the repository at this point in the history
git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@20236 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
manxorist committed Mar 4, 2024
1 parent fc48ac8 commit 0d4196d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions build/make/warnings-clang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions common/ComponentManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,15 @@ inline mpt::PathString GetComponentPath()
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)
Expand Down
14 changes: 14 additions & 0 deletions common/mptRandom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,27 @@ mpt::thread_safe_prng<mpt::default_prng> & global_prng()

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;
}

Expand Down

0 comments on commit 0d4196d

Please sign in to comment.