-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaem.h
More file actions
68 lines (55 loc) · 1.33 KB
/
aem.h
File metadata and controls
68 lines (55 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef AEM_H
#define AEM_H
#ifdef __GNUC__
# define AEM_CONFIG_HAVE_STMT_EXPR
#endif
#ifdef AEM_DEBUG
// Debug mode
# ifndef aem_break
# include "debugbreak.h"
# define aem_break() debug_break()
# endif
# ifndef aem_abort
# ifdef AEM_BREAK_ON_ABORT
# define aem_abort() aem_break()
# else
# define aem_abort() abort()
# endif
# endif
#else /* !defined(AEM_DEBUG) */
# ifndef aem_abort
# if !defined(AEM_RECKLESS)
# define aem_abort() abort()
# elif defined(__GNUC__)
# define aem_abort() __builtin_unreachable()
# else
// You're crazy!
# define aem_abort() do {} while (0)
# endif
# endif
# ifndef aem_break
# define aem_break() aem_abort()
# endif
# ifndef aem_unreachable
# ifdef _WIN32
# define __builtin_unreachable() __assume(0)
# else
# define aem_unreachable() __builtin_unreachable()
# endif
# endif
#endif /* AEM_DEBUG */
#ifdef __GNUC__
# define aem_deprecated __attribute__((deprecated))
# define aem_deprecated_msg(msg) __attribute__((deprecated(msg)))
# define AEM_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
#else
# define aem_deprecated
# define aem_deprecated_msg(msg)
# define AEM_STATIC_ASSERT(cond, msg) ((void)sizeof(struct{int:-!(cond);}))
#endif
#define AEM_STRINGIFY(s) #s
#define AEM_STRINGIFY2(s) AEM_STRINGIFY(s)
#ifdef _WIN32
# define __thread __declspec(thread)
#endif
#endif /* AEM_H */