EnTT 3.14.0
Loading...
Searching...
No Matches
config.h
1#ifndef ENTT_CONFIG_CONFIG_H
2#define ENTT_CONFIG_CONFIG_H
3
4#include "version.h"
5
6// NOLINTBEGIN(cppcoreguidelines-macro-usage)
7
8#if defined(__cpp_exceptions) && !defined(ENTT_NOEXCEPTION)
9# define ENTT_CONSTEXPR
10# define ENTT_THROW throw
11# define ENTT_TRY try
12# define ENTT_CATCH catch(...)
13#else
14# define ENTT_CONSTEXPR constexpr // use only with throwing functions (waiting for C++20)
15# define ENTT_THROW
16# define ENTT_TRY if(true)
17# define ENTT_CATCH if(false)
18#endif
19
20#ifdef ENTT_USE_ATOMIC
21# include <atomic>
22# define ENTT_MAYBE_ATOMIC(Type) std::atomic<Type>
23#else
24# define ENTT_MAYBE_ATOMIC(Type) Type
25#endif
26
27#ifndef ENTT_ID_TYPE
28# include <cstdint>
29# define ENTT_ID_TYPE std::uint32_t
30#else
31# include <cstdint> // provides coverage for types in the std namespace
32#endif
33
34#ifndef ENTT_SPARSE_PAGE
35# define ENTT_SPARSE_PAGE 4096
36#endif
37
38#ifndef ENTT_PACKED_PAGE
39# define ENTT_PACKED_PAGE 1024
40#endif
41
42#ifdef ENTT_DISABLE_ASSERT
43# undef ENTT_ASSERT
44# define ENTT_ASSERT(condition, msg) (void(0))
45#elif !defined ENTT_ASSERT
46# include <cassert>
47# define ENTT_ASSERT(condition, msg) assert(((condition) && (msg)))
48#endif
49
50#ifdef ENTT_DISABLE_ASSERT
51# undef ENTT_ASSERT_CONSTEXPR
52# define ENTT_ASSERT_CONSTEXPR(condition, msg) (void(0))
53#elif !defined ENTT_ASSERT_CONSTEXPR
54# define ENTT_ASSERT_CONSTEXPR(condition, msg) ENTT_ASSERT(condition, msg)
55#endif
56
57#define ENTT_FAIL(msg) ENTT_ASSERT(false, msg);
58
59#ifdef ENTT_NO_ETO
60# define ENTT_ETO_TYPE(Type) void
61#else
62# define ENTT_ETO_TYPE(Type) Type
63#endif
64
65#ifdef ENTT_NO_MIXIN
66# define ENTT_STORAGE(Mixin, ...) __VA_ARGS__
67#else
68# define ENTT_STORAGE(Mixin, ...) Mixin<__VA_ARGS__>
69#endif
70
71#ifdef ENTT_STANDARD_CPP
72# define ENTT_NONSTD false
73#else
74# define ENTT_NONSTD true
75# if defined __clang__ || defined __GNUC__
76# define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
77# define ENTT_PRETTY_FUNCTION_PREFIX '='
78# define ENTT_PRETTY_FUNCTION_SUFFIX ']'
79# elif defined _MSC_VER
80# define ENTT_PRETTY_FUNCTION __FUNCSIG__
81# define ENTT_PRETTY_FUNCTION_PREFIX '<'
82# define ENTT_PRETTY_FUNCTION_SUFFIX '>'
83# endif
84#endif
85
86#if defined _MSC_VER
87# pragma detect_mismatch("entt.version", ENTT_VERSION)
88# pragma detect_mismatch("entt.noexcept", ENTT_XSTR(ENTT_TRY))
89# pragma detect_mismatch("entt.id", ENTT_XSTR(ENTT_ID_TYPE))
90# pragma detect_mismatch("entt.nonstd", ENTT_XSTR(ENTT_NONSTD))
91#endif
92
93// NOLINTEND(cppcoreguidelines-macro-usage)
94
95#endif