00001 #pragma once
00002
00003 #include "nvsg/nvsgapi.h"
00004
00005 namespace nvutil
00006 {
00007 extern NVSG_API void AssertionFailed(const char* assertion, const char* file, unsigned int line, const char * function);
00008 }
00009
00010 #if defined(_DEBUG)
00011
00012 #if defined(LINUX)
00013 #define __ASSERT(exp) \
00014 if (exp){ \
00015 } else { \
00016 nvutil::AssertionFailed(#exp, __FILE__, __LINE__, __func__); \
00017 }
00018 #else
00019 #include <assert.h>
00020 #define __ASSERT assert
00021 #endif
00022
00023
00024 #define __VERIFY(f) __ASSERT(f);
00025
00026
00027 #define __CTASSERT(exp) __CTASSERTi(exp,__LINE__)
00028 #define __CTASSERTi(exp,line) __CTASSERTii(exp,line)
00029 #define __CTASSERTii(exp,line) static int __ctassert__##line[(exp)!=0] = {0}
00030
00031 #else // non-debug configuration
00032
00033 #define __ASSERT(exp) static_cast<void>(0)
00034 #define __VERIFY(f) (static_cast<void>(f))
00035 #define __CTASSERT(exp)
00036 #define __CTASSERTi(exp,cnt)
00037 #define __CTASSERTii(exp,cnt)
00038 #endif
00039