瀏覽代碼

base: tweak assertion macro so that ASSERT(x = 1) triggers a warning.

undefined
Sam Hocevar 10 年之前
父節點
當前提交
c656a37023
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. +6
    -1
      src/lol/base/assert.h

+ 6
- 1
src/lol/base/assert.h 查看文件

@@ -123,7 +123,12 @@ static inline void DebugAbort()
# define ASSERT(...) UNUSED(LOL_CALL(LOL_1ST, (__VA_ARGS__)))
#else
# define ASSERT(...) \
if (!(LOL_CALL(LOL_1ST, (__VA_ARGS__)))) \
if (LOL_CALL(LOL_1ST, (__VA_ARGS__))) \
{ \
/* Don't use "!" so that ASSERT(x = 1) instead of ASSERT(x == 1)
* triggers a compilation warning. */ \
} \
else \
{ \
LOL_CALL(LOL_CAT(LOL_ERROR_, LOL_CALL(LOL_COUNT_TO_3, \
(__VA_ARGS__))), \


Loading…
取消
儲存