Merge pull request #9782 from arades79/fix-consexpr-value-declaration-usage
Fix consexpr value declaration usage
This commit is contained in:
commit
04d2d2ef5f
26 changed files with 54 additions and 60 deletions
|
@ -45,7 +45,7 @@ CoreTiming::~CoreTiming() {
|
|||
}
|
||||
|
||||
void CoreTiming::ThreadEntry(CoreTiming& instance) {
|
||||
constexpr char name[] = "HostTiming";
|
||||
static constexpr char name[] = "HostTiming";
|
||||
MicroProfileOnThreadCreate(name);
|
||||
Common::SetCurrentThreadName(name);
|
||||
Common::SetCurrentThreadPriority(Common::ThreadPriority::Critical);
|
||||
|
|
|
@ -41,9 +41,8 @@ static void PutSIMDRegister(std::array<u32, 64>& simd_regs, size_t offset, const
|
|||
|
||||
// For sample XML files see the GDB source /gdb/features
|
||||
// This XML defines what the registers are for this specific ARM device
|
||||
std::string GDBStubA64::GetTargetXML() const {
|
||||
constexpr const char* target_xml =
|
||||
R"(<?xml version="1.0"?>
|
||||
std::string_view GDBStubA64::GetTargetXML() const {
|
||||
return R"(<?xml version="1.0"?>
|
||||
<!DOCTYPE target SYSTEM "gdb-target.dtd">
|
||||
<target version="1.0">
|
||||
<architecture>aarch64</architecture>
|
||||
|
@ -178,8 +177,6 @@ std::string GDBStubA64::GetTargetXML() const {
|
|||
<reg name="fpcr" bitsize="32"/>
|
||||
</feature>
|
||||
</target>)";
|
||||
|
||||
return target_xml;
|
||||
}
|
||||
|
||||
std::string GDBStubA64::RegRead(const Kernel::KThread* thread, size_t id) const {
|
||||
|
@ -270,9 +267,8 @@ u32 GDBStubA64::BreakpointInstruction() const {
|
|||
return 0xd4200000;
|
||||
}
|
||||
|
||||
std::string GDBStubA32::GetTargetXML() const {
|
||||
constexpr const char* target_xml =
|
||||
R"(<?xml version="1.0"?>
|
||||
std::string_view GDBStubA32::GetTargetXML() const {
|
||||
return R"(<?xml version="1.0"?>
|
||||
<!DOCTYPE target SYSTEM "gdb-target.dtd">
|
||||
<target version="1.0">
|
||||
<architecture>arm</architecture>
|
||||
|
@ -378,8 +374,6 @@ std::string GDBStubA32::GetTargetXML() const {
|
|||
<reg name="fpscr" bitsize="32" type="int" group="float" regnum="80"/>
|
||||
</feature>
|
||||
</target>)";
|
||||
|
||||
return target_xml;
|
||||
}
|
||||
|
||||
std::string GDBStubA32::RegRead(const Kernel::KThread* thread, size_t id) const {
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Core {
|
|||
class GDBStubArch {
|
||||
public:
|
||||
virtual ~GDBStubArch() = default;
|
||||
virtual std::string GetTargetXML() const = 0;
|
||||
virtual std::string_view GetTargetXML() const = 0;
|
||||
virtual std::string RegRead(const Kernel::KThread* thread, size_t id) const = 0;
|
||||
virtual void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const = 0;
|
||||
virtual std::string ReadRegisters(const Kernel::KThread* thread) const = 0;
|
||||
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
class GDBStubA64 final : public GDBStubArch {
|
||||
public:
|
||||
std::string GetTargetXML() const override;
|
||||
std::string_view GetTargetXML() const override;
|
||||
std::string RegRead(const Kernel::KThread* thread, size_t id) const override;
|
||||
void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override;
|
||||
std::string ReadRegisters(const Kernel::KThread* thread) const override;
|
||||
|
@ -47,7 +47,7 @@ private:
|
|||
|
||||
class GDBStubA32 final : public GDBStubArch {
|
||||
public:
|
||||
std::string GetTargetXML() const override;
|
||||
std::string_view GetTargetXML() const override;
|
||||
std::string RegRead(const Kernel::KThread* thread, size_t id) const override;
|
||||
void RegWrite(Kernel::KThread* thread, size_t id, std::string_view value) const override;
|
||||
std::string ReadRegisters(const Kernel::KThread* thread) const override;
|
||||
|
|
|
@ -41,12 +41,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) {
|
|||
return IPSFileType::Error;
|
||||
}
|
||||
|
||||
constexpr std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}};
|
||||
static constexpr std::array<u8, 5> patch_magic{{'P', 'A', 'T', 'C', 'H'}};
|
||||
if (std::equal(magic.begin(), magic.end(), patch_magic.begin())) {
|
||||
return IPSFileType::IPS;
|
||||
}
|
||||
|
||||
constexpr std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}};
|
||||
static constexpr std::array<u8, 5> ips32_magic{{'I', 'P', 'S', '3', '2'}};
|
||||
if (std::equal(magic.begin(), magic.end(), ips32_magic.begin())) {
|
||||
return IPSFileType::IPS32;
|
||||
}
|
||||
|
@ -55,12 +55,12 @@ static IPSFileType IdentifyMagic(const std::vector<u8>& magic) {
|
|||
}
|
||||
|
||||
static bool IsEOF(IPSFileType type, const std::vector<u8>& data) {
|
||||
constexpr std::array<u8, 3> eof{{'E', 'O', 'F'}};
|
||||
static constexpr std::array<u8, 3> eof{{'E', 'O', 'F'}};
|
||||
if (type == IPSFileType::IPS && std::equal(data.begin(), data.end(), eof.begin())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
constexpr std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}};
|
||||
static constexpr std::array<u8, 4> eeof{{'E', 'E', 'O', 'F'}};
|
||||
return type == IPSFileType::IPS32 && std::equal(data.begin(), data.end(), eeof.begin());
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bo
|
|||
}
|
||||
|
||||
static std::string GetCNMTName(TitleType type, u64 title_id) {
|
||||
constexpr std::array<const char*, 9> TITLE_TYPE_NAMES{
|
||||
static constexpr std::array<const char*, 9> TITLE_TYPE_NAMES{
|
||||
"SystemProgram",
|
||||
"SystemData",
|
||||
"SystemUpdate",
|
||||
|
|
|
@ -16,7 +16,7 @@ Result SetThreadActivity(Core::System& system, Handle thread_handle,
|
|||
thread_activity);
|
||||
|
||||
// Validate the activity.
|
||||
constexpr auto IsValidThreadActivity = [](ThreadActivity activity) {
|
||||
static constexpr auto IsValidThreadActivity = [](ThreadActivity activity) {
|
||||
return activity == ThreadActivity::Runnable || activity == ThreadActivity::Paused;
|
||||
};
|
||||
R_UNLESS(IsValidThreadActivity(thread_activity), ResultInvalidEnumValue);
|
||||
|
|
|
@ -1569,7 +1569,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
|
|||
const auto& version = res.first->GetVersionString();
|
||||
std::copy(version.begin(), version.end(), version_string.begin());
|
||||
} else {
|
||||
constexpr char default_version[]{"1.0.0"};
|
||||
static constexpr char default_version[]{"1.0.0"};
|
||||
std::memcpy(version_string.data(), default_version, sizeof(default_version));
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void Controller::SetPerformanceConfiguration(PerformanceMode mode,
|
|||
}
|
||||
|
||||
void Controller::SetFromCpuBoostMode(CpuBoostMode mode) {
|
||||
constexpr std::array<PerformanceConfiguration, 3> BOOST_MODE_TO_CONFIG_MAP{{
|
||||
static constexpr std::array<PerformanceConfiguration, 3> BOOST_MODE_TO_CONFIG_MAP{{
|
||||
PerformanceConfiguration::Config7,
|
||||
PerformanceConfiguration::Config13,
|
||||
PerformanceConfiguration::Config15,
|
||||
|
|
|
@ -124,7 +124,7 @@ private:
|
|||
//!< value
|
||||
};
|
||||
|
||||
constexpr static std::size_t SyncpointCount{192};
|
||||
static constexpr std::size_t SyncpointCount{192};
|
||||
std::array<SyncpointInfo, SyncpointCount> syncpoints{};
|
||||
std::mutex reservation_lock;
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ static constexpr int TransitionTime(int year, Rule rule, int offset) {
|
|||
}
|
||||
|
||||
static bool ParsePosixName(const char* name, TimeZoneRule& rule) {
|
||||
constexpr char default_rule[]{",M4.1.0,M10.5.0"};
|
||||
static constexpr char default_rule[]{",M4.1.0,M10.5.0"};
|
||||
const char* std_name{name};
|
||||
int std_len{};
|
||||
int offset{};
|
||||
|
|
|
@ -34,7 +34,7 @@ static u64 GenerateTelemetryId() {
|
|||
mbedtls_entropy_context entropy;
|
||||
mbedtls_entropy_init(&entropy);
|
||||
mbedtls_ctr_drbg_context ctr_drbg;
|
||||
constexpr std::array<char, 18> personalization{{"yuzu Telemetry ID"}};
|
||||
static constexpr std::array<char, 18> personalization{{"yuzu Telemetry ID"}};
|
||||
|
||||
mbedtls_ctr_drbg_init(&ctr_drbg);
|
||||
ASSERT(mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func, &entropy,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue