CI: fix build for old compilers

This commit is contained in:
李通洲
2024-10-18 21:07:50 +08:00
parent 7a3afa4adf
commit 40b8023ff9
+6 -3
View File
@@ -25,9 +25,12 @@
#include "options/display.h"
#include "options/general.h"
#if __has_builtin(__builtin_types_compatible_p)
#define ARRAY_SIZE(x) ({ static_assert(!__builtin_types_compatible_p(__typeof__(x), __typeof__(&*(x))), "Must not be a pointer"); sizeof(x) / sizeof(*(x)); })
#else
#ifdef __has_builtin
#if __has_builtin(__builtin_types_compatible_p)
#define ARRAY_SIZE(x) ({ static_assert(!__builtin_types_compatible_p(__typeof__(x), __typeof__(&*(x))), "Must not be a pointer"); sizeof(x) / sizeof(*(x)); })
#endif
#endif
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
#endif