12#error #include <hx/libhatchet.h> instead.
17#define __has_include(x) 0
21#if defined HX_DOXYGEN_PARSER
31#define HX_CPLUSPLUS 202302L
32#elif defined __cplusplus
33#define HX_CPLUSPLUS __cplusplus
39#if !defined HX_USE_INLINING_ATTR
42#define HX_USE_INLINING_ATTR 1
47#if defined HX_DOXYGEN_PARSER
51#define HX_USE_THREADS 11
57#define HX_USE_LIBCXX 1
62#define hxbreakpoint() true
71#define hxattr_allocator(...)
75#define hxattr_assume(...) (void)0
89#define hxattr_nodiscard
93#define hxattr_noexcept
97#define hxattr_nonnull(...)
100#define hxattr_noinline
104#define hxattr_noreturn
108#define hxattr_printf(...)
116#define hxattr_scanf(...)
120#define hxinline inline
124#elif defined _MSC_VER
127#error Clang detected masquerading as MSVC - not supported due to intrinsic use.
130#if !defined __cpp_exceptions && !defined _HAS_EXCEPTIONS
131#define _HAS_EXCEPTIONS 0
134#if !defined HX_USE_THREADS
135#define HX_USE_THREADS 11
138#if !defined HX_USE_LIBCXX
139#define HX_USE_LIBCXX 1
142#define hxbreakpoint() (__debugbreak(),true)
143#define hxrestrict __restrict
144#define hxattr_allocator(...)
145#define hxattr_assume(condition_) __assume(condition_)
147#define hxattr_flatten
150#define hxattr_nodiscard [[nodiscard]]
152#define hxattr_nodiscard
154#define hxattr_noexcept
155#define hxattr_nonnull(...)
156#define hxattr_noinline __declspec(noinline)
158#define hxattr_noreturn [[noreturn]]
160#define hxattr_noreturn
162#define hxattr_printf(...)
163#define hxattr_scanf(...)
168#if HX_USE_INLINING_ATTR
169#define hxinline inline __forceinline
171#define hxinline inline
180#if !defined HX_USE_THREADS
181#if __has_include(<threads.h>)
182#define HX_USE_THREADS 11
183#elif defined _POSIX_THREADS
184#define HX_USE_THREADS 1
186#define HX_USE_THREADS 0
190#if !defined HX_USE_LIBCXX
191#define HX_USE_LIBCXX 1
192#elif !(HX_USE_LIBCXX) && !defined HX_SKIP_LIBCXX_CHECK && __has_include(<new>)
193#error Use -nostdinc++ to use the C headers instead of the C++ ones.
197#if !defined HX_USE_SIGTRAP && defined __has_builtin && __has_builtin(__builtin_debugtrap)
198#define hxbreakpoint() (__builtin_debugtrap(),true)
200#define hxbreakpoint() (raise(SIGTRAP),true)
203#define hxrestrict __restrict
207#define hxattr_allocator(...) \
208 __attribute__((returns_nonnull)) __attribute__((warn_unused_result))
210#define hxattr_allocator(...) __attribute__((malloc(__VA_ARGS__))) \
211 __attribute__((returns_nonnull)) __attribute__((warn_unused_result))
213#define hxattr_allocator(...) __attribute__((malloc)) \
214 __attribute__((returns_nonnull)) __attribute__((warn_unused_result))
218#define hxattr_assume(condition_) __builtin_assume(condition_)
222#define hxattr_assume(...) (void)0
228#define hxattr_cold __attribute__((cold))
229#if HX_USE_INLINING_ATTR && (defined __clang__ || __GNUC__ >= 11)
230#define hxattr_flatten __attribute__((flatten))
232#define hxattr_flatten
234#if HX_USE_INLINING_ATTR
235#define hxattr_hot __attribute__((hot))
239#define hxattr_nodiscard __attribute__((warn_unused_result))
240#define hxattr_noexcept __attribute__((nothrow))
241#define hxattr_nonnull(...)__attribute__((nonnull(__VA_ARGS__)))
242#define hxattr_noinline __attribute__((noinline))
243#define hxattr_noreturn __attribute__((noreturn))
244#define hxattr_printf(pos_, start_) __attribute__((format(printf, pos_, start_)))
245#define hxattr_scanf(pos_, start_) __attribute__((format(scanf, pos_, start_)))
246#define hxattr_weak __attribute__((weak))
249#if HX_USE_INLINING_ATTR
250#define hxinline inline __attribute__((always_inline))
252#define hxinline inline
259#if HX_CPLUSPLUS >= 202302L
263#define hxconstexpr constexpr
268#if HX_CPLUSPLUS >= 201703L
272#define hxinline_constexpr inline constexpr
274#define hxif_constexpr if constexpr
276#define hxinline_constexpr constexpr
277#define hxif_constexpr if
280#if !defined HX_USE_MACROS_WITH_MODULE
286#define HX_USE_MACROS_WITH_MODULE 0
289#if !defined HX_USE_CONSOLE
294#define HX_USE_CONSOLE ((HX_CPLUSPLUS >= 202002L) ? 1 : 0)
295#elif (HX_USE_CONSOLE) && HX_CPLUSPLUS && HX_CPLUSPLUS < 202002L
296#error The console requires C++20 or later.
298#if (HX_USE_CONSOLE) > 1 && defined __wasm__
300#error The debug console is not designed for use with WASM.
303#if !defined HX_USE_LOGGING
308#define HX_USE_LOGGING 2
311#if !defined HX_USE_FILE_IO
315#define HX_USE_FILE_IO 1
318#if !defined HX_USE_PROFILER
321#define HX_USE_PROFILER 0
324#if !defined HX_CYCLES_PER_SECOND
327#define HX_CYCLES_PER_SECOND 3.0e+9
330#if !defined HX_PROFILER_MAX_RECORDS
333#define HX_PROFILER_MAX_RECORDS 4096
336#if !defined HX_USE_MEMORY_MANAGER
341#define HX_USE_MEMORY_MANAGER 1
344#if !defined HX_PROVIDE_NEW_DELETE
348#define HX_PROVIDE_NEW_DELETE !(HX_USE_LIBCXX)
352#define HX_KIB (1 << 10)
355#define HX_MIB (1 << 20)
358#define HX_GIB (1 << 30)
360#if !defined HX_MEMORY_BUDGET_PERMANENT
363#define HX_MEMORY_BUDGET_PERMANENT (4u * HX_KIB)
366#if !defined HX_MEMORY_MAX_STACKS
370#define HX_MEMORY_MAX_STACKS 3u
373#if !defined HX_RADIX_SORT_MIN_SIZE
376#define HX_RADIX_SORT_MIN_SIZE 32
379#if !defined HX_MAX_LINE
382#define HX_MAX_LINE (2 * HX_KIB)
385#if !defined HX_USE_GOOGLE_TEST
387#define HX_USE_GOOGLE_TEST 0
390#if (HX_HARDENING_MODE) == HX_HARDENING_MODE_DEBUG && defined __GLIBC__ && !defined __FAST_MATH__
391#if !defined HX_USE_FLOATING_POINT_TRAPS
394#define HX_USE_FLOATING_POINT_TRAPS 1
397#undef HX_USE_FLOATING_POINT_TRAPS
398#define HX_USE_FLOATING_POINT_TRAPS 0
402#define HX_QUOTE(x_) #x_
408#if !defined HX_TEST_ERROR_HANDLING
409#define HX_TEST_ERROR_HANDLING 0
414#define HX_CHECK_USE_(x_) static_assert(HX_QUOTE(x_)[0] != 0, #x_ " must not be empty");
416HX_CHECK_USE_(HX_TEST_ERROR_HANDLING)
433#define HX_APPEND_COUNTER2_(x_, y_) x_ ## y_
434#define HX_APPEND_COUNTER_(x_, y_) HX_APPEND_COUNTER2_(x_, y_)
435#define HX_APPEND_COUNTER(x_) HX_APPEND_COUNTER_(x_, __COUNTER__)
439#if !defined HX_BEGIN_INL_
446#if HX_CPLUSPLUS && defined HX_USE_NAMESPACE
447HX_CHECK_USE_(HX_USE_NAMESPACE)
448#define HX_NS_BEGIN_ namespace HX_USE_NAMESPACE {
450#define HX_NS_PREFIX_ HX_USE_NAMESPACE::
451#define HX_NS_USE using namespace HX_USE_NAMESPACE;
460#if !(HX_USE_MACROS_WITH_MODULE)
#define HX_USE_FLOATING_POINT_TRAPS
Definition hxsettings.h:398
#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:341
#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:286
#define HX_USE_CONSOLE
HX_USE_CONSOLE - Control whether the console is included in the build.
Definition hxsettings.h:294
#define HX_USE_LIBCXX
HX_USE_LIBCXX: Indicates whether libstdc++/libc++ are present.
Definition hxsettings.h:57
#define HX_USE_THREADS
HX_USE_THREADS - 11 indicates C11 threads are in use.
Definition hxsettings.h:51
#define HX_USE_INLINING_ATTR
HX_USE_INLINING_ATTR - Controls whether hxinline, hxattr_flatten, and hxattr_hot are enabled.
Definition hxsettings.h:42
struct hxsettings hxg_settings
hxg_settings - Global class constructed by hxinit.
#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:348
#define HX_USE_GOOGLE_TEST
HX_USE_GOOGLE_TEST - Switch to using the real Google Test. Defaults to 0.
Definition hxsettings.h:387
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:308
#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:315
#define HX_USE_PROFILER
HX_USE_PROFILER - Enable this to use the profiler.
Definition hxsettings.h:321
hxsettings - Constructed by first call to hxinit which happens when on or before the system memory al...
Definition hxsettings.h:467
uint8_t log_level
log_level - Logging level for the application (e.g., verbosity of logs).
Definition hxsettings.h:470
bool deallocate_permanent
deallocate_permanent - Allows deallocation of permanent resources at system shut down.
Definition hxsettings.h:474