From: Nicolai Hähnle Date: Wed, 27 Jul 2016 17:13:57 +0000 (+0200) Subject: amdgpu/addrlib: add ADDR_ANALYSIS_ASSUME X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9e40e090891e80856998aed02e63a5d76f2f243a;p=mesa.git amdgpu/addrlib: add ADDR_ANALYSIS_ASSUME It helps fix analysis warnings in MSC. --- diff --git a/src/amd/addrlib/core/addrcommon.h b/src/amd/addrlib/core/addrcommon.h index 60b3d818f72..019ebd07a29 100644 --- a/src/amd/addrlib/core/addrcommon.h +++ b/src/amd/addrlib/core/addrcommon.h @@ -159,16 +159,26 @@ union ADDR_CONFIG_FLAGS /////////////////////////////////////////////////////////////////////////////////////////////////// // Debug assertions used in AddrLib /////////////////////////////////////////////////////////////////////////////////////////////////// +#if defined(_WIN32) && (_MSC_VER >= 1400) + #define ADDR_ANALYSIS_ASSUME(expr) __analysis_assume(expr) +#else + #define ADDR_ANALYSIS_ASSUME(expr) do { } while (0) +#endif + #if DEBUG -#define ADDR_ASSERT(__e) if ( !((__e) ? TRUE : FALSE)) { ADDR_DBG_BREAK(); } -#define ADDR_ASSERT_ALWAYS() ADDR_DBG_BREAK() -#define ADDR_UNHANDLED_CASE() ADDR_ASSERT(!"Unhandled case") -#define ADDR_NOT_IMPLEMENTED() ADDR_ASSERT(!"Not implemented"); + #define ADDR_ASSERT(__e) \ + do { \ + ADDR_ANALYSIS_ASSUME(__e); \ + if ( !((__e) ? TRUE : FALSE)) { ADDR_DBG_BREAK(); } \ + } while (0) + #define ADDR_ASSERT_ALWAYS() ADDR_DBG_BREAK() + #define ADDR_UNHANDLED_CASE() ADDR_ASSERT(!"Unhandled case") + #define ADDR_NOT_IMPLEMENTED() ADDR_ASSERT(!"Not implemented"); #else //DEBUG -#define ADDR_ASSERT(__e) -#define ADDR_ASSERT_ALWAYS() -#define ADDR_UNHANDLED_CASE() -#define ADDR_NOT_IMPLEMENTED() + #define ADDR_ASSERT(__e) ADDR_ANALYSIS_ASSUME(__e) + #define ADDR_ASSERT_ALWAYS() + #define ADDR_UNHANDLED_CASE() + #define ADDR_NOT_IMPLEMENTED() #endif //DEBUG /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/amd/addrlib/r800/egbaddrlib.cpp b/src/amd/addrlib/r800/egbaddrlib.cpp index 03ae41f0677..64c0c6225f5 100644 --- a/src/amd/addrlib/r800/egbaddrlib.cpp +++ b/src/amd/addrlib/r800/egbaddrlib.cpp @@ -4577,7 +4577,7 @@ UINT_64 EgBasedAddrLib::HwlGetSizeAdjustmentMicroTiled( // // R800 will always pad physical slice size to baseAlign which is pipe_interleave_bytes // - ADDR_ASSERT((physicalSliceSize % baseAlign) == 0) + ADDR_ASSERT((physicalSliceSize % baseAlign) == 0); return logicalSliceSize; } diff --git a/src/amd/addrlib/r800/siaddrlib.cpp b/src/amd/addrlib/r800/siaddrlib.cpp index 296391ab46f..5d725e66e1f 100644 --- a/src/amd/addrlib/r800/siaddrlib.cpp +++ b/src/amd/addrlib/r800/siaddrlib.cpp @@ -2151,7 +2151,7 @@ UINT_32 SiAddrLib::HwlPreAdjustBank( bankBit0 = bankBit0 ^ x4 ^ x5; bank |= bankBit0; - ADDR_ASSERT(pTileInfo->macroAspectRatio > 1) + ADDR_ASSERT(pTileInfo->macroAspectRatio > 1); } return bank;