summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-07-27 19:13:57 +0200
committerMarek Olšák <[email protected]>2017-03-30 14:44:33 +0200
commit9e40e090891e80856998aed02e63a5d76f2f243a (patch)
tree7545b94ca779b7c5be41678c9cf4bb28e9906e49 /src/amd
parent6164f23a9140ae8dfa4d44f7a9c41228e36fa9bf (diff)
amdgpu/addrlib: add ADDR_ANALYSIS_ASSUME
It helps fix analysis warnings in MSC.
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/addrlib/core/addrcommon.h26
-rw-r--r--src/amd/addrlib/r800/egbaddrlib.cpp2
-rw-r--r--src/amd/addrlib/r800/siaddrlib.cpp2
3 files changed, 20 insertions, 10 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
///////////////////////////////////////////////////////////////////////////////////////////////////
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;