diff options
author | Nicolai Hähnle <[email protected]> | 2016-07-27 19:13:57 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-03-30 14:44:33 +0200 |
commit | 9e40e090891e80856998aed02e63a5d76f2f243a (patch) | |
tree | 7545b94ca779b7c5be41678c9cf4bb28e9906e49 /src/amd/addrlib/core | |
parent | 6164f23a9140ae8dfa4d44f7a9c41228e36fa9bf (diff) |
amdgpu/addrlib: add ADDR_ANALYSIS_ASSUME
It helps fix analysis warnings in MSC.
Diffstat (limited to 'src/amd/addrlib/core')
-rw-r--r-- | src/amd/addrlib/core/addrcommon.h | 26 |
1 files changed, 18 insertions, 8 deletions
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 /////////////////////////////////////////////////////////////////////////////////////////////////// |