common: Miscellaneous cleanups (#7239)

* code: Remove some old msvc workarounds

* android: Upgrade to NDK 26

* Allows access to newer libc++

* common/swap: Make use of std::endian

Allows removing a bunch of defines in favor of a two liner.

* common: Remove misc.cpp

* GetLastErrorMsg has been in error.h for a while and also helps removing a depedency from a hot header like common_funcs

* common: use SetThreadDescription API for thread names

* common: Remove linear disk cache

* Has never been used?

* bit_set: Make constexpr

* ring_buffer: Use feature macro

* bit_set: Use <bit> and concepts

* gsp_gpu: Restore comment

* core: Ignore GCC warning

---------

Co-authored-by: Lioncash <mathew1800@gmail.com>
Co-authored-by: Liam <byteslice@airmail.cc>
This commit is contained in:
GPUCode 2023-12-14 16:26:33 +02:00 committed by GitHub
parent 15ea0c6336
commit 2b20082581
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 50 additions and 426 deletions

View file

@ -5,6 +5,7 @@
#include <algorithm>
#include <memory>
#include "common/archives.h"
#include "common/error.h"
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/settings.h"
@ -103,7 +104,7 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& pa
FileUtil::IOFile file(full_path, mode.write_flag ? "r+b" : "rb");
if (!file.IsOpen()) {
LOG_CRITICAL(Service_FS, "Error opening {}: {}", full_path, GetLastErrorMsg());
LOG_CRITICAL(Service_FS, "Error opening {}: {}", full_path, Common::GetLastErrorMsg());
return ERROR_NOT_FOUND;
}

View file

@ -97,10 +97,8 @@ struct FrameBufferUpdate {
static_assert(sizeof(FrameBufferUpdate) == 0x40, "Struct has incorrect size");
// TODO: Not sure if this padding is correct.
// Chances are the second block is stored at offset 0x24 rather than 0x20.
#ifndef _MSC_VER
static_assert(offsetof(FrameBufferUpdate, framebuffer_info[1]) == 0x20,
"FrameBufferInfo element has incorrect alignment");
#endif
/// GSP command
struct Command {

View file

@ -64,22 +64,14 @@ private:
};
static_assert(std::is_standard_layout<Regs>::value, "Structure does not use standard layout");
// TODO: MSVC does not support using offsetof() on non-static data members even though this
// is technically allowed since C++11. This macro should be enabled once MSVC adds
// support for that.
#ifndef _MSC_VER
#define ASSERT_REG_POSITION(field_name, position) \
static_assert(offsetof(Regs, field_name) == position * 4, \
"Field " #field_name " has invalid position")
ASSERT_REG_POSITION(color_fill_top, 0x81);
ASSERT_REG_POSITION(backlight_top, 0x90);
ASSERT_REG_POSITION(color_fill_bottom, 0x281);
ASSERT_REG_POSITION(backlight_bottom, 0x290);
#undef ASSERT_REG_POSITION
#endif // !defined(_MSC_VER)
extern Regs g_regs;
template <typename T>