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
00029 #ifndef NVBLASTASSERT_H
00030 #define NVBLASTASSERT_H
00031
00032
00033 #include "NvBlastPreprocessor.h"
00034
00035
00036 #if !NV_ENABLE_ASSERTS
00037 #define NVBLAST_ASSERT(exp) ((void)0)
00038 #define NVBLAST_ALWAYS_ASSERT_MESSAGE(message) ((void)0)
00039 #define NVBLAST_ASSERT_WITH_MESSAGE(condition, message) ((void)0)
00040 #else
00041 #if NV_VC
00042 #define NVBLAST_CODE_ANALYSIS_ASSUME(exp) \
00043 __analysis_assume(!!(exp)) // This macro will be used to get rid of analysis warning messages if a NVBLAST_ASSERT is used
00044
00045 #else
00046 #define NVBLAST_CODE_ANALYSIS_ASSUME(exp)
00047 #endif
00048 #define NVBLAST_ASSERT(exp) \
00049 { \
00050 static bool _ignore = false; \
00051 if (!(exp) && !_ignore) NvBlastAssertHandler(#exp, __FILE__, __LINE__, _ignore); \
00052 NVBLAST_CODE_ANALYSIS_ASSUME(exp); \
00053 } ((void)0)
00054 #define NVBLAST_ALWAYS_ASSERT_MESSAGE(message) \
00055 { \
00056 static bool _ignore = false; \
00057 if(!_ignore) \
00058 { \
00059 NvBlastAssertHandler(message, __FILE__, __LINE__, _ignore); \
00060 } \
00061 } ((void)0)
00062 #define NVBLAST_ASSERT_WITH_MESSAGE(exp, message) \
00063 { \
00064 static bool _ignore = false; \
00065 if (!(exp) && !_ignore) NvBlastAssertHandler(message, __FILE__, __LINE__, _ignore); \
00066 NVBLAST_CODE_ANALYSIS_ASSUME(exp); \
00067 } ((void)0)
00068 #endif
00069
00070 #define NVBLAST_ALWAYS_ASSERT() NVBLAST_ASSERT(0)
00071
00072
00073 extern "C"
00074 {
00075
00076 NVBLAST_API void NvBlastAssertHandler(const char* expr, const char* file, int line, bool& ignore);
00077
00078 }
00079
00080
00081 #endif // #ifndef NVBLASTASSERT_H