Zrythm
v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
debug.h
1
// SPDX-FileCopyrightText: © 2021-2022, 2024-2025 Alexandros Theodotou <alex@zrythm.org>
2
// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4
#pragma once
5
6
#include "utils/logger.h"
7
13
14
#define z_return_val_if_fail_cmp(a, comparator, b, val) \
15
if (!((a) comparator (b))) [[unlikely]] \
16
{ \
17
z_error ( \
18
"Assertion failed: `{}` ({}) {} `{}` ({})", #a, (a), #comparator, #b, \
19
(b)); \
20
return val; \
21
}
22
23
#define z_return_if_fail_cmp(a, comparator, b) \
24
z_return_val_if_fail_cmp (a, comparator, b, )
25
26
#define z_warn_if_fail_cmp(a, comparator, b) \
27
if (!((a) comparator (b))) [[unlikely]] \
28
{ \
29
z_warning ( \
30
"Assertion failed: `{}` ({}) {} `{}` ({})", #a, (a), #comparator, #b, \
31
(b)); \
32
}
33
34
#ifdef _MSC_VER
35
# include <intrin.h>
36
# define DEBUG_BREAK() __debugbreak ()
37
#elifdef __APPLE__
38
# include <TargetConditionals.h>
39
# if TARGET_OS_MAC
40
# define DEBUG_BREAK() __builtin_debugtrap ()
41
# endif
42
#elif defined(__linux__) || defined(__unix__)
43
# include <csignal>
44
# define DEBUG_BREAK() raise (SIGTRAP)
45
#else
46
# define DEBUG_BREAK() \
47
do \
48
{ \
49
volatile int * p = 0; \
50
*p = 0; \
51
} \
52
while (0)
53
#endif
54
src
utils
debug.h
Generated by
1.15.0