mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
c4a92571b2
* ci: fix windows releases (hopefully) * scripts: fix Taskfile file references for linux * asserts: add `ASSERT_MSG` macro and ensure `stdout` is flushed before `abort`ing * asserts: refactor all `assert(false);` with a preceeding message instances * lint: format * temp... * fix compiler errors * assert: allow for string literals in `ASSERT_MSG` * lint: formatting * revert temp change for testing
31 lines
986 B
C++
31 lines
986 B
C++
/*!
|
|
* @file assert.h
|
|
* Custom ASSERT macro
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string_view>
|
|
|
|
[[noreturn]] void private_assert_failed(const char* expr,
|
|
const char* file,
|
|
int line,
|
|
const char* function,
|
|
const char* msg = "");
|
|
|
|
[[noreturn]] void private_assert_failed(const char* expr,
|
|
const char* file,
|
|
int line,
|
|
const char* function,
|
|
const std::string_view& msg);
|
|
|
|
#ifdef _WIN32
|
|
#define __PRETTY_FUNCTION__ __FUNCSIG__
|
|
#endif
|
|
|
|
#define ASSERT(EX) \
|
|
(void)((EX) || (private_assert_failed(#EX, __FILE__, __LINE__, __PRETTY_FUNCTION__), 0))
|
|
|
|
#define ASSERT_MSG(EXPR, STR) \
|
|
(void)((EXPR) || (private_assert_failed(#EXPR, __FILE__, __LINE__, __PRETTY_FUNCTION__, STR), 0))
|