-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevutils.h
More file actions
21 lines (15 loc) · 760 Bytes
/
devutils.h
File metadata and controls
21 lines (15 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef DEVUTILS_H
#define DEVUTILS_H
#include <stdlib.h>
// Copied from https://github.com/tsoding/nob.h/blob/main/nob.h
#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)
#define UNIMPLEMENTED(message) do { fprintf(stderr, "%s:%d: UNIMPLEMENTED: %s\n", __FILE__, __LINE__, message); abort(); } while(0)
#if defined(__GNUC__) || defined(__clang__)
#define CHECK_PRINTF_FMT(a, b) __attribute__ ((format (printf, a, b)))
#else
#define CHECK_PRINTF_FMT(...)
#endif
#define MAX(x, y) ((x) >= (y) ? (x) : (y))
#endif // DEVUTILS_H