From 023b9b38cc9c6d31f1a01c29ac324c535308fa59 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 9 Aug 2023 20:58:47 -0400 Subject: general: fix apple clang build --- src/common/settings_common.cpp | 2 ++ src/common/settings_enums.h | 16 ++++++++-------- src/common/settings_setting.h | 10 +++++----- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src/common') diff --git a/src/common/settings_common.cpp b/src/common/settings_common.cpp index dedf5ef90..137b65d5f 100644 --- a/src/common/settings_common.cpp +++ b/src/common/settings_common.cpp @@ -1,7 +1,9 @@ // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include #include +#include #include "common/settings_common.h" namespace Settings { diff --git a/src/common/settings_enums.h b/src/common/settings_enums.h index a1a29ebf6..e7cb59ea5 100644 --- a/src/common/settings_enums.h +++ b/src/common/settings_enums.h @@ -12,8 +12,8 @@ namespace Settings { template struct EnumMetadata { - static constexpr std::vector> Canonicalizations(); - static constexpr u32 Index(); + static std::vector> Canonicalizations(); + static u32 Index(); }; #define PAIR_45(N, X, ...) {#X, N::X} __VA_OPT__(, PAIR_46(N, __VA_ARGS__)) @@ -66,11 +66,11 @@ struct EnumMetadata { #define ENUM(NAME, ...) \ enum class NAME : u32 { __VA_ARGS__ }; \ template <> \ - constexpr std::vector> EnumMetadata::Canonicalizations() { \ + inline std::vector> EnumMetadata::Canonicalizations() { \ return {PAIR(NAME, __VA_ARGS__)}; \ } \ template <> \ - constexpr u32 EnumMetadata::Index() { \ + inline u32 EnumMetadata::Index() { \ return __COUNTER__; \ } @@ -85,7 +85,7 @@ enum class AudioEngine : u32 { }; template <> -constexpr std::vector> +inline std::vector> EnumMetadata::Canonicalizations() { return { {"auto", AudioEngine::Auto}, @@ -96,7 +96,7 @@ EnumMetadata::Canonicalizations() { } template <> -constexpr u32 EnumMetadata::Index() { +inline u32 EnumMetadata::Index() { // This is just a sufficiently large number that is more than the number of other enums declared // here return 100; @@ -147,7 +147,7 @@ ENUM(AntiAliasing, None, Fxaa, Smaa, MaxEnum); ENUM(AspectRatio, R16_9, R4_3, R21_9, R16_10, Stretch); template -constexpr std::string CanonicalizeEnum(Type id) { +inline std::string CanonicalizeEnum(Type id) { const auto group = EnumMetadata::Canonicalizations(); for (auto& [name, value] : group) { if (value == id) { @@ -158,7 +158,7 @@ constexpr std::string CanonicalizeEnum(Type id) { } template -constexpr Type ToEnum(const std::string& canonicalization) { +inline Type ToEnum(const std::string& canonicalization) { const auto group = EnumMetadata::Canonicalizations(); for (auto& [name, value] : group) { if (name == canonicalization) { diff --git a/src/common/settings_setting.h b/src/common/settings_setting.h index a8beb06e9..e10843c73 100644 --- a/src/common/settings_setting.h +++ b/src/common/settings_setting.h @@ -190,7 +190,7 @@ public: } } - [[nodiscard]] std::string constexpr Canonicalize() const override final { + [[nodiscard]] std::string Canonicalize() const override final { if constexpr (std::is_enum_v) { return CanonicalizeEnum(this->GetValue()); } else { @@ -256,11 +256,11 @@ public: * @param runtime_modifiable_ Suggests whether this is modifiable while a guest is loaded * @param other_setting_ A second Setting to associate to this one in metadata */ + template explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const std::string& name, Category category_, u32 specialization_ = Specialization::Default, bool save_ = true, bool runtime_modifiable_ = false, - BasicSetting* other_setting_ = nullptr) - requires(!ranged) + typename std::enable_if::type other_setting_ = nullptr) : Setting{ linkage, default_val, name, category_, specialization_, save_, runtime_modifiable_, other_setting_} { @@ -282,12 +282,12 @@ public: * @param runtime_modifiable_ Suggests whether this is modifiable while a guest is loaded * @param other_setting_ A second Setting to associate to this one in metadata */ + template explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const Type& min_val, const Type& max_val, const std::string& name, Category category_, u32 specialization_ = Specialization::Default, bool save_ = true, bool runtime_modifiable_ = false, - BasicSetting* other_setting_ = nullptr) - requires(ranged) + typename std::enable_if::type other_setting_ = nullptr) : Setting{linkage, default_val, min_val, max_val, name, category_, specialization_, save_, runtime_modifiable_, -- cgit v1.2.3