YSTest  PreAlpha_b500_20140530
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
cassert.h
浏览该文件的文档.
1 /*
2  © 2013-2014 FrankHB.
3 
4  This file is part of the YSLib project, and may only be used,
5  modified, and distributed under the terms of the YSLib project
6  license, LICENSE.TXT. By continuing to use, modify, or distribute
7  this file you indicate that you have read the license and
8  understand and accept it fully.
9 */
10 
28 #ifndef YB_INC_ystdex_cassert_h_
29 #define YB_INC_ystdex_cassert_h_ 1
30 
31 #include "../ydef.h"
32 #include <cassert>
33 #include <cstdio>
34 
35 namespace ystdex
36 {
37 
47 #define yconstraint assert
48 
58 #define yassume assert
59 
60 
61 #if YB_Use_YAssert
62 # undef YAssert
63 
70 YB_API void
71 yassert(bool, const char*, const char*, int, const char*);
72 
73 # define YAssert(_expr, _msg) \
74  ystdex::yassert(_expr, #_expr, __FILE__, __LINE__, _msg)
75 
76 #else
77 # define YAssert(_expr, _msg) assert(exp)
78 #endif
79 
81 #define YAssertNonnull(_expr) YAssert(bool(_expr), "Null pointer found.")
82 
83 #if YB_Use_YTrace
84 
86 # undef YTrace
87 
92 YB_API YB_ATTR(format (printf, 6, 7)) void
93 ytrace(std::FILE*, std::uint8_t, std::uint8_t, const char*, int, const char*,
94  ...);
95 
101 # define YTrace(_stream, _lv, _t, _msg, ...) \
102  ystdex::ytrace(_stream, _lv, _t, __FILE__, __LINE__, _msg, __VA_ARGS__)
103 
104 #else
105 # define YTrace(...)
106 #endif
107 
108 
109 } // namespace ystdex;
110 
111 #endif
112 
void ytrace(std::FILE *, std::uint8_t, std::uint8_t, const char *, int, const char *,...)
YCLib 调试跟踪函数。
#define YB_API
YBase 应用程序编程接口:用于向库文件约定链接。
Definition: ydef.h:391
#define YB_ATTR(...)
属性。
Definition: ydef.h:265
void yassert(bool, const char *, const char *, int, const char *)
YBase 默认断言函数。