2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
2018-10-10 11:53:07 +02:00
|
|
|
#pragma once
|
|
|
|
|
2021-02-23 11:03:03 +03:30
|
|
|
#if defined(KERNEL)
|
2023-02-24 20:10:59 +02:00
|
|
|
# include <Kernel/Library/Assertions.h>
|
2021-02-23 11:03:03 +03:30
|
|
|
#else
|
2023-02-05 08:15:55 -07:00
|
|
|
extern "C" __attribute__((noreturn)) void ak_verification_failed(char const*);
|
2023-08-30 16:54:33 +02:00
|
|
|
# define __stringify_helper(x) #x
|
|
|
|
# define __stringify(x) __stringify_helper(x)
|
|
|
|
# define VERIFY(expr) \
|
|
|
|
(__builtin_expect(!(expr), 0) \
|
|
|
|
? ak_verification_failed(#expr " at " __FILE__ ":" __stringify(__LINE__)) \
|
|
|
|
: (void)0)
|
2022-07-08 14:16:53 +02:00
|
|
|
# define VERIFY_NOT_REACHED() VERIFY(false) /* NOLINT(cert-dcl03-c,misc-static-assert) No, this can't be static_assert, it's a runtime check */
|
2021-08-03 20:02:19 +00:00
|
|
|
static constexpr bool TODO = false;
|
2022-02-21 17:34:19 +01:00
|
|
|
# define TODO() VERIFY(TODO) /* NOLINT(cert-dcl03-c,misc-static-assert) No, this can't be static_assert, it's a runtime check */
|
2022-10-12 21:55:05 +02:00
|
|
|
# define TODO_AARCH64() VERIFY(TODO) /* NOLINT(cert-dcl03-c,misc-static-assert) No, this can't be static_assert, it's a runtime check */
|
2023-08-20 19:46:05 +02:00
|
|
|
# define TODO_RISCV64() VERIFY(TODO) /* NOLINT(cert-dcl03-c,misc-static-assert) No, this can't be static_assert, it's a runtime check */
|
2019-08-02 09:23:03 +02:00
|
|
|
#endif
|