|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] Don't evaluate ASSERT3 arguments in release build
Evaluating arguments to ASSERT3 may call functions that, even if they
don't have visible side effects (e.g. KeGetCurrentIrql), still cause
the function's code to be emitted into the binary.
Move the evaluation into inside the __analysis_assume expression to
avoid this.
Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
src/xenvif/assert.h | 27 ++++++---------------------
1 file changed, 6 insertions(+), 21 deletions(-)
diff --git a/src/xenvif/assert.h b/src/xenvif/assert.h
index d0cf3f2..c41dfed 100644
--- a/src/xenvif/assert.h
+++ b/src/xenvif/assert.h
@@ -136,29 +136,14 @@ __Bug(
__analysis_assume(_EXP); \
} while (FALSE)
-#define ASSERT3U(_X, _OP, _Y) \
- do { \
- ULONGLONG _Lval = (ULONGLONG)(_X); \
- ULONGLONG _Rval = (ULONGLONG)(_Y); \
- \
- __analysis_assume(_Lval _OP _Rval); \
- } while (FALSE)
+#define ASSERT3U(_X, _OP, _Y) \
+ ASSERT((ULONGLONG)(_X) _OP (ULONGLONG)(_Y))
-#define ASSERT3S(_X, _OP, _Y) \
- do { \
- LONGLONG _Lval = (LONGLONG)(_X); \
- LONGLONG _Rval = (LONGLONG)(_Y); \
- \
- __analysis_assume(_Lval _OP _Rval); \
- } while (FALSE)
+#define ASSERT3S(_X, _OP, _Y) \
+ ASSERT((LONGLONG)(_X) _OP (LONGLONG)(_Y))
-#define ASSERT3P(_X, _OP, _Y) \
- do { \
- PVOID _Lval = (PVOID)(_X); \
- PVOID _Rval = (PVOID)(_Y); \
- \
- __analysis_assume(_Lval _OP _Rval); \
- } while (FALSE)
+#define ASSERT3P(_X, _OP, _Y) \
+ ASSERT((PVOID)(_X) _OP (PVOID)(_Y))
#endif // DBG
--
2.53.0.windows.2
--
Ngoc Tu Dinh | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |