From b527c0d09edb4677c9520a594d17f9bf98052dfd Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 22 Jul 2024 10:04:49 +0000 Subject: [PATCH] Fix warnings in xBRZ --- client/xBRZ/xbrz.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/client/xBRZ/xbrz.cpp b/client/xBRZ/xbrz.cpp index 625e4da44..2fab57f3c 100644 --- a/client/xBRZ/xbrz.cpp +++ b/client/xBRZ/xbrz.cpp @@ -21,6 +21,10 @@ #include //std::sqrt #include "xbrz_tools.h" +#if defined _MSC_VER +#pragma warning(disable:5051) +#endif + using namespace xbrz; @@ -333,19 +337,19 @@ DEF_GETTER(d) DEF_GETTER(e) DEF_GETTER(f) DEF_GETTER(g) DEF_GETTER(h) DEF_GETTER(i) #undef DEF_GETTER -#define DEF_GETTER(x, y) template <> inline uint32_t get_##x(const Kernel_3x3& ker) { return ker.y; } +#define DEF_GETTER(x, y) template <> [[maybe_unused]] inline uint32_t get_##x(const Kernel_3x3& ker) { return ker.y; } DEF_GETTER(a, g) DEF_GETTER(b, d) DEF_GETTER(c, a) DEF_GETTER(d, h) DEF_GETTER(e, e) DEF_GETTER(f, b) DEF_GETTER(g, i) DEF_GETTER(h, f) DEF_GETTER(i, c) #undef DEF_GETTER -#define DEF_GETTER(x, y) template <> inline uint32_t get_##x(const Kernel_3x3& ker) { return ker.y; } +#define DEF_GETTER(x, y) template <> [[maybe_unused]] inline uint32_t get_##x(const Kernel_3x3& ker) { return ker.y; } DEF_GETTER(a, i) DEF_GETTER(b, h) DEF_GETTER(c, g) DEF_GETTER(d, f) DEF_GETTER(e, e) DEF_GETTER(f, d) DEF_GETTER(g, c) DEF_GETTER(h, b) DEF_GETTER(i, a) #undef DEF_GETTER -#define DEF_GETTER(x, y) template <> inline uint32_t get_##x(const Kernel_3x3& ker) { return ker.y; } +#define DEF_GETTER(x, y) template <> [[maybe_unused]] inline uint32_t get_##x(const Kernel_3x3& ker) { return ker.y; } DEF_GETTER(a, c) DEF_GETTER(b, f) DEF_GETTER(c, i) DEF_GETTER(d, b) DEF_GETTER(e, e) DEF_GETTER(f, h) DEF_GETTER(g, a) DEF_GETTER(h, d) DEF_GETTER(i, g) @@ -709,11 +713,18 @@ void scaleImage(const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight, //blend all four corners of current pixel if (blendingNeeded(blend_xy)) { +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif const auto& ker3 = reinterpret_cast(ker4); //"The Things We Do for Perf" blendPixel(ker3, out, trgWidth, blend_xy, cfg); blendPixel(ker3, out, trgWidth, blend_xy, cfg); blendPixel(ker3, out, trgWidth, blend_xy, cfg); blendPixel(ker3, out, trgWidth, blend_xy, cfg); +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif } } } @@ -1353,4 +1364,4 @@ void bilinearScaleAmp(const uint32_t* src, int srcWidth, int srcHeight, //throw }); trgView.synchronize(); //throw ? } -#endif \ No newline at end of file +#endif