infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
compat_c23.h
Go to the documentation of this file.
1
37#pragma once
38#include <infix/infix.h>
39#include <stdbool.h>
40#include <stddef.h>
51#if !defined(nullptr) && !defined(__cplusplus)
52#define nullptr ((void *)0)
53#endif
63#if !defined(__cplusplus) && \
64 ((defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || (defined(_MSC_VER) && _MSC_VER >= 1900))
65#include <assert.h>
66#ifndef static_assert
67#define static_assert(cond, msg) _Static_assert(cond, msg)
68#endif
69#endif
82#if defined(__has_c_attribute)
83#define COMPAT_HAS_C_ATTRIBUTE(x) __has_c_attribute(x)
84#else
85#define COMPAT_HAS_C_ATTRIBUTE(x) 0
86#endif
91#define c23_nodiscard INFIX_NODISCARD
106#if COMPAT_HAS_C_ATTRIBUTE(deprecated)
107#define c23_deprecated [[deprecated]]
108#elif defined(__GNUC__) || defined(__clang__)
109#define c23_deprecated __attribute__((deprecated))
110#elif defined(_MSC_VER)
111#define c23_deprecated __declspec(deprecated)
112#else
113#define c23_deprecated
114#endif
129#if COMPAT_HAS_C_ATTRIBUTE(fallthrough)
130#define c23_fallthrough [[fallthrough]]
131#elif defined(__GNUC__) || defined(__clang__)
132#define c23_fallthrough __attribute__((fallthrough))
133#else
134#define c23_fallthrough
135#endif
150#if COMPAT_HAS_C_ATTRIBUTE(maybe_unused)
151#define c23_maybe_unused [[maybe_unused]]
152#elif defined(__GNUC__) || defined(__clang__)
153#define c23_maybe_unused __attribute__((unused))
154#else
155#define c23_maybe_unused
156#endif
The public interface for the infix FFI library.