From 40b8023ff99b4a4436accb79b9b37d9ddce62cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 18 Oct 2024 21:07:50 +0800 Subject: [PATCH] CI: fix build for old compilers --- src/fastfetch.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fastfetch.h b/src/fastfetch.h index 2dba4b012..ae9d0657f 100644 --- a/src/fastfetch.h +++ b/src/fastfetch.h @@ -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