1 | // Copyright (C) 2015 ChaosForge Ltd
|
---|
2 | // http://chaosforge.org/
|
---|
3 | //
|
---|
4 | // This file is part of NV Libraries.
|
---|
5 | // For conditions of distribution and use, see copyright notice in nv.hh
|
---|
6 |
|
---|
7 | #define NV_CORE_COMMON_HH
|
---|
8 | #define NV_INTERNAL_INCLUDE
|
---|
9 | #include "nv/stl/assert.hh"
|
---|
10 | #undef NV_CORE_COMMON_HH
|
---|
11 |
|
---|
12 | #if NV_COMPILER == NV_MSVC
|
---|
13 |
|
---|
14 | # if NV_DEBUG
|
---|
15 |
|
---|
16 | extern "C" {
|
---|
17 | void __cdecl _wassert( const wchar_t * _Message, const wchar_t *_File, unsigned _Line );
|
---|
18 | }
|
---|
19 |
|
---|
20 | void nv_internal_assert( const wchar_t * message, const wchar_t* file, unsigned line )
|
---|
21 | {
|
---|
22 | _wassert( message, file, line );
|
---|
23 | }
|
---|
24 | # else
|
---|
25 | void nv_internal_assert( const wchar_t *, const wchar_t*, unsigned ) {}
|
---|
26 | # endif // NV_DEBUG
|
---|
27 | #else // NV_COMPILER
|
---|
28 |
|
---|
29 | # if NV_DEBUG
|
---|
30 | # if NV_COMPILER == NV_CLANG
|
---|
31 | extern "C" {
|
---|
32 | extern void __assert(const char *, const char *, unsigned int, const char *)
|
---|
33 | throw() __attribute__ ((__noreturn__));
|
---|
34 | }
|
---|
35 | # else
|
---|
36 | extern "C" {
|
---|
37 | extern void __assert_fail(const char *, const char *, unsigned int, const char *)
|
---|
38 | throw() __attribute__ ((__noreturn__));
|
---|
39 | }
|
---|
40 | # endif
|
---|
41 | void nv_internal_assert( const char * assertion, const char * file, unsigned int line, const char * function )
|
---|
42 | {
|
---|
43 | # if NV_COMPILER == NV_CLANG
|
---|
44 | __assert(assertion, file, line, function );
|
---|
45 | # else
|
---|
46 | __assert_fail(assertion, file, line, function );
|
---|
47 | # endif
|
---|
48 | }
|
---|
49 | # else
|
---|
50 | void nv_internal_assert( const char * , const char * , unsigned int , const char * )
|
---|
51 | {
|
---|
52 | }
|
---|
53 | # endif
|
---|
54 |
|
---|
55 | #endif // NV_COMPILER
|
---|
56 |
|
---|