Make simulator compile

This commit is contained in:
2023-05-23 02:51:40 +02:00
parent 2347b738c5
commit 5a56ce394f
9 changed files with 29 additions and 9 deletions

View File

@ -4,8 +4,14 @@
// This is wacky preprocessor magic that allows us to count the number of
// members of an enum. Unfortunately, it doesn't work with enum classes, so we
// have to use C-style enums.
// The preprocessor magic is so wacky we have to prevent GCC from failing with a
// -Werror=pedantic when compiling the simulator
#pragma GCC diagnostic ignored "-Wpedantic"
#define CountedEnum(NAME, TYPE, ...) \
typedef enum { __VA_ARGS__ } NAME; \
static const size_t NAME##_COUNT = sizeof((int[]){__VA_ARGS__}) / sizeof(int);
static const size_t NAME##_COUNT = \
sizeof(__extension__(int[]){__VA_ARGS__}) / sizeof(int);
#endif // INC_UTIL_H