infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
utility.h
Go to the documentation of this file.
1#pragma once
39#include "common/compat_c23.h"
40#include <stddef.h>
41
42// Check if INFIX_DEBUG_ENABLED is defined and set to a non-zero value.
43#if defined(INFIX_DEBUG_ENABLED) && INFIX_DEBUG_ENABLED
44
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"
60#define INFIX_DEBUG_PRINTF(...) note("INFIX_DEBUG: " __VA_ARGS__)
61#else
62#include <stdio.h>
70#define INFIX_DEBUG_PRINTF(...) \
71 do { \
72 printf("# INFIX_DEBUG: " __VA_ARGS__); \
73 printf("\n"); \
74 } while (0)
75#endif // DBLTAP_ENABLE
76
88void infix_dump_hex(const void * data, size_t size, const char * title);
89
90#else // INFIX_DEBUG_ENABLED is NOT defined or is zero (Release Mode)
91
100#define INFIX_DEBUG_PRINTF(...) ((void)0)
101
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.
119}
120#endif // INFIX_DEBUG_ENABLED
Provides compatibility shims for C23 features in a C17/C11 project.
#define c23_maybe_unused
Definition compat_c23.h:150
A simple, header-only TAP14-compatible testing framework for C.
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