summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2015-02-19 13:45:58 -0500
committerGravatar bunnei2015-02-19 13:45:58 -0500
commitc7d1480ece78126801e308fd9a9a9a1664e34428 (patch)
tree614465509e7a8c6fe7a0b3d0f45a1c06e103c29e /src
parentMerge pull request #585 from Subv/local_var (diff)
parentConvert a few C stdlib asserts to Citra's own asserts (diff)
downloadyuzu-c7d1480ece78126801e308fd9a9a9a1664e34428.tar.gz
yuzu-c7d1480ece78126801e308fd9a9a9a1664e34428.tar.xz
yuzu-c7d1480ece78126801e308fd9a9a9a1664e34428.zip
Merge pull request #587 from archshift/assert
Convert a few C stdlib asserts to Citra's own asserts
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/result.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index 9dbd5a914..0e391fe2d 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -4,7 +4,6 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <cassert>
8#include <cstddef> 7#include <cstddef>
9#include <type_traits> 8#include <type_traits>
10#include <utility> 9#include <utility>
@@ -267,7 +266,7 @@ public:
267 ResultVal(ResultCode error_code = ResultCode(-1)) 266 ResultVal(ResultCode error_code = ResultCode(-1))
268 : result_code(error_code) 267 : result_code(error_code)
269 { 268 {
270 assert(error_code.IsError()); 269 ASSERT(error_code.IsError());
271 UpdateDebugPtr(); 270 UpdateDebugPtr();
272 } 271 }
273 272
@@ -330,7 +329,7 @@ public:
330 */ 329 */
331 template <typename... Args> 330 template <typename... Args>
332 void emplace(ResultCode success_code, Args&&... args) { 331 void emplace(ResultCode success_code, Args&&... args) {
333 assert(success_code.IsSuccess()); 332 ASSERT(success_code.IsSuccess());
334 if (!empty()) { 333 if (!empty()) {
335 GetPointer()->~T(); 334 GetPointer()->~T();
336 } 335 }
@@ -362,7 +361,6 @@ public:
362 361
363 /// Asserts that the result succeeded and returns a reference to it. 362 /// Asserts that the result succeeded and returns a reference to it.
364 T& Unwrap() { 363 T& Unwrap() {
365 // TODO(yuriks): Should be a release assert
366 ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal"); 364 ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal");
367 return **this; 365 return **this;
368 } 366 }
@@ -389,12 +387,12 @@ private:
389 } 387 }
390 388
391 const T* GetPointer() const { 389 const T* GetPointer() const {
392 assert(!empty()); 390 ASSERT(!empty());
393 return static_cast<const T*>(static_cast<const void*>(&storage)); 391 return static_cast<const T*>(static_cast<const void*>(&storage));
394 } 392 }
395 393
396 T* GetPointer() { 394 T* GetPointer() {
397 assert(!empty()); 395 ASSERT(!empty());
398 return static_cast<T*>(static_cast<void*>(&storage)); 396 return static_cast<T*>(static_cast<void*>(&storage));
399 } 397 }
400}; 398};