diff options
author | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2023-06-18 19:57:14 -0400 |
---|---|---|
committer | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2023-07-21 10:56:55 -0400 |
commit | 3f0cc544cf7184adacec22aedd81f6d796bbea31 (patch) | |
tree | 16bb9ab8dc1b20fe4767a6f0bf94954f8cfad7d6 /src/common | |
parent | c97cbd089b371ed07234c66633f105862462826a (diff) |
common,yuzu-qt: Avoid explicit instantiation on old clang
Clang versions < 15 have compile issues with explicit instantiation.
Disable it for these versions.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/common/settings.cpp | 2 | ||||
-rw-r--r-- | src/common/settings.h | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 09e7e673e..cf05ae364 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -197,10 +197,15 @@ if (MSVC) /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data /we4800 # Implicit conversion from 'type' to bool. Possible information loss ) -else() +endif() + +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options(common PRIVATE - $<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation> - $<$<CXX_COMPILER_ID:Clang>:-Werror=unreachable-code-aggressive> + -fsized-deallocation + -Werror=unreachable-code-aggressive + ) + target_compile_definitions(common PRIVATE + $<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,15>:_CANNOT_EXPLICITLY_INSTANTIATE> ) endif() diff --git a/src/common/settings.cpp b/src/common/settings.cpp index a1cc76a38..f4eb2d2fb 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -25,6 +25,7 @@ namespace Settings { +#ifndef _CANNOT_EXPLICITLY_INSTANTIATE #define SETTING(TYPE, RANGED) template class Setting<TYPE, RANGED> #define SWITCHABLE(TYPE, RANGED) template class SwitchableSetting<TYPE, RANGED> @@ -61,6 +62,7 @@ SWITCHABLE(u8, true); #undef SETTING #undef SWITCHABLE +#endif Values values; diff --git a/src/common/settings.h b/src/common/settings.h index e510036b4..35fa4cf3d 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -45,6 +45,7 @@ struct ResolutionScalingInfo { } }; +#ifndef _CANNOT_EXPLICITLY_INSTANTIATE // Instantiate the classes elsewhere (settings.cpp) to reduce compiler/linker work #define SETTING(TYPE, RANGED) extern template class Setting<TYPE, RANGED> #define SWITCHABLE(TYPE, RANGED) extern template class SwitchableSetting<TYPE, RANGED> @@ -84,6 +85,7 @@ SWITCHABLE(u8, true); #undef SETTING #undef SWITCHABLE +#endif /** * The InputSetting class allows for getting a reference to either the global or custom members. |