00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef qassert_h
00029 #define qassert_h
00030
00047 #ifdef Q_NASSERT
00048
00049 #define Q_DEFINE_THIS_FILE
00050 #define Q_DEFINE_THIS_MODULE(name_)
00051 #define Q_ASSERT(test_) ((void)0)
00052 #define Q_ALLEGE(test_) ((void)(test_))
00053 #define Q_ERROR() ((void)0)
00054
00055 #else
00056
00057 #ifdef __cplusplus
00058 extern "C" {
00059 #endif
00060
00068
00069 void Q_onAssert(char const Q_ROM * const Q_ROM_VAR file, int line);
00070
00071 #ifdef __cplusplus
00072 }
00073 #endif
00074
00079 #define Q_DEFINE_THIS_FILE \
00080 static char const Q_ROM Q_ROM_VAR l_this_file[] = __FILE__;
00081
00086 #define Q_DEFINE_THIS_MODULE(name_) \
00087 static char const Q_ROM Q_ROM_VAR l_this_file[] = #name_;
00088
00095 #define Q_ASSERT(test_) \
00096 if (test_) { \
00097 } \
00098 else (Q_onAssert(l_this_file, __LINE__))
00099
00108 #define Q_ALLEGE(test_) Q_ASSERT(test_)
00109
00114 #define Q_ERROR() \
00115 (Q_onAssert(l_this_file, __LINE__))
00116
00117 #endif
00118
00123 #define Q_REQUIRE(test_) Q_ASSERT(test_)
00124
00129 #define Q_ENSURE(test_) Q_ASSERT(test_)
00130
00135 #define Q_INVARIANT(test_) Q_ASSERT(test_)
00136
00142 #define Q_ASSERT_COMPILE(test_) \
00143 extern char Q_assert_compile[(test_)]
00144
00145 #endif