From 144a79ee00951ed175a9ea3ebc28eb821f855138 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 27 Mar 2022 22:34:02 +0200 Subject: fixed ASSERT and last commit's oopsie --- src/defines.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/defines.hpp') diff --git a/src/defines.hpp b/src/defines.hpp index ff7588e0..e12aa53a 100644 --- a/src/defines.hpp +++ b/src/defines.hpp @@ -26,6 +26,10 @@ #define HYPRATOM(name) {name, 0} -#define RASSERT(expr, reason) if (expr) { Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %s in %s", reason, __LINE__, __FILE__); RIP("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info.");} +#define RASSERT(expr, reason) \ + if (!expr) { \ + Debug::log(CRIT, "\n==========================================================================================\nASSERTION FAILED! \n\n%s\n\nat: line %d in %s", std::string(reason).c_str(), __LINE__, ([]() constexpr->std::string { return std::string(__FILE__).substr(std::string(__FILE__).find_last_of('/') + 1); })().c_str()); \ + RIP("Assertion failed! See the log in /tmp/hypr/hyprland.log for more info."); \ + } #define ASSERT(expr) RASSERT(expr, "?") \ No newline at end of file -- cgit v1.2.3