Merge pull request #5319 from ReinUsesLisp/msvc-warnings
cmake: Enforce C4062, C4265, C4388, and C5038
This commit is contained in:
commit
7bad1974a6
|
@ -45,10 +45,14 @@ if (MSVC)
|
||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
/W3
|
/W3
|
||||||
|
/we4062 # enumerator 'identifier' in a switch of enum 'enumeration' is not handled
|
||||||
|
/we4265 # 'class': class has virtual functions, but destructor is not virtual
|
||||||
|
/we4388 # signed/unsigned mismatch
|
||||||
/we4547 # 'operator' : operator before comma has no effect; expected operator with side-effect
|
/we4547 # 'operator' : operator before comma has no effect; expected operator with side-effect
|
||||||
/we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'?
|
/we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'?
|
||||||
/we4555 # Expression has no effect; expected expression with side-effect
|
/we4555 # Expression has no effect; expected expression with side-effect
|
||||||
/we4834 # Discarding return value of function with 'nodiscard' attribute
|
/we4834 # Discarding return value of function with 'nodiscard' attribute
|
||||||
|
/we5038 # data member 'member1' will be initialized after data member 'member2'
|
||||||
)
|
)
|
||||||
|
|
||||||
# /GS- - No stack buffer overflow checks
|
# /GS- - No stack buffer overflow checks
|
||||||
|
|
|
@ -71,15 +71,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExceptionRaised(u32 pc, Dynarmic::A32::Exception exception) override {
|
void ExceptionRaised(u32 pc, Dynarmic::A32::Exception exception) override {
|
||||||
switch (exception) {
|
|
||||||
case Dynarmic::A32::Exception::UndefinedInstruction:
|
|
||||||
case Dynarmic::A32::Exception::UnpredictableInstruction:
|
|
||||||
break;
|
|
||||||
case Dynarmic::A32::Exception::Breakpoint:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
LOG_CRITICAL(Core_ARM, "ExceptionRaised(exception = {}, pc = {:08X}, code = {:08X})",
|
LOG_CRITICAL(Core_ARM, "ExceptionRaised(exception = {}, pc = {:08X}, code = {:08X})",
|
||||||
static_cast<std::size_t>(exception), pc, MemoryReadCode(pc));
|
exception, pc, MemoryReadCode(pc));
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,18 +67,18 @@ public:
|
||||||
virtual void Refresh() = 0;
|
virtual void Refresh() = 0;
|
||||||
|
|
||||||
virtual bool HasEntry(u64 title_id, ContentRecordType type) const = 0;
|
virtual bool HasEntry(u64 title_id, ContentRecordType type) const = 0;
|
||||||
virtual bool HasEntry(ContentProviderEntry entry) const;
|
bool HasEntry(ContentProviderEntry entry) const;
|
||||||
|
|
||||||
virtual std::optional<u32> GetEntryVersion(u64 title_id) const = 0;
|
virtual std::optional<u32> GetEntryVersion(u64 title_id) const = 0;
|
||||||
|
|
||||||
virtual VirtualFile GetEntryUnparsed(u64 title_id, ContentRecordType type) const = 0;
|
virtual VirtualFile GetEntryUnparsed(u64 title_id, ContentRecordType type) const = 0;
|
||||||
virtual VirtualFile GetEntryUnparsed(ContentProviderEntry entry) const;
|
VirtualFile GetEntryUnparsed(ContentProviderEntry entry) const;
|
||||||
|
|
||||||
virtual VirtualFile GetEntryRaw(u64 title_id, ContentRecordType type) const = 0;
|
virtual VirtualFile GetEntryRaw(u64 title_id, ContentRecordType type) const = 0;
|
||||||
virtual VirtualFile GetEntryRaw(ContentProviderEntry entry) const;
|
VirtualFile GetEntryRaw(ContentProviderEntry entry) const;
|
||||||
|
|
||||||
virtual std::unique_ptr<NCA> GetEntry(u64 title_id, ContentRecordType type) const = 0;
|
virtual std::unique_ptr<NCA> GetEntry(u64 title_id, ContentRecordType type) const = 0;
|
||||||
virtual std::unique_ptr<NCA> GetEntry(ContentProviderEntry entry) const;
|
std::unique_ptr<NCA> GetEntry(ContentProviderEntry entry) const;
|
||||||
|
|
||||||
virtual std::vector<ContentProviderEntry> ListEntries() const;
|
virtual std::vector<ContentProviderEntry> ListEntries() const;
|
||||||
|
|
||||||
|
|
|
@ -180,9 +180,11 @@ u32 BufferQueue::Query(QueryType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QueryType::NativeWindowFormat:
|
case QueryType::NativeWindowFormat:
|
||||||
return static_cast<u32>(PixelFormat::RGBA8888);
|
return static_cast<u32>(PixelFormat::RGBA8888);
|
||||||
|
case QueryType::NativeWindowWidth:
|
||||||
|
case QueryType::NativeWindowHeight:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
UNIMPLEMENTED_MSG("Unimplemented query type={}", type);
|
||||||
UNIMPLEMENTED();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,60 +20,60 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") {
|
||||||
for (std::size_t i = 0; i < 4; i++) {
|
for (std::size_t i = 0; i < 4; i++) {
|
||||||
const char elem = static_cast<char>(i);
|
const char elem = static_cast<char>(i);
|
||||||
const std::size_t count = buf.Push(&elem, 1);
|
const std::size_t count = buf.Push(&elem, 1);
|
||||||
REQUIRE(count == 1);
|
REQUIRE(count == 1U);
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE(buf.Size() == 4);
|
REQUIRE(buf.Size() == 4U);
|
||||||
|
|
||||||
// Pushing values into a full ring buffer should fail.
|
// Pushing values into a full ring buffer should fail.
|
||||||
{
|
{
|
||||||
const char elem = static_cast<char>(42);
|
const char elem = static_cast<char>(42);
|
||||||
const std::size_t count = buf.Push(&elem, 1);
|
const std::size_t count = buf.Push(&elem, 1);
|
||||||
REQUIRE(count == 0);
|
REQUIRE(count == 0U);
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE(buf.Size() == 4);
|
REQUIRE(buf.Size() == 4U);
|
||||||
|
|
||||||
// Popping multiple values from a ring buffer with values should succeed.
|
// Popping multiple values from a ring buffer with values should succeed.
|
||||||
{
|
{
|
||||||
const std::vector<char> popped = buf.Pop(2);
|
const std::vector<char> popped = buf.Pop(2);
|
||||||
REQUIRE(popped.size() == 2);
|
REQUIRE(popped.size() == 2U);
|
||||||
REQUIRE(popped[0] == 0);
|
REQUIRE(popped[0] == 0);
|
||||||
REQUIRE(popped[1] == 1);
|
REQUIRE(popped[1] == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE(buf.Size() == 2);
|
REQUIRE(buf.Size() == 2U);
|
||||||
|
|
||||||
// Popping a single value from a ring buffer with values should succeed.
|
// Popping a single value from a ring buffer with values should succeed.
|
||||||
{
|
{
|
||||||
const std::vector<char> popped = buf.Pop(1);
|
const std::vector<char> popped = buf.Pop(1);
|
||||||
REQUIRE(popped.size() == 1);
|
REQUIRE(popped.size() == 1U);
|
||||||
REQUIRE(popped[0] == 2);
|
REQUIRE(popped[0] == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE(buf.Size() == 1);
|
REQUIRE(buf.Size() == 1U);
|
||||||
|
|
||||||
// Pushing more values than space available should partially suceed.
|
// Pushing more values than space available should partially suceed.
|
||||||
{
|
{
|
||||||
std::vector<char> to_push(6);
|
std::vector<char> to_push(6);
|
||||||
std::iota(to_push.begin(), to_push.end(), 88);
|
std::iota(to_push.begin(), to_push.end(), 88);
|
||||||
const std::size_t count = buf.Push(to_push);
|
const std::size_t count = buf.Push(to_push);
|
||||||
REQUIRE(count == 3);
|
REQUIRE(count == 3U);
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE(buf.Size() == 4);
|
REQUIRE(buf.Size() == 4U);
|
||||||
|
|
||||||
// Doing an unlimited pop should pop all values.
|
// Doing an unlimited pop should pop all values.
|
||||||
{
|
{
|
||||||
const std::vector<char> popped = buf.Pop();
|
const std::vector<char> popped = buf.Pop();
|
||||||
REQUIRE(popped.size() == 4);
|
REQUIRE(popped.size() == 4U);
|
||||||
REQUIRE(popped[0] == 3);
|
REQUIRE(popped[0] == 3);
|
||||||
REQUIRE(popped[1] == 88);
|
REQUIRE(popped[1] == 88);
|
||||||
REQUIRE(popped[2] == 89);
|
REQUIRE(popped[2] == 89);
|
||||||
REQUIRE(popped[3] == 90);
|
REQUIRE(popped[3] == 90);
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE(buf.Size() == 0);
|
REQUIRE(buf.Size() == 0U);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("RingBuffer: Threaded Test", "[common]") {
|
TEST_CASE("RingBuffer: Threaded Test", "[common]") {
|
||||||
|
@ -93,7 +93,7 @@ TEST_CASE("RingBuffer: Threaded Test", "[common]") {
|
||||||
std::size_t i = 0;
|
std::size_t i = 0;
|
||||||
while (i < count) {
|
while (i < count) {
|
||||||
if (const std::size_t c = buf.Push(&value[0], 1); c > 0) {
|
if (const std::size_t c = buf.Push(&value[0], 1); c > 0) {
|
||||||
REQUIRE(c == 1);
|
REQUIRE(c == 1U);
|
||||||
i++;
|
i++;
|
||||||
next_value(value);
|
next_value(value);
|
||||||
} else {
|
} else {
|
||||||
|
@ -108,7 +108,7 @@ TEST_CASE("RingBuffer: Threaded Test", "[common]") {
|
||||||
std::size_t i = 0;
|
std::size_t i = 0;
|
||||||
while (i < count) {
|
while (i < count) {
|
||||||
if (const std::vector<char> v = buf.Pop(1); v.size() > 0) {
|
if (const std::vector<char> v = buf.Pop(1); v.size() > 0) {
|
||||||
REQUIRE(v.size() == 2);
|
REQUIRE(v.size() == 2U);
|
||||||
REQUIRE(v[0] == value[0]);
|
REQUIRE(v[0] == value[0]);
|
||||||
REQUIRE(v[1] == value[1]);
|
REQUIRE(v[1] == value[1]);
|
||||||
i++;
|
i++;
|
||||||
|
@ -123,7 +123,7 @@ TEST_CASE("RingBuffer: Threaded Test", "[common]") {
|
||||||
producer.join();
|
producer.join();
|
||||||
consumer.join();
|
consumer.join();
|
||||||
|
|
||||||
REQUIRE(buf.Size() == 0);
|
REQUIRE(buf.Size() == 0U);
|
||||||
printf("RingBuffer: Threaded Test: full: %zu, empty: %zu\n", full, empty);
|
printf("RingBuffer: Threaded Test: full: %zu, empty: %zu\n", full, empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue