File tree 2 files changed +14
-6
lines changed
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ void assertion_t::tick(cdomain_handle_t cd) {
32
32
33
33
static vector<assertion_t *> assertions;
34
34
35
- void chdl::assert (std::string text, node n) {
35
+ void chdl::assert_node_true (std::string text, node n) {
36
36
assertions.push_back (new assertion_t (text, n));
37
37
}
38
38
Original file line number Diff line number Diff line change 1
1
// The assertion system allows certain error conditions to cause simulation to
2
2
// finish with an error message
3
- #ifndef __ASSERT_H
4
- #define __ASSERT_H
3
+ #ifndef CHDL_ASSERT_H
4
+ #define CHDL_ASSERT_H
5
5
#include < string>
6
6
7
7
#include " node.h"
8
8
9
9
namespace chdl {
10
- void assert (std::string text, node node);
10
+ void assert_node_true (std::string text, node node);
11
11
};
12
12
13
13
#define CHDL_STRINGIFY_INTERNAL (x ) #x
14
14
#define CHDL_STRINGIFY (x ) CHDL_STRINGIFY_INTERNAL(x)
15
15
#define CHDL_LINE_STR CHDL_STRINGIFY (__LINE__)
16
16
17
+ #ifndef CHDL_DISABLE_ASSERT
18
+ #ifdef ASSERT
19
+ // ASSERT has already been defined by another library. This is only a problem
20
+ // if it was used in CHDL code.
21
+ #error ASSERT already #defined. #undef it or define CHDL_DISABLE_ASSERT.
22
+ #else
17
23
#define ASSERT (x ) do { \
18
- assert (std::string (" Failed assertion in " ) + \
19
- __FILE__ " : Line " CHDL_LINE_STR, x); \
24
+ assert_node_true (std::string (" Failed assertion in " ) + \
25
+ __FILE__ " : Line " CHDL_LINE_STR, x); \
20
26
} while (0 )
27
+ #endif
28
+ #endif
21
29
22
30
#endif
You can’t perform that action at this time.
0 commit comments