summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-10-24 02:25:18 +0200
committerGitHub <noreply@github.com>2022-10-24 02:25:18 +0200
commit0313ee77936a696f9135a31ac0b644e6ffe49ae8 (patch)
treeb9e4a934447468338c60add33375409341f5bc7d /src/common
parentMerge pull request #9095 from FernandoS27/meat-good-vegetable-bad (diff)
parentCMakeLists: Disable -Wbraced-scalar-init on Clang (diff)
downloadyuzu-0313ee77936a696f9135a31ac0b644e6ffe49ae8.tar
yuzu-0313ee77936a696f9135a31ac0b644e6ffe49ae8.tar.gz
yuzu-0313ee77936a696f9135a31ac0b644e6ffe49ae8.tar.bz2
yuzu-0313ee77936a696f9135a31ac0b644e6ffe49ae8.tar.lz
yuzu-0313ee77936a696f9135a31ac0b644e6ffe49ae8.tar.xz
yuzu-0313ee77936a696f9135a31ac0b644e6ffe49ae8.tar.zst
yuzu-0313ee77936a696f9135a31ac0b644e6ffe49ae8.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/CMakeLists.txt7
-rw-r--r--src/common/bit_field.h15
-rw-r--r--src/common/bounded_threadsafe_queue.h9
3 files changed, 15 insertions, 16 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 46cf75fde..c0555f840 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -156,12 +156,13 @@ if (MSVC)
)
target_compile_options(common PRIVATE
/W4
- /WX
+
+ /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
+ /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()
target_compile_options(common PRIVATE
- -Werror
-
$<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation>
)
endif()
diff --git a/src/common/bit_field.h b/src/common/bit_field.h
index 7e1df62b1..e4e58ea45 100644
--- a/src/common/bit_field.h
+++ b/src/common/bit_field.h
@@ -141,10 +141,6 @@ public:
constexpr BitField(BitField&&) noexcept = default;
constexpr BitField& operator=(BitField&&) noexcept = default;
- [[nodiscard]] constexpr operator T() const {
- return Value();
- }
-
constexpr void Assign(const T& value) {
#ifdef _MSC_VER
storage = static_cast<StorageType>((storage & ~mask) | FormatValue(value));
@@ -162,6 +158,17 @@ public:
return ExtractValue(storage);
}
+ template <typename ConvertedToType>
+ [[nodiscard]] constexpr ConvertedToType As() const {
+ static_assert(!std::is_same_v<T, ConvertedToType>,
+ "Unnecessary cast. Use Value() instead.");
+ return static_cast<ConvertedToType>(Value());
+ }
+
+ [[nodiscard]] constexpr operator T() const {
+ return Value();
+ }
+
[[nodiscard]] constexpr explicit operator bool() const {
return Value() != 0;
}
diff --git a/src/common/bounded_threadsafe_queue.h b/src/common/bounded_threadsafe_queue.h
index 7e465549b..21217801e 100644
--- a/src/common/bounded_threadsafe_queue.h
+++ b/src/common/bounded_threadsafe_queue.h
@@ -21,11 +21,6 @@ constexpr size_t hardware_interference_size = std::hardware_destructive_interfer
constexpr size_t hardware_interference_size = 64;
#endif
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable : 4324)
-#endif
-
template <typename T, size_t capacity = 0x400>
class MPSCQueue {
public:
@@ -160,8 +155,4 @@ private:
static_assert(std::is_nothrow_destructible_v<T>, "T must be nothrow destructible");
};
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
} // namespace Common