2020-01-18 08:38:21 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 08:38:21 +00:00
|
|
|
*/
|
|
|
|
|
2018-10-16 09:01:38 +00:00
|
|
|
#pragma once
|
2019-04-03 10:51:10 +00:00
|
|
|
|
2020-06-27 19:42:28 +00:00
|
|
|
#define __STRINGIFY_HELPER(x) #x
|
|
|
|
#define __STRINGIFY(x) __STRINGIFY_HELPER(x)
|
|
|
|
|
2019-04-03 10:51:10 +00:00
|
|
|
[[noreturn]] void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func);
|
2021-06-29 13:46:50 +00:00
|
|
|
#define VERIFY(expr) \
|
|
|
|
do { \
|
|
|
|
if (!static_cast<bool>(expr)) [[unlikely]] \
|
|
|
|
__assertion_failed(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
|
|
|
|
} while (0)
|
|
|
|
|
2021-06-11 06:55:52 +00:00
|
|
|
#define VERIFY_NOT_REACHED() VERIFY(false)
|
2021-04-18 06:43:10 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
[[noreturn]] void _abort();
|
|
|
|
[[noreturn]] void abort();
|
|
|
|
}
|
2020-06-27 23:06:33 +00:00
|
|
|
|
2021-02-23 19:42:32 +00:00
|
|
|
#define VERIFY_INTERRUPTS_DISABLED() VERIFY(!(cpu_flags() & 0x200))
|
|
|
|
#define VERIFY_INTERRUPTS_ENABLED() VERIFY(cpu_flags() & 0x200)
|
2021-08-03 20:02:19 +00:00
|
|
|
|
|
|
|
static constexpr bool TODO = false;
|
|
|
|
#define TODO() VERIFY(TODO)
|