infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
utility.h
Go to the documentation of this file.
1#pragma once
42#include "common/compat_c23.h"
43#include <stddef.h>
44
45// Check if INFIX_DEBUG_ENABLED is defined and set to a non-zero value.
46#if defined(INFIX_DEBUG_ENABLED) && INFIX_DEBUG_ENABLED
47
48// The double_tap framework is only included if both debug mode AND the main
49// test harness toggle are enabled. This allows for debug builds of non-test executables.
50#if defined(DBLTAP_ENABLE)
51#include "common/double_tap.h"
64#define INFIX_DEBUG_PRINTF(...) note("INFIX_DEBUG: " __VA_ARGS__)
65#else
66#include <stdio.h>
75#define INFIX_DEBUG_PRINTF(...) \
76 do { \
77 printf("# INFIX_DEBUG: " __VA_ARGS__); \
78 printf("\n"); \
79 } while (0)
80#endif // DBLTAP_ENABLE
81
94void infix_dump_hex(const void * data, size_t size, const char * title);
95
96#else // INFIX_DEBUG_ENABLED is NOT defined or is zero (Release Mode)
97
106#define INFIX_DEBUG_PRINTF(...) ((void)0)
107
122static inline void infix_dump_hex(c23_maybe_unused const void * data,
123 c23_maybe_unused size_t size,
124 c23_maybe_unused const char * title) {
125 // This function does nothing in release builds and will be optimized away entirely.
126}
127#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:181
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:122