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:
@@ -104,7 +104,7 @@ namespace ams {
|
||||
};
|
||||
|
||||
static_assert(sizeof(FatalErrorContext) == 0x450, "sizeof(FatalErrorContext)");
|
||||
static_assert(std::is_pod<FatalErrorContext>::value, "FatalErrorContext");
|
||||
static_assert(util::is_pod<FatalErrorContext>::value, "FatalErrorContext");
|
||||
|
||||
#ifdef ATMOSPHERE_GIT_BRANCH
|
||||
NX_CONSTEXPR const char *GetGitBranch() {
|
||||
|
||||
@@ -41,6 +41,6 @@ namespace ams::capsrv {
|
||||
};
|
||||
static_assert(sizeof(ScreenShotDecodeOption) == 0x20);
|
||||
static_assert(sizeof(ScreenShotDecodeOption) == sizeof(::CapsScreenShotDecodeOption));
|
||||
static_assert(std::is_pod<ScreenShotDecodeOption>::value);
|
||||
static_assert(util::is_pod<ScreenShotDecodeOption>::value);
|
||||
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace ams::cfg {
|
||||
};
|
||||
|
||||
static_assert(sizeof(OverrideStatus) == 0x10, "sizeof(OverrideStatus)");
|
||||
static_assert(std::is_pod<OverrideStatus>::value, "std::is_pod<OverrideStatus>::value");
|
||||
static_assert(util::is_pod<OverrideStatus>::value, "util::is_pod<OverrideStatus>::value");
|
||||
|
||||
constexpr inline bool operator==(const OverrideStatus &lhs, const OverrideStatus &rhs) {
|
||||
return std::memcmp(&lhs, &rhs, sizeof(lhs)) == 0;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace ams::dmnt::cheat {
|
||||
u8 main_nso_build_id[0x20];
|
||||
};
|
||||
|
||||
static_assert(std::is_pod<CheatProcessMetadata>::value && sizeof(CheatProcessMetadata) == 0x70, "CheatProcessMetadata definition!");
|
||||
static_assert(util::is_pod<CheatProcessMetadata>::value && sizeof(CheatProcessMetadata) == 0x70, "CheatProcessMetadata definition!");
|
||||
|
||||
struct CheatDefinition : sf::LargeData, sf::PrefersMapAliasTransferMode {
|
||||
char readable_name[0x40];
|
||||
@@ -50,8 +50,8 @@ namespace ams::dmnt::cheat {
|
||||
CheatDefinition definition;
|
||||
};
|
||||
|
||||
static_assert(std::is_pod<CheatDefinition>::value, "CheatDefinition");
|
||||
static_assert(std::is_pod<CheatEntry>::value, "CheatEntry");
|
||||
static_assert(util::is_pod<CheatDefinition>::value, "CheatDefinition");
|
||||
static_assert(util::is_pod<CheatEntry>::value, "CheatEntry");
|
||||
|
||||
struct FrozenAddressValue {
|
||||
u64 value;
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace ams::erpt {
|
||||
};
|
||||
|
||||
using ReportFlagSet = util::BitFlagSet<BITSIZEOF(u32), ReportFlag>;
|
||||
static_assert(std::is_pod<ReportFlagSet>::value);
|
||||
static_assert(util::is_pod<ReportFlagSet>::value);
|
||||
static_assert(sizeof(ReportFlagSet) == sizeof(u32));
|
||||
|
||||
struct ReportInfo {
|
||||
@@ -149,7 +149,7 @@ namespace ams::erpt {
|
||||
};
|
||||
|
||||
using AttachmentFlagSet = util::BitFlagSet<BITSIZEOF(u32), AttachmentFlag>;
|
||||
static_assert(std::is_pod<AttachmentFlagSet>::value);
|
||||
static_assert(util::is_pod<AttachmentFlagSet>::value);
|
||||
static_assert(sizeof(AttachmentFlagSet) == sizeof(u32));
|
||||
|
||||
constexpr inline u32 AttachmentNameSizeMax = 0x20;
|
||||
|
||||
@@ -75,44 +75,44 @@ namespace ams::fatal {
|
||||
static constexpr size_t MaxStackTraceDepth = 0x20;
|
||||
|
||||
static constexpr const char *RegisterNameStrings[RegisterName_Count] = {
|
||||
u8"X0",
|
||||
u8"X1",
|
||||
u8"X2",
|
||||
u8"X3",
|
||||
u8"X4",
|
||||
u8"X5",
|
||||
u8"X6",
|
||||
u8"X7",
|
||||
u8"X8",
|
||||
u8"X9",
|
||||
u8"X10",
|
||||
u8"X11",
|
||||
u8"X12",
|
||||
u8"X13",
|
||||
u8"X14",
|
||||
u8"X15",
|
||||
u8"X16",
|
||||
u8"X17",
|
||||
u8"X18",
|
||||
u8"X19",
|
||||
u8"X20",
|
||||
u8"X21",
|
||||
u8"X22",
|
||||
u8"X23",
|
||||
u8"X24",
|
||||
u8"X25",
|
||||
u8"X26",
|
||||
u8"X27",
|
||||
u8"X28",
|
||||
u8"FP",
|
||||
u8"LR",
|
||||
u8"SP",
|
||||
u8"PC",
|
||||
u8"PState",
|
||||
u8"Afsr0",
|
||||
u8"Afsr1",
|
||||
u8"Esr",
|
||||
u8"Far",
|
||||
"X0",
|
||||
"X1",
|
||||
"X2",
|
||||
"X3",
|
||||
"X4",
|
||||
"X5",
|
||||
"X6",
|
||||
"X7",
|
||||
"X8",
|
||||
"X9",
|
||||
"X10",
|
||||
"X11",
|
||||
"X12",
|
||||
"X13",
|
||||
"X14",
|
||||
"X15",
|
||||
"X16",
|
||||
"X17",
|
||||
"X18",
|
||||
"X19",
|
||||
"X20",
|
||||
"X21",
|
||||
"X22",
|
||||
"X23",
|
||||
"X24",
|
||||
"X25",
|
||||
"X26",
|
||||
"X27",
|
||||
"X28",
|
||||
"FP",
|
||||
"LR",
|
||||
"SP",
|
||||
"PC",
|
||||
"PState",
|
||||
"Afsr0",
|
||||
"Afsr1",
|
||||
"Esr",
|
||||
"Far",
|
||||
};
|
||||
|
||||
/* Registers, exception context. N left names for these fields in fatal .rodata. */
|
||||
@@ -209,27 +209,27 @@ namespace ams::fatal {
|
||||
static constexpr size_t MaxStackTraceDepth = 0x20;
|
||||
|
||||
static constexpr const char *RegisterNameStrings[RegisterName_Count] = {
|
||||
u8"R0",
|
||||
u8"R1",
|
||||
u8"R2",
|
||||
u8"R3",
|
||||
u8"R4",
|
||||
u8"R5",
|
||||
u8"R6",
|
||||
u8"R7",
|
||||
u8"R8",
|
||||
u8"R9",
|
||||
u8"R10",
|
||||
u8"FP",
|
||||
u8"IP",
|
||||
u8"LR",
|
||||
u8"SP",
|
||||
u8"PC",
|
||||
u8"PState",
|
||||
u8"Afsr0",
|
||||
u8"Afsr1",
|
||||
u8"Esr",
|
||||
u8"Far",
|
||||
"R0",
|
||||
"R1",
|
||||
"R2",
|
||||
"R3",
|
||||
"R4",
|
||||
"R5",
|
||||
"R6",
|
||||
"R7",
|
||||
"R8",
|
||||
"R9",
|
||||
"R10",
|
||||
"FP",
|
||||
"IP",
|
||||
"LR",
|
||||
"SP",
|
||||
"PC",
|
||||
"PState",
|
||||
"Afsr0",
|
||||
"Afsr1",
|
||||
"Esr",
|
||||
"Far",
|
||||
};
|
||||
|
||||
/* Registers, exception context. N left names for these fields in fatal .rodata. */
|
||||
@@ -311,9 +311,9 @@ namespace ams::fatal {
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(std::is_pod<aarch64::CpuContext>::value && sizeof(aarch64::CpuContext) == 0x248, "aarch64::CpuContext definition!");
|
||||
static_assert(std::is_pod<aarch32::CpuContext>::value && sizeof(aarch32::CpuContext) == 0xE0, "aarch32::CpuContext definition!");
|
||||
static_assert(std::is_pod<CpuContext>::value && sizeof(CpuContext) == 0x250, "CpuContext definition!");
|
||||
static_assert(util::is_pod<aarch64::CpuContext>::value && sizeof(aarch64::CpuContext) == 0x248, "aarch64::CpuContext definition!");
|
||||
static_assert(util::is_pod<aarch32::CpuContext>::value && sizeof(aarch32::CpuContext) == 0xE0, "aarch32::CpuContext definition!");
|
||||
static_assert(util::is_pod<CpuContext>::value && sizeof(CpuContext) == 0x250, "CpuContext definition!");
|
||||
|
||||
namespace srv {
|
||||
|
||||
|
||||
@@ -43,6 +43,6 @@ namespace ams::fs {
|
||||
return this->Get();
|
||||
}
|
||||
};
|
||||
static_assert(std::is_pod<Int64>::value);
|
||||
static_assert(util::is_pod<Int64>::value);
|
||||
|
||||
}
|
||||
@@ -28,7 +28,7 @@ namespace ams::fs {
|
||||
Position next_dir;
|
||||
Position next_file;
|
||||
};
|
||||
static_assert(std::is_pod<FindPosition>::value);
|
||||
static_assert(util::is_pod<FindPosition>::value);
|
||||
|
||||
using DirectoryInfo = RomDirectoryInfo;
|
||||
using FileInfo = RomFileInfo;
|
||||
@@ -56,13 +56,13 @@ namespace ams::fs {
|
||||
Position dir;
|
||||
Position file;
|
||||
};
|
||||
static_assert(std::is_pod<RomDirectoryEntry>::value);
|
||||
static_assert(util::is_pod<RomDirectoryEntry>::value);
|
||||
|
||||
struct RomFileEntry {
|
||||
Position next;
|
||||
FileInfo info;
|
||||
};
|
||||
static_assert(std::is_pod<RomFileEntry>::value);
|
||||
static_assert(util::is_pod<RomFileEntry>::value);
|
||||
|
||||
static constexpr inline u32 MaxKeyLength = RomPathTool::MaxPathLength;
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace ams::fs {
|
||||
return RomPathTool::IsEqualPath(reinterpret_cast<const RomPathChar *>(aux_lhs), reinterpret_cast<const RomPathChar *>(aux_rhs), aux_lhs_size / sizeof(RomPathChar));
|
||||
}
|
||||
};
|
||||
static_assert(std::is_pod<RomEntryKey>::value);
|
||||
static_assert(util::is_pod<RomEntryKey>::value);
|
||||
|
||||
struct EntryKey {
|
||||
RomEntryKey key;
|
||||
@@ -126,7 +126,7 @@ namespace ams::fs {
|
||||
return hash;
|
||||
}
|
||||
};
|
||||
static_assert(std::is_pod<EntryKey>::value);
|
||||
static_assert(util::is_pod<EntryKey>::value);
|
||||
|
||||
using DirectoryEntryMapTable = EntryMapTable<RomEntryKey, EntryKey, RomDirectoryEntry>;
|
||||
using FileEntryMapTable = EntryMapTable<RomEntryKey, EntryKey, RomFileEntry>;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace ams::fs {
|
||||
BucketIndex ind;
|
||||
Position pos;
|
||||
};
|
||||
static_assert(std::is_pod<FindIndex>::value);
|
||||
static_assert(util::is_pod<FindIndex>::value);
|
||||
private:
|
||||
static constexpr inline Position InvalidPosition = ~Position();
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace ams::fs {
|
||||
Position next;
|
||||
u32 size;
|
||||
};
|
||||
static_assert(std::is_pod<Element>::value);
|
||||
static_assert(util::is_pod<Element>::value);
|
||||
private:
|
||||
s64 bucket_count;
|
||||
SubStorage bucket_storage;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace ams::fs {
|
||||
size_t length;
|
||||
const RomPathChar *path;
|
||||
};
|
||||
static_assert(std::is_pod<RomEntryName>::value);
|
||||
static_assert(util::is_pod<RomEntryName>::value);
|
||||
|
||||
constexpr void InitializeRomEntryName(RomEntryName *entry) {
|
||||
AMS_ABORT_UNLESS(entry != nullptr);
|
||||
|
||||
@@ -34,19 +34,19 @@ namespace ams::fs {
|
||||
s64 file_entry_size;
|
||||
s64 body_offset;
|
||||
};
|
||||
static_assert(std::is_pod<RomFileSystemInformation>::value);
|
||||
static_assert(util::is_pod<RomFileSystemInformation>::value);
|
||||
static_assert(sizeof(RomFileSystemInformation) == 0x50);
|
||||
|
||||
struct RomDirectoryInfo {
|
||||
/* ... */
|
||||
};
|
||||
static_assert(std::is_pod<RomDirectoryInfo>::value);
|
||||
static_assert(util::is_pod<RomDirectoryInfo>::value);
|
||||
|
||||
struct RomFileInfo {
|
||||
Int64 offset;
|
||||
Int64 size;
|
||||
};
|
||||
static_assert(std::is_pod<RomFileInfo>::value);
|
||||
static_assert(util::is_pod<RomFileInfo>::value);
|
||||
|
||||
namespace RomStringTraits {
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace ams::fs {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
static_assert(std::is_pod<ReadOption>::value && sizeof(ReadOption) == sizeof(u32));
|
||||
static_assert(util::is_pod<ReadOption>::value && sizeof(ReadOption) == sizeof(u32));
|
||||
|
||||
struct WriteOption {
|
||||
u32 value;
|
||||
@@ -58,7 +58,7 @@ namespace ams::fs {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
static_assert(std::is_pod<WriteOption>::value && sizeof(WriteOption) == sizeof(u32));
|
||||
static_assert(util::is_pod<WriteOption>::value && sizeof(WriteOption) == sizeof(u32));
|
||||
|
||||
struct FileHandle {
|
||||
void *handle;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace ams::fs {
|
||||
|
||||
template<typename T>
|
||||
std::unique_ptr<T, Deleter> MakeUnique() {
|
||||
static_assert(std::is_pod<T>::value);
|
||||
static_assert(util::is_pod<T>::value);
|
||||
return std::unique_ptr<T, Deleter>(static_cast<T *>(::ams::fs::impl::Allocate(sizeof(T))), Deleter(sizeof(T)));
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace ams::fs {
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(std::is_pod<QueryRangeInfo>::value);
|
||||
static_assert(util::is_pod<QueryRangeInfo>::value);
|
||||
static_assert(sizeof(QueryRangeInfo) == 0x40);
|
||||
static_assert(sizeof(QueryRangeInfo) == sizeof(::FsRangeInfo));
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace ams::fs {
|
||||
u64 data64[2];
|
||||
};
|
||||
static_assert(sizeof(RightsId) == 0x10);
|
||||
static_assert(std::is_pod<RightsId>::value);
|
||||
static_assert(util::is_pod<RightsId>::value);
|
||||
|
||||
inline bool operator==(const RightsId &lhs, const RightsId &rhs) {
|
||||
return std::memcmp(std::addressof(lhs), std::addressof(rhs), sizeof(RightsId)) == 0;
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace ams::fs {
|
||||
struct UserId {
|
||||
u64 data[2];
|
||||
};
|
||||
static_assert(std::is_pod<UserId>::value);
|
||||
static_assert(util::is_pod<UserId>::value);
|
||||
|
||||
constexpr inline bool operator<(const UserId &lhs, const UserId &rhs) {
|
||||
if (lhs.data[0] < rhs.data[0]) {
|
||||
@@ -92,7 +92,7 @@ namespace ams::fs {
|
||||
bool pseudo;
|
||||
u8 reserved[0x1A];
|
||||
};
|
||||
static_assert(std::is_pod<SaveDataCreationInfo>::value);
|
||||
static_assert(util::is_pod<SaveDataCreationInfo>::value);
|
||||
static_assert(sizeof(SaveDataCreationInfo) == 0x40);
|
||||
|
||||
struct SaveDataAttribute {
|
||||
@@ -154,6 +154,6 @@ namespace ams::fs {
|
||||
u8 unused[0x190];
|
||||
};
|
||||
static_assert(sizeof(SaveDataExtraData) == 0x200);
|
||||
static_assert(std::is_pod<SaveDataExtraData>::value);
|
||||
static_assert(util::is_pod<SaveDataExtraData>::value);
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace ams::fssrv::sf {
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(std::is_pod<Path>::value && sizeof(Path) == FS_MAX_PATH);
|
||||
static_assert(util::is_pod<Path>::value && sizeof(Path) == FS_MAX_PATH);
|
||||
|
||||
using FspPath = Path;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace ams::fssystem {
|
||||
class PageList;
|
||||
|
||||
struct PageEntry { PageEntry *next; };
|
||||
static_assert(std::is_pod<PageEntry>::value);
|
||||
static_assert(util::is_pod<PageEntry>::value);
|
||||
static_assert(sizeof(PageEntry) <= BlockSizeMin);
|
||||
|
||||
class PageList : public ::ams::fs::impl::Newable {
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace ams::fssystem {
|
||||
Position next_dir;
|
||||
Position next_file;
|
||||
};
|
||||
static_assert(std::is_pod<FindPosition>::value);
|
||||
static_assert(util::is_pod<FindPosition>::value);
|
||||
|
||||
using DirectoryInfo = RomDirectoryInfo;
|
||||
using FileInfo = RomFileInfo;
|
||||
@@ -63,13 +63,13 @@ namespace ams::fssystem {
|
||||
Position dir;
|
||||
Position file;
|
||||
};
|
||||
static_assert(std::is_pod<RomDirectoryEntry>::value);
|
||||
static_assert(util::is_pod<RomDirectoryEntry>::value);
|
||||
|
||||
struct RomFileEntry {
|
||||
Position next;
|
||||
FileInfo info;
|
||||
};
|
||||
static_assert(std::is_pod<RomFileEntry>::value);
|
||||
static_assert(util::is_pod<RomFileEntry>::value);
|
||||
|
||||
static constexpr inline u32 MaxKeyLength = RomPathTool::MaxPathLength;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace ams::fssystem {
|
||||
return RomPathTool::IsEqualPath(reinterpret_cast<const RomPathChar *>(aux_lhs), reinterpret_cast<const RomPathChar *>(aux_rhs), aux_lhs_size / sizeof(RomPathChar));
|
||||
}
|
||||
};
|
||||
static_assert(std::is_pod<RomEntryKey>::value);
|
||||
static_assert(util::is_pod<RomEntryKey>::value);
|
||||
|
||||
struct EntryKey {
|
||||
RomEntryKey key;
|
||||
@@ -132,7 +132,7 @@ namespace ams::fssystem {
|
||||
return hash;
|
||||
}
|
||||
};
|
||||
static_assert(std::is_pod<EntryKey>::value);
|
||||
static_assert(util::is_pod<EntryKey>::value);
|
||||
|
||||
using DirectoryEntryMapTable = EntryMapTable<DirectoryBucketStorage, DirectoryEntryStorage, RomEntryKey, EntryKey, RomDirectoryEntry>;
|
||||
using FileEntryMapTable = EntryMapTable<FileBucketStorage, FileEntryStorage, RomEntryKey, EntryKey, RomFileEntry>;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace ams::fssystem {
|
||||
BucketIndex ind;
|
||||
Position pos;
|
||||
};
|
||||
static_assert(std::is_pod<FindIndex>::value);
|
||||
static_assert(util::is_pod<FindIndex>::value);
|
||||
private:
|
||||
static constexpr inline Position InvalidPosition = ~Position();
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace ams::fssystem {
|
||||
Position next;
|
||||
u32 size;
|
||||
};
|
||||
static_assert(std::is_pod<Element>::value);
|
||||
static_assert(util::is_pod<Element>::value);
|
||||
private:
|
||||
s64 bucket_offset;
|
||||
u32 bucket_count;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace ams::fssystem {
|
||||
size_t length;
|
||||
const RomPathChar *path;
|
||||
};
|
||||
static_assert(std::is_pod<RomEntryName>::value);
|
||||
static_assert(util::is_pod<RomEntryName>::value);
|
||||
|
||||
constexpr void InitializeRomEntryName(RomEntryName *entry) {
|
||||
entry->length = 0;
|
||||
|
||||
@@ -34,19 +34,19 @@ namespace ams::fssystem {
|
||||
s64 file_entry_size;
|
||||
s64 body_offset;
|
||||
};
|
||||
static_assert(std::is_pod<RomFileSystemInformation>::value);
|
||||
static_assert(util::is_pod<RomFileSystemInformation>::value);
|
||||
static_assert(sizeof(RomFileSystemInformation) == 0x50);
|
||||
|
||||
struct RomDirectoryInfo {
|
||||
/* ... */
|
||||
};
|
||||
static_assert(std::is_pod<RomDirectoryInfo>::value);
|
||||
static_assert(util::is_pod<RomDirectoryInfo>::value);
|
||||
|
||||
struct RomFileInfo {
|
||||
fs::Int64 offset;
|
||||
fs::Int64 size;
|
||||
};
|
||||
static_assert(std::is_pod<RomFileInfo>::value);
|
||||
static_assert(util::is_pod<RomFileInfo>::value);
|
||||
|
||||
namespace RomStringTraits {
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace ams::fssystem {
|
||||
u32 name_offset;
|
||||
u32 reserved;
|
||||
};
|
||||
static_assert(std::is_pod<PartitionEntry>::value);
|
||||
static_assert(util::is_pod<PartitionEntry>::value);
|
||||
#pragma pack(pop)
|
||||
|
||||
static constexpr const char VersionSignature[] = { 'P', 'F', 'S', '0' };
|
||||
@@ -52,7 +52,7 @@ namespace ams::fssystem {
|
||||
u64 hash_target_offset;
|
||||
char hash[HashSize];
|
||||
};
|
||||
static_assert(std::is_pod<PartitionEntry>::value);
|
||||
static_assert(util::is_pod<PartitionEntry>::value);
|
||||
#pragma pack(pop)
|
||||
|
||||
static constexpr const char VersionSignature[] = { 'H', 'F', 'S', '0' };
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace ams::ldr {
|
||||
u32 aci_fah_size;
|
||||
u8 ac_buffer[0x3E0];
|
||||
};
|
||||
static_assert(std::is_pod<ProgramInfo>::value && sizeof(ProgramInfo) == 0x400, "ProgramInfo definition!");
|
||||
static_assert(util::is_pod<ProgramInfo>::value && sizeof(ProgramInfo) == 0x400, "ProgramInfo definition!");
|
||||
|
||||
enum ProgramInfoFlag {
|
||||
ProgramInfoFlag_SystemModule = (0 << 0),
|
||||
@@ -71,7 +71,7 @@ namespace ams::ldr {
|
||||
inline bool operator!=(const PinId &lhs, const PinId &rhs) {
|
||||
return lhs.value != rhs.value;
|
||||
}
|
||||
static_assert(sizeof(PinId) == sizeof(u64) && std::is_pod<PinId>::value, "PinId definition!");
|
||||
static_assert(sizeof(PinId) == sizeof(u64) && util::is_pod<PinId>::value, "PinId definition!");
|
||||
|
||||
/* Import ModuleInfo from libnx. */
|
||||
using ModuleInfo = ::LoaderModuleInfo;
|
||||
@@ -142,7 +142,7 @@ namespace ams::ldr {
|
||||
};
|
||||
};
|
||||
};
|
||||
static_assert(sizeof(NsoHeader) == 0x100 && std::is_pod<NsoHeader>::value, "NsoHeader definition!");
|
||||
static_assert(sizeof(NsoHeader) == 0x100 && util::is_pod<NsoHeader>::value, "NsoHeader definition!");
|
||||
|
||||
/* NPDM types. */
|
||||
struct Aci {
|
||||
@@ -160,7 +160,7 @@ namespace ams::ldr {
|
||||
u32 kac_size;
|
||||
u8 reserved_38[0x8];
|
||||
};
|
||||
static_assert(sizeof(Aci) == 0x40 && std::is_pod<Aci>::value, "Aci definition!");
|
||||
static_assert(sizeof(Aci) == 0x40 && util::is_pod<Aci>::value, "Aci definition!");
|
||||
|
||||
struct Acid {
|
||||
static constexpr u32 Magic = util::FourCC<'A','C','I','D'>::Code;
|
||||
@@ -199,7 +199,7 @@ namespace ams::ldr {
|
||||
u32 kac_size;
|
||||
u8 reserved_238[0x8];
|
||||
};
|
||||
static_assert(sizeof(Acid) == 0x240 && std::is_pod<Acid>::value, "Acid definition!");
|
||||
static_assert(sizeof(Acid) == 0x240 && util::is_pod<Acid>::value, "Acid definition!");
|
||||
|
||||
struct Npdm {
|
||||
static constexpr u32 Magic = util::FourCC<'M','E','T','A'>::Code;
|
||||
@@ -239,6 +239,6 @@ namespace ams::ldr {
|
||||
u32 acid_offset;
|
||||
u32 acid_size;
|
||||
};
|
||||
static_assert(sizeof(Npdm) == 0x80 && std::is_pod<Npdm>::value, "Npdm definition!");
|
||||
static_assert(sizeof(Npdm) == 0x80 && util::is_pod<Npdm>::value, "Npdm definition!");
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,6 @@ namespace ams::lr {
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(std::is_pod<Path>::value && sizeof(Path) == fs::EntryNameLengthMax);
|
||||
static_assert(util::is_pod<Path>::value && sizeof(Path) == fs::EntryNameLengthMax);
|
||||
|
||||
}
|
||||
|
||||
@@ -65,6 +65,6 @@ namespace ams::mem::impl {
|
||||
size_t alloc_size;
|
||||
size_t hash;
|
||||
};
|
||||
static_assert(std::is_pod<HeapHash>::value);
|
||||
static_assert(util::is_pod<HeapHash>::value);
|
||||
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace ams::ncm {
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(sizeof(std::is_pod<ContentInfo>::value));
|
||||
static_assert(sizeof(util::is_pod<ContentInfo>::value));
|
||||
static_assert(sizeof(ContentInfo) == 0x18);
|
||||
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace ams::ncm {
|
||||
u32 flags;
|
||||
fs::SaveDataSpaceId space_id;
|
||||
};
|
||||
static_assert(std::is_pod<SystemSaveDataInfo>::value);
|
||||
static_assert(util::is_pod<SystemSaveDataInfo>::value);
|
||||
|
||||
class ContentManagerImpl final : public IContentManager {
|
||||
private:
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace ams::ncm {
|
||||
return { .program_id = program_id, .storage_id = static_cast<u8>(storage_id), };
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(ProgramLocation) == 0x10 && std::is_pod<ProgramLocation>::value);
|
||||
static_assert(sizeof(ProgramLocation) == 0x10 && util::is_pod<ProgramLocation>::value);
|
||||
static_assert(sizeof(ProgramLocation) == sizeof(::NcmProgramLocation) && alignof(ProgramLocation) == alignof(::NcmProgramLocation), "ProgramLocation Libnx Compatibility");
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace ams::ncm {
|
||||
u8 reserved[7];
|
||||
};
|
||||
static_assert(sizeof(RightsId) == 0x18);
|
||||
static_assert(std::is_pod<RightsId>::value);
|
||||
static_assert(util::is_pod<RightsId>::value);
|
||||
|
||||
inline bool operator==(const RightsId &lhs, const RightsId &rhs) {
|
||||
return std::tie(lhs.id, lhs.key_generation) == std::tie(rhs.id, rhs.key_generation);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace ams::os {
|
||||
};
|
||||
util::BitPack32 counter;
|
||||
};
|
||||
static_assert(std::is_pod<LockCount>::value);
|
||||
static_assert(util::is_pod<LockCount>::value);
|
||||
static_assert(std::is_trivial<LockCount>::value);
|
||||
|
||||
union {
|
||||
|
||||
@@ -52,6 +52,6 @@ namespace ams::pgl {
|
||||
};
|
||||
}
|
||||
};
|
||||
static_assert(sizeof(ContentMetaInfo) == 0x10 && std::is_pod<ContentMetaInfo>::value);
|
||||
static_assert(sizeof(ContentMetaInfo) == 0x10 && util::is_pod<ContentMetaInfo>::value);
|
||||
|
||||
}
|
||||
|
||||
@@ -97,6 +97,6 @@ namespace ams::pm {
|
||||
u32 event;
|
||||
os::ProcessId process_id;
|
||||
};
|
||||
static_assert(sizeof(ProcessEventInfo) == 0x10 && std::is_pod<ProcessEventInfo>::value, "ProcessEventInfo definition!");
|
||||
static_assert(sizeof(ProcessEventInfo) == 0x10 && util::is_pod<ProcessEventInfo>::value, "ProcessEventInfo definition!");
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace ams::reg {
|
||||
}
|
||||
|
||||
inline void SetBits(volatile u32 *reg, u32 mask) {
|
||||
*reg |= mask;
|
||||
*reg = *reg | mask;
|
||||
}
|
||||
|
||||
inline void SetBits(uintptr_t reg, u32 mask) {
|
||||
@@ -44,7 +44,7 @@ namespace ams::reg {
|
||||
}
|
||||
|
||||
inline void ClearBits(volatile u32 *reg, u32 mask) {
|
||||
*reg &= ~mask;
|
||||
*reg = *reg & ~mask;
|
||||
}
|
||||
|
||||
inline void ClearBits(uintptr_t reg, u32 mask) {
|
||||
@@ -52,7 +52,7 @@ namespace ams::reg {
|
||||
}
|
||||
|
||||
inline void MaskBits(volatile u32 *reg, u32 mask) {
|
||||
*reg &= mask;
|
||||
*reg = *reg & mask;
|
||||
}
|
||||
|
||||
inline void MaskBits(uintptr_t reg, u32 mask) {
|
||||
|
||||
@@ -22,18 +22,18 @@ namespace ams::settings::factory {
|
||||
u8 data[0x180];
|
||||
};
|
||||
static_assert(sizeof(EccP256DeviceCertificate) == 0x180);
|
||||
static_assert(std::is_pod<EccP256DeviceCertificate>::value);
|
||||
static_assert(util::is_pod<EccP256DeviceCertificate>::value);
|
||||
|
||||
struct EccB233DeviceCertificate {
|
||||
u8 data[0x180];
|
||||
};
|
||||
static_assert(sizeof(EccB233DeviceCertificate) == 0x180);
|
||||
static_assert(std::is_pod<EccB233DeviceCertificate>::value);
|
||||
static_assert(util::is_pod<EccB233DeviceCertificate>::value);
|
||||
|
||||
struct Rsa2048DeviceCertificate {
|
||||
u8 data[0x240];
|
||||
};
|
||||
static_assert(sizeof(Rsa2048DeviceCertificate) == 0x240);
|
||||
static_assert(std::is_pod<Rsa2048DeviceCertificate>::value);
|
||||
static_assert(util::is_pod<Rsa2048DeviceCertificate>::value);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@ namespace ams::settings::factory {
|
||||
char str[0x18];
|
||||
};
|
||||
static_assert(sizeof(SerialNumber) == 0x18);
|
||||
static_assert(std::is_pod<SerialNumber>::value);
|
||||
static_assert(util::is_pod<SerialNumber>::value);
|
||||
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ namespace ams::settings::fwdbg {
|
||||
char value[util::AlignUp(SettingsNameLengthMax + 1, alignof(u64))];
|
||||
};
|
||||
|
||||
static_assert(std::is_pod<SettingsName>::value && sizeof(SettingsName) > SettingsNameLengthMax);
|
||||
static_assert(util::is_pod<SettingsName>::value && sizeof(SettingsName) > SettingsNameLengthMax);
|
||||
|
||||
struct SettingsItemKey : sf::LargeData {
|
||||
char value[util::AlignUp(SettingsItemKeyLengthMax + 1, alignof(u64))];
|
||||
};
|
||||
|
||||
static_assert(std::is_pod<SettingsItemKey>::value && sizeof(SettingsItemKey) > SettingsItemKeyLengthMax);
|
||||
static_assert(util::is_pod<SettingsItemKey>::value && sizeof(SettingsItemKey) > SettingsItemKeyLengthMax);
|
||||
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace ams::settings {
|
||||
return impl::IsValidLanguageCode(lc, std::make_index_sequence<Language_Count>{});
|
||||
}
|
||||
|
||||
static_assert(std::is_pod<LanguageCode>::value);
|
||||
static_assert(util::is_pod<LanguageCode>::value);
|
||||
static_assert(sizeof(LanguageCode) == sizeof(u64));
|
||||
|
||||
/* Not an official type, but convenient. */
|
||||
@@ -193,7 +193,7 @@ namespace ams::settings {
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(std::is_pod<FirmwareVersion>::value);
|
||||
static_assert(util::is_pod<FirmwareVersion>::value);
|
||||
static_assert(sizeof(FirmwareVersion) == sizeof(::SetSysFirmwareVersion));
|
||||
|
||||
constexpr inline bool operator==(const FirmwareVersion &lhs, const FirmwareVersion &rhs) {
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace ams::sf::cmif {
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(std::is_pod<ServerMessageRuntimeMetadata>::value, "std::is_pod<ServerMessageRuntimeMetadata>::value");
|
||||
static_assert(util::is_pod<ServerMessageRuntimeMetadata>::value, "util::is_pod<ServerMessageRuntimeMetadata>::value");
|
||||
static_assert(sizeof(ServerMessageRuntimeMetadata) == sizeof(u64), "sizeof(ServerMessageRuntimeMetadata)");
|
||||
|
||||
class ServerMessageProcessor {
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace ams::sf::cmif {
|
||||
return this->handler;
|
||||
}
|
||||
};
|
||||
static_assert(std::is_pod<ServiceCommandMeta>::value && sizeof(ServiceCommandMeta) == 0x18, "sizeof(ServiceCommandMeta)");
|
||||
static_assert(util::is_pod<ServiceCommandMeta>::value && sizeof(ServiceCommandMeta) == 0x18, "sizeof(ServiceCommandMeta)");
|
||||
|
||||
namespace impl {
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace ams::sf {
|
||||
class Out<std::shared_ptr<ServiceImpl>> : public impl::OutObjectTag {
|
||||
static_assert(std::is_base_of<sf::IServiceObject, ServiceImpl>::value, "Out<std::shared_ptr<ServiceImpl>> requires ServiceObject base.");
|
||||
|
||||
template<typename, typename>
|
||||
template<typename>
|
||||
friend class Out;
|
||||
|
||||
public:
|
||||
@@ -308,11 +308,7 @@ namespace ams::sf::impl {
|
||||
/* Use insertion sort, which is stable and optimal for small numbers of parameters. */
|
||||
for (size_t i = 1; i < sizeof...(Ts); i++) {
|
||||
for (size_t j = i; j > 0 && values[map[j-1]] > values[map[j]]; j--) {
|
||||
/* std::swap is not constexpr until c++20 :( */
|
||||
/* TODO: std::swap(map[j], map[j-1]); */
|
||||
const size_t tmp = map[j];
|
||||
map[j] = map[j-1];
|
||||
map[j-1] = tmp;
|
||||
std::swap(map[j], map[j-1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1042,7 +1038,7 @@ namespace ams::sf::impl {
|
||||
};
|
||||
|
||||
constexpr Result GetCmifOutHeaderPointer(CmifOutHeader **out_header_ptr, cmif::PointerAndSize &out_raw_data) {
|
||||
CmifOutHeader *header = reinterpret_cast<CmifOutHeader *>(out_raw_data.GetPointer());
|
||||
CmifOutHeader *header = static_cast<CmifOutHeader *>(out_raw_data.GetPointer());
|
||||
R_UNLESS(out_raw_data.GetSize() >= sizeof(*header), sf::cmif::ResultInvalidHeaderSize());
|
||||
out_raw_data = cmif::PointerAndSize(out_raw_data.GetAddress() + sizeof(*header), out_raw_data.GetSize() - sizeof(*header));
|
||||
*out_header_ptr = header;
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace ams::sf {
|
||||
struct IsOutForceEnabled<::ams::Result> : public std::true_type{};
|
||||
|
||||
template<typename T>
|
||||
using IsOutEnabled = typename std::enable_if<std::is_trivial<T>::value || IsOutForceEnabled<T>::value>::type;
|
||||
concept OutEnabled = (std::is_trivial<T>::value || IsOutForceEnabled<T>::value) && !std::is_pointer<T>::value;
|
||||
|
||||
template<typename T, typename = IsOutEnabled<T>>
|
||||
template<typename T> requires OutEnabled<T>
|
||||
class Out : public impl::OutBaseTag {
|
||||
public:
|
||||
static constexpr size_t TypeSize = sizeof(T);
|
||||
|
||||
Reference in New Issue
Block a user