mirror of https://git.suyu.dev/suyu/suyu
Merge pull request #587 from archshift/assert
Convert a few C stdlib asserts to Citra's own asserts
This commit is contained in:
commit
c7d1480ece
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -267,7 +266,7 @@ public:
|
||||||
ResultVal(ResultCode error_code = ResultCode(-1))
|
ResultVal(ResultCode error_code = ResultCode(-1))
|
||||||
: result_code(error_code)
|
: result_code(error_code)
|
||||||
{
|
{
|
||||||
assert(error_code.IsError());
|
ASSERT(error_code.IsError());
|
||||||
UpdateDebugPtr();
|
UpdateDebugPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +329,7 @@ public:
|
||||||
*/
|
*/
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
void emplace(ResultCode success_code, Args&&... args) {
|
void emplace(ResultCode success_code, Args&&... args) {
|
||||||
assert(success_code.IsSuccess());
|
ASSERT(success_code.IsSuccess());
|
||||||
if (!empty()) {
|
if (!empty()) {
|
||||||
GetPointer()->~T();
|
GetPointer()->~T();
|
||||||
}
|
}
|
||||||
|
@ -362,7 +361,6 @@ public:
|
||||||
|
|
||||||
/// Asserts that the result succeeded and returns a reference to it.
|
/// Asserts that the result succeeded and returns a reference to it.
|
||||||
T& Unwrap() {
|
T& Unwrap() {
|
||||||
// TODO(yuriks): Should be a release assert
|
|
||||||
ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal");
|
ASSERT_MSG(Succeeded(), "Tried to Unwrap empty ResultVal");
|
||||||
return **this;
|
return **this;
|
||||||
}
|
}
|
||||||
|
@ -389,12 +387,12 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
const T* GetPointer() const {
|
const T* GetPointer() const {
|
||||||
assert(!empty());
|
ASSERT(!empty());
|
||||||
return static_cast<const T*>(static_cast<const void*>(&storage));
|
return static_cast<const T*>(static_cast<const void*>(&storage));
|
||||||
}
|
}
|
||||||
|
|
||||||
T* GetPointer() {
|
T* GetPointer() {
|
||||||
assert(!empty());
|
ASSERT(!empty());
|
||||||
return static_cast<T*>(static_cast<void*>(&storage));
|
return static_cast<T*>(static_cast<void*>(&storage));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue