diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-23 00:02:07 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-23 00:02:07 +0100 |
| commit | d0f5be14558e2b0cc506654bd45bb6d81553c456 (patch) | |
| tree | 6f4e4d9055ef9b61c5f87ba7bdf1a572e7a399a1 /nonstd.h | |
| parent | 91ab3ae0147712b549e4ec086818f847fd23e12f (diff) | |
| download | nonstd-d0f5be14558e2b0cc506654bd45bb6d81553c456.tar.gz | |
Update to readme and added UNREACHABLE and TODO macros
Diffstat (limited to 'nonstd.h')
| -rw-r--r-- | nonstd.h | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -60,7 +60,18 @@ NONSTD_DEF void *safe_realloc(void *ptr, size_t item_size, size_t count); #define MAX(a, b) ((a) > (b) ? (a) : (b)) #define CLAMP(x, lo, hi) (MIN((hi), MAX((lo), (x)))) -#define UNUSED(x) (void)(x) +// From https://github.com/tsoding/nob.h/blob/e2c9a46f01d052ab740140e74453665dc3334832/nob.h#L205-L206. +#define UNUSED(value) (void)(value) +#define TODO(message) \ + do { \ + fprintf(stderr, "%s:%d: TODO: %s\n", __FILE__, __LINE__, message); \ + abort(); \ + } while (0) +#define UNREACHABLE(message) \ + do { \ + fprintf(stderr, "%s:%d: UNREACHABLE: %s\n", __FILE__, __LINE__, message); \ + abort(); \ + } while (0) #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #define STATIC_ASSERT(expr, msg) _Static_assert((expr), msg) |
