-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathassert.hpp
More file actions
38 lines (31 loc) · 736 Bytes
/
assert.hpp
File metadata and controls
38 lines (31 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include <iostream>
#include <csignal>
#ifndef SIGTRAP
#define SIGTRAP 5
#endif
#ifndef EMSCRIPTEN
#define FEA_HALT raise(SIGTRAP)
#else
#define FEA_HALT exit(1)
#endif
#ifdef _MSC_VER
#define __func__ __FUNCTION__
#endif
#ifndef NDEBUG
# define FEA_ASSERT(condition, message) \
do\
{ \
if(!(condition))\
{ \
std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
<< " function " << __func__ << " line " << __LINE__ << ": " << message << std::endl; \
FEA_HALT; \
} \
} while (false)
#else
# define FEA_ASSERT(condition, message) do { } while (false)
#endif
#include <fea/config.hpp>
//raise(SIGTRAP);
//std::exit(EXIT_FAILURE);