Switch atmosphere's build target to C++20. (#952)
* ams: update to build with gcc10/c++20 * remove mno-outline-atomics * ams: take care of most TODO C++20s * fusee/sept: update for gcc10 * whoosh, your code now uses pre-compiled headers * make: dependency fixes
This commit is contained in:
@@ -186,7 +186,7 @@ namespace ams::kvdb {
|
||||
|
||||
template<class Key, size_t Capacity>
|
||||
class FileKeyValueCache {
|
||||
static_assert(std::is_pod<Key>::value, "FileKeyValueCache Key must be pod!");
|
||||
static_assert(util::is_pod<Key>::value, "FileKeyValueCache Key must be pod!");
|
||||
static_assert(sizeof(Key) <= FileKeyValueStore::MaxKeySize, "FileKeyValueCache Key is too big!");
|
||||
public:
|
||||
using LeastRecentlyUsedList = impl::LruList<Key, Capacity>;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace ams::kvdb {
|
||||
size_t key_size;
|
||||
size_t value_size;
|
||||
};
|
||||
static_assert(std::is_pod<Entry>::value, "FileKeyValueStore::Entry definition!");
|
||||
static_assert(util::is_pod<Entry>::value, "FileKeyValueStore::Entry definition!");
|
||||
|
||||
class Cache {
|
||||
private:
|
||||
@@ -83,13 +83,13 @@ namespace ams::kvdb {
|
||||
/* Niceties. */
|
||||
template<typename Key>
|
||||
Result Get(size_t *out_size, void *out_value, size_t max_out_size, const Key &key) {
|
||||
static_assert(std::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!");
|
||||
static_assert(util::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!");
|
||||
return this->Get(out_size, out_value, max_out_size, &key, sizeof(Key));
|
||||
}
|
||||
|
||||
template<typename Key, typename Value>
|
||||
Result Get(Value *out_value, const Key &key) {
|
||||
static_assert(std::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!");
|
||||
static_assert(util::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!");
|
||||
size_t size = 0;
|
||||
R_TRY(this->Get(&size, out_value, sizeof(Value), key));
|
||||
AMS_ABORT_UNLESS(size >= sizeof(Value));
|
||||
@@ -103,13 +103,13 @@ namespace ams::kvdb {
|
||||
|
||||
template<typename Key>
|
||||
Result Set(const Key &key, const void *value, size_t value_size) {
|
||||
static_assert(std::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!");
|
||||
static_assert(util::is_pod<Key>::value && sizeof(Key) <= MaxKeySize, "Invalid FileKeyValueStore Key!");
|
||||
return this->Set(&key, sizeof(Key), value, value_size);
|
||||
}
|
||||
|
||||
template<typename Key, typename Value>
|
||||
Result Set(const Key &key, const Value &value) {
|
||||
static_assert(std::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!");
|
||||
static_assert(util::is_pod<Value>::value && !std::is_pointer<Value>::value, "Invalid FileKeyValueStore Value!");
|
||||
return this->Set(key, &value, sizeof(Value));
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace ams::kvdb {
|
||||
|
||||
template<class Key>
|
||||
class MemoryKeyValueStore {
|
||||
static_assert(std::is_pod<Key>::value, "KeyValueStore Keys must be pod!");
|
||||
static_assert(util::is_pod<Key>::value, "KeyValueStore Keys must be pod!");
|
||||
NON_COPYABLE(MemoryKeyValueStore);
|
||||
NON_MOVEABLE(MemoryKeyValueStore);
|
||||
public:
|
||||
@@ -49,7 +49,7 @@ namespace ams::kvdb {
|
||||
if constexpr (!std::is_same<Value, void>::value) {
|
||||
AMS_ABORT_UNLESS(sizeof(Value) <= this->value_size);
|
||||
/* Ensure we only get pod. */
|
||||
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
}
|
||||
return reinterpret_cast<Value *>(this->value);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace ams::kvdb {
|
||||
if constexpr (!std::is_same<Value, void>::value) {
|
||||
AMS_ABORT_UNLESS(sizeof(Value) <= this->value_size);
|
||||
/* Ensure we only get pod. */
|
||||
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
}
|
||||
return reinterpret_cast<Value *>(this->value);
|
||||
}
|
||||
@@ -366,14 +366,14 @@ namespace ams::kvdb {
|
||||
template<typename Value>
|
||||
Result Set(const Key &key, const Value &value) {
|
||||
/* Only allow setting pod. */
|
||||
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
return this->Set(key, &value, sizeof(Value));
|
||||
}
|
||||
|
||||
template<typename Value>
|
||||
Result Set(const Key &key, const Value *value) {
|
||||
/* Only allow setting pod. */
|
||||
static_assert(std::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
static_assert(util::is_pod<Value>::value, "KeyValueStore Values must be pod");
|
||||
return this->Set(key, value, sizeof(Value));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user