12#error #include <hx/libhatchet.h> instead.
17#define __has_include(x) 0
21#if defined HX_DOXYGEN_PARSER
31#define HX_CPLUSPLUS 202302L
33#define HX_C_BEGIN_ extern "C" {
36#elif defined __cplusplus
37#define HX_CPLUSPLUS __cplusplus
38#define HX_C_BEGIN_ extern "C" {
47#if !defined HX_USE_INLINING_ATTR
50#define HX_USE_INLINING_ATTR 1
55#if defined HX_DOXYGEN_PARSER
59#define HX_USE_THREADS 11
65#define HX_USE_LIBCXX 1
70#define hxbreakpoint() true
79#define hxattr_allocator(...)
83#define hxattr_assume(...) (void)0
98#define hxattr_nodiscard
102#define hxattr_noexcept
106#define hxattr_nonnull(...)
109#define hxattr_noinline
113#define hxattr_noreturn
117#define hxattr_printf(...)
125#define hxinline inline
129#elif defined _MSC_VER
132#error Clang detected masquerading as MSVC - not supported due to intrinsic use.
135#if !defined __cpp_exceptions && !defined _HAS_EXCEPTIONS
136#define _HAS_EXCEPTIONS 0
139#if !defined HX_USE_THREADS
140#define HX_USE_THREADS 11
143#if !defined HX_USE_LIBCXX
144#define HX_USE_LIBCXX 1
147#define hxbreakpoint() (__debugbreak(),true)
148#define hxrestrict __restrict
149#define hxattr_allocator(...)
150#define hxattr_assume(condition_) __assume(condition_)
152#define hxattr_flatten
155#define hxattr_nodiscard [[nodiscard]]
157#define hxattr_nodiscard
159#define hxattr_noexcept
160#define hxattr_nonnull(...)
161#define hxattr_noinline __declspec(noinline)
163#define hxattr_noreturn [[noreturn]]
165#define hxattr_noreturn
167#define hxattr_printf(...)
172#if HX_USE_INLINING_ATTR
173#define hxinline inline __forceinline
175#define hxinline inline
184#if !defined HX_USE_THREADS
185#if __has_include(<threads.h>)
186#define HX_USE_THREADS 11
187#elif defined _POSIX_THREADS
188#define HX_USE_THREADS 1
190#define HX_USE_THREADS 0
194#if !defined HX_USE_LIBCXX
195#define HX_USE_LIBCXX 1
196#elif !(HX_USE_LIBCXX) && !defined HX_SKIP_LIBCXX_CHECK && __has_include(<new>)
197#error Use -nostdinc++ to use the C headers instead of the C++ ones.
201#if !defined HX_USE_SIGTRAP && defined __has_builtin && __has_builtin(__builtin_debugtrap)
202#define hxbreakpoint() (__builtin_debugtrap(),true)
204#define hxbreakpoint() (raise(SIGTRAP),true)
207#define hxrestrict __restrict
211#define hxattr_allocator(...) \
212 __attribute__((returns_nonnull)) __attribute__((warn_unused_result))
214#define hxattr_allocator(...) __attribute__((malloc(__VA_ARGS__))) \
215 __attribute__((returns_nonnull)) __attribute__((warn_unused_result))
217#define hxattr_allocator(...) __attribute__((malloc)) \
218 __attribute__((returns_nonnull)) __attribute__((warn_unused_result))
222#define hxattr_assume(condition_) __builtin_assume(condition_)
226#define hxattr_assume(...) (void)0
232#define hxattr_cold __attribute__((cold))
233#if HX_USE_INLINING_ATTR && (defined __clang__ || __GNUC__ >= 11)
234#define hxattr_flatten __attribute__((flatten))
236#define hxattr_flatten
238#if HX_USE_INLINING_ATTR
239#define hxattr_hot __attribute__((hot))
243#define hxattr_nodiscard __attribute__((warn_unused_result))
244#define hxattr_noexcept __attribute__((nothrow))
245#define hxattr_nonnull(...)__attribute__((nonnull(__VA_ARGS__)))
246#define hxattr_noinline __attribute__((noinline))
247#define hxattr_noreturn __attribute__((noreturn))
248#define hxattr_printf(pos_, start_) __attribute__((format(printf, pos_, start_)))
249#define hxattr_weak __attribute__((weak))
252#if HX_USE_INLINING_ATTR
253#define hxinline inline __attribute__((always_inline))
255#define hxinline inline
262#if HX_CPLUSPLUS >= 202302L
266#define hxconstexpr constexpr
271#if HX_CPLUSPLUS >= 201703L
275#define hxinline_constexpr inline constexpr
277#define hxif_constexpr if constexpr
279#define hxinline_constexpr constexpr
280#define hxif_constexpr if
283#if !defined HX_USE_MACROS_WITH_MODULE
289#define HX_USE_MACROS_WITH_MODULE 0
292#if !defined HX_USE_CONSOLE
297#define HX_USE_CONSOLE ((HX_CPLUSPLUS >= 202002L) ? 1 : 0)
298#elif (HX_USE_CONSOLE) && HX_CPLUSPLUS && HX_CPLUSPLUS < 202002L
299#error The console requires C++20 or later.
301#if (HX_USE_CONSOLE) > 1 && defined __wasm__
303#error The debug console is not designed for use with WASM.
306#if !defined HX_USE_LOGGING
311#define HX_USE_LOGGING 2
314#if !defined HX_USE_FILE_IO
318#define HX_USE_FILE_IO 1
321#if !defined HX_USE_PROFILER
324#define HX_USE_PROFILER 0
327#if !defined HX_CYCLES_PER_SECOND
330#define HX_CYCLES_PER_SECOND 3.0e+9
333#if !defined HX_PROFILER_MAX_RECORDS
336#define HX_PROFILER_MAX_RECORDS 4096
339#if !defined HX_USE_MEMORY_MANAGER
344#define HX_USE_MEMORY_MANAGER 1
347#if !defined HX_PROVIDE_NEW_DELETE
351#define HX_PROVIDE_NEW_DELETE !(HX_USE_LIBCXX)
355#define HX_KIB (1 << 10)
358#define HX_MIB (1 << 20)
361#define HX_GIB (1 << 30)
363#if !defined HX_MEMORY_BUDGET_PERMANENT
366#define HX_MEMORY_BUDGET_PERMANENT (4u * HX_KIB)
369#if !defined HX_MEMORY_MAX_STACKS
373#define HX_MEMORY_MAX_STACKS 3u
376#if !defined HX_RADIX_SORT_MIN_SIZE
379#define HX_RADIX_SORT_MIN_SIZE 32
382#if !defined HX_MAX_LINE
385#define HX_MAX_LINE (2 * HX_KIB)
388#if !defined HX_USE_GOOGLE_TEST
391#define HX_USE_GOOGLE_TEST 0
394#if (HX_HARDENING_MODE) == HX_HARDENING_MODE_DEBUG && defined __GLIBC__ && !defined __FAST_MATH__
395#if !defined HX_USE_FLOATING_POINT_TRAPS
399#define HX_USE_FLOATING_POINT_TRAPS 1
402#undef HX_USE_FLOATING_POINT_TRAPS
403#define HX_USE_FLOATING_POINT_TRAPS 0
407#define HX_QUOTE(x_) #x_
413#if !defined HX_TEST_ERROR_HANDLING
414#define HX_TEST_ERROR_HANDLING 0
419#define HX_CHECK_USE_(x_) static_assert(HX_QUOTE(x_)[0] != 0, #x_ " must not be empty");
421HX_CHECK_USE_(HX_TEST_ERROR_HANDLING)
438#define HX_APPEND_COUNTER2_(x_, y_) x_ ## y_
439#define HX_APPEND_COUNTER_(x_, y_) HX_APPEND_COUNTER2_(x_, y_)
440#define HX_APPEND_COUNTER(x_) HX_APPEND_COUNTER_(x_, __COUNTER__)
444#if !defined HX_INL_BEGIN_
451#if HX_CPLUSPLUS && defined HX_USE_NAMESPACE
452HX_CHECK_USE_(HX_USE_NAMESPACE)
453#define HX_NS_BEGIN_ namespace HX_USE_NAMESPACE {
455#define HX_NS_PREFIX_ HX_USE_NAMESPACE::
456#define HX_NS_USE using namespace HX_USE_NAMESPACE;
465#if !(HX_USE_MACROS_WITH_MODULE)
#define HX_USE_FLOATING_POINT_TRAPS
Definition hxsettings.h:403
#define HX_USE_MEMORY_MANAGER
HX_USE_MEMORY_MANAGER - Used to disable memory management for debugging and for platforms like wasm w...
Definition hxsettings.h:344
#define HX_USE_MACROS_WITH_MODULE
HX_USE_MACROS_WITH_MODULE - Setting -DHX_USE_MACROS_WITH_MODULE=1 when using modules (e....
Definition hxsettings.h:289
#define HX_USE_CONSOLE
HX_USE_CONSOLE - Control whether the console is included in the build.
Definition hxsettings.h:297
#define HX_USE_LIBCXX
HX_USE_LIBCXX: Indicates whether libstdc++/libc++ are present.
Definition hxsettings.h:65
#define HX_USE_THREADS
HX_USE_THREADS - 11 indicates C11 threads are in use.
Definition hxsettings.h:59
#define HX_USE_INLINING_ATTR
HX_USE_INLINING_ATTR - Controls whether hxinline, hxattr_flatten, and hxattr_hot are enabled.
Definition hxsettings.h:50
#define HX_PROVIDE_NEW_DELETE
HX_PROVIDE_NEW_DELETE - Provides a new/delete implementation when the std library is absent unless ov...
Definition hxsettings.h:351
#define HX_USE_GOOGLE_TEST
HX_USE_GOOGLE_TEST - Switch to using the real Google Test.
Definition hxsettings.h:391
void hxsettings_construct_(void)
hxsettings_construct_ - Internal. Used to reset settings at startup.
#define HX_USE_LOGGING
HX_USE_LOGGING - Control whether logging statements are included in the build.
Definition hxsettings.h:311
#define HX_USE_FILE_IO
HX_USE_FILE_IO - Select if hxfile exists and if it uses C file I/O or POSIX I/O.
Definition hxsettings.h:318
struct hxsettings_t hxg_settings
hxg_settings - Global class constructed by hxinit.
#define HX_USE_PROFILER
HX_USE_PROFILER - Enable this to use the profiler.
Definition hxsettings.h:324
hxsettings_t - Constructed by first call to hxinit which happens when on or before the system memory ...
Definition hxsettings.h:470
bool test_break_on_failure
test_break_on_failure - Triggers a breakpoint when an hxassert, ASSERT_* or EXPECT_* condition fails ...
Definition hxsettings.h:481
const char * test_filter
test_filter - Used by hxtest to support simple Google Test style filtering.
Definition hxsettings.h:485
bool deallocate_permanent
deallocate_permanent - Allows deallocation of permanent resources at system shut down.
Definition hxsettings.h:477
uint8_t log_level
log_level - Logging level for the application (e.g., verbosity of logs).
Definition hxsettings.h:473