This might hint GCC 9 and make it suck less

This commit is contained in:
Lior Halphon 2023-04-11 12:23:50 +03:00
parent 5b37d3c402
commit aaba172c02
1 changed files with 3 additions and 1 deletions

View File

@ -15,11 +15,13 @@
#define GB_SECTION(name, ...) _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wpedantic\"") alignas(8) char _align_##name[0]; __VA_ARGS__ _Pragma("GCC diagnostic pop")
#endif
#else
#define GB_SECTION(name, ...) union __attribute__ ((aligned (8))) {uint8_t name##_section_start; struct {__VA_ARGS__};}; uint8_t name##_section_end[0];
#define GB_SECTION(name, ...) union __attribute__ ((aligned (8))) {uint8_t name##_section_start[0]; struct {__VA_ARGS__};}; uint8_t name##_section_end[0];
#ifdef GB_INTERNAL
#define GB_SECTION_OFFSET(name) (offsetof(GB_gameboy_t, name##_section_start))
#define GB_SECTION_SIZE(name) (offsetof(GB_gameboy_t, name##_section_end) - offsetof(GB_gameboy_t, name##_section_start))
#define GB_GET_SECTION(gb, name) ((void*)&((gb)->name##_section_start))
#endif
#endif
#if __clang_major__ >= 8 || __GNUC__ >= 13
#define GB_ENUM(type, ...) enum : type __VA_ARGS__