From 05f1a9a2c8a0da9ed4ab00a0abac3d439b3ec08c Mon Sep 17 00:00:00 2001 From: Zwip-Zwap Zapony Date: Mon, 29 May 2023 14:38:22 +0200 Subject: [PATCH] Suppress libdivide warnings in GCC/Clang --- src/libdivide.h | 9 +++++++++ src/r_draw8_npo2.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/libdivide.h b/src/libdivide.h index 1a589c7e5..71a5ae6be 100644 --- a/src/libdivide.h +++ b/src/libdivide.h @@ -581,6 +581,11 @@ static inline void libdivide_u128_shift(uint64_t *u1, uint64_t *u0, int32_t sign ////////// UINT32 +#if defined(__GNUC__) || defined(__clang__) // Suppress intentional compiler warnings + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Waggregate-return" +#endif + static inline struct libdivide_u32_t libdivide_internal_u32_gen(uint32_t d, int branchfree) { struct libdivide_u32_t result; uint32_t floor_log_2_d; @@ -647,6 +652,10 @@ struct libdivide_u32_t libdivide_u32_gen(uint32_t d) { return ret; }*/ +#if defined(__GNUC__) || defined(__clang__) // Stop suppressing intentional compiler warnings + #pragma GCC diagnostic pop +#endif + uint32_t libdivide_u32_do(uint32_t numer, const struct libdivide_u32_t *denom) { uint8_t more = denom->more; if (!denom->magic) { diff --git a/src/r_draw8_npo2.c b/src/r_draw8_npo2.c index faf1cdba8..91f3b06c4 100644 --- a/src/r_draw8_npo2.c +++ b/src/r_draw8_npo2.c @@ -18,6 +18,11 @@ #define SPANSIZE 16 #define INVSPAN 0.0625f +#if defined(__GNUC__) || defined(__clang__) // Suppress intentional libdivide compiler warnings - Also added to libdivide.h + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Waggregate-return" +#endif + /** \brief The R_DrawSpan_NPO2_8 function Draws the actual span. */ @@ -1572,3 +1577,7 @@ void R_DrawTiltedWaterSpan_NPO2_8(void) } #endif } + +#if defined(__GNUC__) || defined(__clang__) // Stop suppressing intentional libdivide compiler warnings + #pragma GCC diagnostic pop +#endif