infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
utility.h
Go to the documentation of this file.
1#pragma once
41#include "common/compat_c23.h"
42#include <stddef.h>
43// Check if INFIX_DEBUG_ENABLED is defined and set to a non-zero value.
44#if defined(INFIX_DEBUG_ENABLED) && INFIX_DEBUG_ENABLED
45// The double_tap framework is only included if both debug mode AND the main
46// test harness toggle are enabled. This allows for debug builds of non-test executables.
47#if defined(DBLTAP_ENABLE)
48#include "common/double_tap.h"
61#define INFIX_DEBUG_PRINTF(...) note("INFIX_DEBUG: " __VA_ARGS__)
62#else
63#include <stdio.h>
72#define INFIX_DEBUG_PRINTF(...) \
73 do { \
74 printf("# INFIX_DEBUG: " __VA_ARGS__); \
75 printf("\n"); \
76 } while (0)
77#endif // DBLTAP_ENABLE
90void infix_dump_hex(const void * data, size_t size, const char * title);
91#else // INFIX_DEBUG_ENABLED is NOT defined or is zero (Release Mode)
100#define INFIX_DEBUG_PRINTF(...) ((void)0)
115static inline void infix_dump_hex(c23_maybe_unused const void * data,
116 c23_maybe_unused size_t size,
117 c23_maybe_unused const char * title) {
118 // This function does nothing in release builds and will be optimized away entirely.
119}
120#endif // INFIX_DEBUG_ENABLED
Provides forward compatibility macros for C23 features.
#define c23_maybe_unused
A compatibility macro for the C23 [[maybe_unused]] attribute.
Definition compat_c23.h:171
A lightweight, single-header TAP (Test Anything Protocol) library.
static void infix_dump_hex(c23_maybe_unused const void *data, c23_maybe_unused size_t size, c23_maybe_unused const char *title)
Definition utility.h:115