From a31f084b1b20247e72bef9105a9b4df1e1bd1255 Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Mon, 26 Feb 2024 13:39:34 -0500 Subject: [PATCH] fix: ignore unused variables in the array macros --- lib/src/array.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/src/array.h b/lib/src/array.h index 43358fcc..45969242 100644 --- a/lib/src/array.h +++ b/lib/src/array.h @@ -13,6 +13,16 @@ extern "C" { #include #include +#ifdef _MSC_VER +#pragma warning(disable : 4101) +#elif defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-variable" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif + #define Array(T) \ struct { \ T *contents; \ @@ -265,6 +275,14 @@ static inline void _array__splice(Array *self, size_t element_size, /// parameter by reference in order to work with the generic sorting function above. #define compare_int(a, b) ((int)*(a) - (int)(b)) +#ifdef _MSC_VER +#pragma warning(default : 4101) +#elif defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + #ifdef __cplusplus } #endif