summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Rodrigo Locatti2021-01-09 03:13:25 -0300
committerGravatar GitHub2021-01-09 03:13:25 -0300
commit7bad1974a6bc2fba9f47824d4da23e888f6ff4a7 (patch)
tree77b7fe5542e1d5cc2d92ad3ea7410c6b95eca449 /src
parentMerge pull request #5231 from ReinUsesLisp/dyn-bindings (diff)
parentcmake: Enforce C4062, C4265, C4388, and C5038 (diff)
downloadyuzu-7bad1974a6bc2fba9f47824d4da23e888f6ff4a7.tar.gz
yuzu-7bad1974a6bc2fba9f47824d4da23e888f6ff4a7.tar.xz
yuzu-7bad1974a6bc2fba9f47824d4da23e888f6ff4a7.zip
Merge pull request #5319 from ReinUsesLisp/msvc-warnings
cmake: Enforce C4062, C4265, C4388, and C5038
Diffstat (limited to '')
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_32.cpp9
-rw-r--r--src/core/file_sys/registered_cache.h8
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.cpp6
-rw-r--r--src/tests/common/ring_buffer.cpp30
5 files changed, 28 insertions, 29 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8777df751..daf251d19 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -45,10 +45,14 @@ if (MSVC)
45 45
46 # Warnings 46 # Warnings
47 /W3 47 /W3
48 /we4062 # enumerator 'identifier' in a switch of enum 'enumeration' is not handled
49 /we4265 # 'class': class has virtual functions, but destructor is not virtual
50 /we4388 # signed/unsigned mismatch
48 /we4547 # 'operator' : operator before comma has no effect; expected operator with side-effect 51 /we4547 # 'operator' : operator before comma has no effect; expected operator with side-effect
49 /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'? 52 /we4549 # 'operator1': operator before comma has no effect; did you intend 'operator2'?
50 /we4555 # Expression has no effect; expected expression with side-effect 53 /we4555 # Expression has no effect; expected expression with side-effect
51 /we4834 # Discarding return value of function with 'nodiscard' attribute 54 /we4834 # Discarding return value of function with 'nodiscard' attribute
55 /we5038 # data member 'member1' will be initialized after data member 'member2'
52 ) 56 )
53 57
54 # /GS- - No stack buffer overflow checks 58 # /GS- - No stack buffer overflow checks
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
index 0831dd5d2..6c4c8e9e4 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
@@ -71,15 +71,8 @@ public:
71 } 71 }
72 72
73 void ExceptionRaised(u32 pc, Dynarmic::A32::Exception exception) override { 73 void ExceptionRaised(u32 pc, Dynarmic::A32::Exception exception) override {
74 switch (exception) {
75 case Dynarmic::A32::Exception::UndefinedInstruction:
76 case Dynarmic::A32::Exception::UnpredictableInstruction:
77 break;
78 case Dynarmic::A32::Exception::Breakpoint:
79 break;
80 }
81 LOG_CRITICAL(Core_ARM, "ExceptionRaised(exception = {}, pc = {:08X}, code = {:08X})", 74 LOG_CRITICAL(Core_ARM, "ExceptionRaised(exception = {}, pc = {:08X}, code = {:08X})",
82 static_cast<std::size_t>(exception), pc, MemoryReadCode(pc)); 75 exception, pc, MemoryReadCode(pc));
83 UNIMPLEMENTED(); 76 UNIMPLEMENTED();
84 } 77 }
85 78
diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h
index 5b414b0f0..b08a1687a 100644
--- a/src/core/file_sys/registered_cache.h
+++ b/src/core/file_sys/registered_cache.h
@@ -67,18 +67,18 @@ public:
67 virtual void Refresh() = 0; 67 virtual void Refresh() = 0;
68 68
69 virtual bool HasEntry(u64 title_id, ContentRecordType type) const = 0; 69 virtual bool HasEntry(u64 title_id, ContentRecordType type) const = 0;
70 virtual bool HasEntry(ContentProviderEntry entry) const; 70 bool HasEntry(ContentProviderEntry entry) const;
71 71
72 virtual std::optional<u32> GetEntryVersion(u64 title_id) const = 0; 72 virtual std::optional<u32> GetEntryVersion(u64 title_id) const = 0;
73 73
74 virtual VirtualFile GetEntryUnparsed(u64 title_id, ContentRecordType type) const = 0; 74 virtual VirtualFile GetEntryUnparsed(u64 title_id, ContentRecordType type) const = 0;
75 virtual VirtualFile GetEntryUnparsed(ContentProviderEntry entry) const; 75 VirtualFile GetEntryUnparsed(ContentProviderEntry entry) const;
76 76
77 virtual VirtualFile GetEntryRaw(u64 title_id, ContentRecordType type) const = 0; 77 virtual VirtualFile GetEntryRaw(u64 title_id, ContentRecordType type) const = 0;
78 virtual VirtualFile GetEntryRaw(ContentProviderEntry entry) const; 78 VirtualFile GetEntryRaw(ContentProviderEntry entry) const;
79 79
80 virtual std::unique_ptr<NCA> GetEntry(u64 title_id, ContentRecordType type) const = 0; 80 virtual std::unique_ptr<NCA> GetEntry(u64 title_id, ContentRecordType type) const = 0;
81 virtual std::unique_ptr<NCA> GetEntry(ContentProviderEntry entry) const; 81 std::unique_ptr<NCA> GetEntry(ContentProviderEntry entry) const;
82 82
83 virtual std::vector<ContentProviderEntry> ListEntries() const; 83 virtual std::vector<ContentProviderEntry> ListEntries() const;
84 84
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp
index c68905e19..5578181a4 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue.cpp
@@ -180,9 +180,11 @@ u32 BufferQueue::Query(QueryType type) {
180 switch (type) { 180 switch (type) {
181 case QueryType::NativeWindowFormat: 181 case QueryType::NativeWindowFormat:
182 return static_cast<u32>(PixelFormat::RGBA8888); 182 return static_cast<u32>(PixelFormat::RGBA8888);
183 case QueryType::NativeWindowWidth:
184 case QueryType::NativeWindowHeight:
185 break;
183 } 186 }
184 187 UNIMPLEMENTED_MSG("Unimplemented query type={}", type);
185 UNIMPLEMENTED();
186 return 0; 188 return 0;
187} 189}
188 190
diff --git a/src/tests/common/ring_buffer.cpp b/src/tests/common/ring_buffer.cpp
index c883c4d56..54def22da 100644
--- a/src/tests/common/ring_buffer.cpp
+++ b/src/tests/common/ring_buffer.cpp
@@ -20,60 +20,60 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") {
20 for (std::size_t i = 0; i < 4; i++) { 20 for (std::size_t i = 0; i < 4; i++) {
21 const char elem = static_cast<char>(i); 21 const char elem = static_cast<char>(i);
22 const std::size_t count = buf.Push(&elem, 1); 22 const std::size_t count = buf.Push(&elem, 1);
23 REQUIRE(count == 1); 23 REQUIRE(count == 1U);
24 } 24 }
25 25
26 REQUIRE(buf.Size() == 4); 26 REQUIRE(buf.Size() == 4U);
27 27
28 // Pushing values into a full ring buffer should fail. 28 // Pushing values into a full ring buffer should fail.
29 { 29 {
30 const char elem = static_cast<char>(42); 30 const char elem = static_cast<char>(42);
31 const std::size_t count = buf.Push(&elem, 1); 31 const std::size_t count = buf.Push(&elem, 1);
32 REQUIRE(count == 0); 32 REQUIRE(count == 0U);
33 } 33 }
34 34
35 REQUIRE(buf.Size() == 4); 35 REQUIRE(buf.Size() == 4U);
36 36
37 // Popping multiple values from a ring buffer with values should succeed. 37 // Popping multiple values from a ring buffer with values should succeed.
38 { 38 {
39 const std::vector<char> popped = buf.Pop(2); 39 const std::vector<char> popped = buf.Pop(2);
40 REQUIRE(popped.size() == 2); 40 REQUIRE(popped.size() == 2U);
41 REQUIRE(popped[0] == 0); 41 REQUIRE(popped[0] == 0);
42 REQUIRE(popped[1] == 1); 42 REQUIRE(popped[1] == 1);
43 } 43 }
44 44
45 REQUIRE(buf.Size() == 2); 45 REQUIRE(buf.Size() == 2U);
46 46
47 // Popping a single value from a ring buffer with values should succeed. 47 // Popping a single value from a ring buffer with values should succeed.
48 { 48 {
49 const std::vector<char> popped = buf.Pop(1); 49 const std::vector<char> popped = buf.Pop(1);
50 REQUIRE(popped.size() == 1); 50 REQUIRE(popped.size() == 1U);
51 REQUIRE(popped[0] == 2); 51 REQUIRE(popped[0] == 2);
52 } 52 }
53 53
54 REQUIRE(buf.Size() == 1); 54 REQUIRE(buf.Size() == 1U);
55 55
56 // Pushing more values than space available should partially suceed. 56 // Pushing more values than space available should partially suceed.
57 { 57 {
58 std::vector<char> to_push(6); 58 std::vector<char> to_push(6);
59 std::iota(to_push.begin(), to_push.end(), 88); 59 std::iota(to_push.begin(), to_push.end(), 88);
60 const std::size_t count = buf.Push(to_push); 60 const std::size_t count = buf.Push(to_push);
61 REQUIRE(count == 3); 61 REQUIRE(count == 3U);
62 } 62 }
63 63
64 REQUIRE(buf.Size() == 4); 64 REQUIRE(buf.Size() == 4U);
65 65
66 // Doing an unlimited pop should pop all values. 66 // Doing an unlimited pop should pop all values.
67 { 67 {
68 const std::vector<char> popped = buf.Pop(); 68 const std::vector<char> popped = buf.Pop();
69 REQUIRE(popped.size() == 4); 69 REQUIRE(popped.size() == 4U);
70 REQUIRE(popped[0] == 3); 70 REQUIRE(popped[0] == 3);
71 REQUIRE(popped[1] == 88); 71 REQUIRE(popped[1] == 88);
72 REQUIRE(popped[2] == 89); 72 REQUIRE(popped[2] == 89);
73 REQUIRE(popped[3] == 90); 73 REQUIRE(popped[3] == 90);
74 } 74 }
75 75
76 REQUIRE(buf.Size() == 0); 76 REQUIRE(buf.Size() == 0U);
77} 77}
78 78
79TEST_CASE("RingBuffer: Threaded Test", "[common]") { 79TEST_CASE("RingBuffer: Threaded Test", "[common]") {
@@ -93,7 +93,7 @@ TEST_CASE("RingBuffer: Threaded Test", "[common]") {
93 std::size_t i = 0; 93 std::size_t i = 0;
94 while (i < count) { 94 while (i < count) {
95 if (const std::size_t c = buf.Push(&value[0], 1); c > 0) { 95 if (const std::size_t c = buf.Push(&value[0], 1); c > 0) {
96 REQUIRE(c == 1); 96 REQUIRE(c == 1U);
97 i++; 97 i++;
98 next_value(value); 98 next_value(value);
99 } else { 99 } else {
@@ -108,7 +108,7 @@ TEST_CASE("RingBuffer: Threaded Test", "[common]") {
108 std::size_t i = 0; 108 std::size_t i = 0;
109 while (i < count) { 109 while (i < count) {
110 if (const std::vector<char> v = buf.Pop(1); v.size() > 0) { 110 if (const std::vector<char> v = buf.Pop(1); v.size() > 0) {
111 REQUIRE(v.size() == 2); 111 REQUIRE(v.size() == 2U);
112 REQUIRE(v[0] == value[0]); 112 REQUIRE(v[0] == value[0]);
113 REQUIRE(v[1] == value[1]); 113 REQUIRE(v[1] == value[1]);
114 i++; 114 i++;
@@ -123,7 +123,7 @@ TEST_CASE("RingBuffer: Threaded Test", "[common]") {
123 producer.join(); 123 producer.join();
124 consumer.join(); 124 consumer.join();
125 125
126 REQUIRE(buf.Size() == 0); 126 REQUIRE(buf.Size() == 0U);
127 printf("RingBuffer: Threaded Test: full: %zu, empty: %zu\n", full, empty); 127 printf("RingBuffer: Threaded Test: full: %zu, empty: %zu\n", full, empty);
128} 128}
129 129