File tree Expand file tree Collapse file tree 1 file changed +12
-19
lines changed Expand file tree Collapse file tree 1 file changed +12
-19
lines changed Original file line number Diff line number Diff line change 24
24
#define ASSERT_UNLIKELY (expression ) ((expression))
25
25
#endif
26
26
27
+ // Visual Studio doesn't have __FILE_NAME__
28
+ #ifdef __FILE_NAME__
29
+ #define _FILENAME_FOR_ASSERT __FILE_NAME__
30
+ #else
31
+ #define _FILENAME_FOR_ASSERT __FILE__
32
+ #endif
33
+
27
34
// ================================ Mandatory Asserts ================================
28
35
29
36
// `ASSERT(expr)`:
41
48
// that are more expensive than you think. You can switch those to
42
49
// `CONDITIONAL_ASSERT` or `DEBUG_ASSERT` as needed.
43
50
44
- // Visual Studio doesn't have __FILE_NAME__
45
- #ifdef __FILE_NAME__
46
-
47
- #define ASSERT (expr ) \
48
- do { \
49
- if (ASSERT_UNLIKELY (!(expr))) { \
50
- ASSERT_failure (#expr, __FILE_NAME__, __LINE__, __func__); \
51
- } \
52
- } while (0 )
53
-
54
- #else
55
-
56
- #define ASSERT (expr ) \
57
- do { \
58
- if (ASSERT_UNLIKELY (!(expr))) { \
59
- ASSERT_failure (#expr, __FILE__, __LINE__, __func__); \
60
- } \
51
+ #define ASSERT (expr ) \
52
+ do { \
53
+ if (ASSERT_UNLIKELY (!(expr))) { \
54
+ ASSERT_failure (#expr, _FILENAME_FOR_ASSERT, __LINE__, __func__); \
55
+ } \
61
56
} while (0 )
62
57
63
- #endif
64
-
65
58
// Function that reports the actual failure when it occurs.
66
59
void ASSERT_failure (const char *expr, const char *file, int line, const char *func);
67
60
You can’t perform that action at this time.
0 commit comments