From b913f2b09720e91643465591a2ea759682e8adb1 Mon Sep 17 00:00:00 2001 From: James Park Date: Mon, 14 Dec 2020 11:35:13 -0800 Subject: [PATCH] gallium/tessellator: Fix warning suppression Single-line version of MSVC warning suppression does not extend beyond the #endif directive. Use push/disable/pop instead. Also suppress 26452, which is a similar analysis warning. This could also be fixed with constexpr if, but C++17 would be required. Fixes: 790516db0bf ("gallium/swr: fix gcc warnings") Reviewed-by: Jesse Natalie Part-of: (cherry picked from commit 3c7062417bedb203a0a58e27e85febd55c75cbce) --- .pick_status.json | 2 +- src/gallium/auxiliary/tessellator/tessellator.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 408eb5f10be..19cd37c0294 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1381,7 +1381,7 @@ "description": "gallium/tessellator: Fix warning suppression", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "790516db0bfc056df0290c42565214d4148e901a" }, diff --git a/src/gallium/auxiliary/tessellator/tessellator.cpp b/src/gallium/auxiliary/tessellator/tessellator.cpp index 7452ec6cb44..91a5390278d 100644 --- a/src/gallium/auxiliary/tessellator/tessellator.cpp +++ b/src/gallium/auxiliary/tessellator/tessellator.cpp @@ -194,9 +194,13 @@ INT32 floatToIDotF( const float& input ) { // assert( iShift < 32 ); #if defined(_MSC_VER) -#pragma warning( suppress : 4293 ) +#pragma warning( push ) +#pragma warning( disable : 4293 26452 ) #endif _fxpMaxPosValueFloat -= INT32( 1 ) << iShift; +#if defined(_MSC_VER) +#pragma warning( pop ) +#endif } // The maximum negative fixed point value is -2^(i-1). @@ -216,9 +220,13 @@ INT32 floatToIDotF( const float& input ) { // assert( iShift < 32 ); #if defined(_MSC_VER) -#pragma warning( suppress : 4293 ) +#pragma warning( push ) +#pragma warning( disable : 4293 26452 ) #endif _fxpMaxPosValueFloat -= INT32( 1 ) << iShift; +#if defined(_MSC_VER) +#pragma warning( pop ) +#endif } // The maximum negative fixed point value is 0.