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 2424#define ASSERT_UNLIKELY (expression ) ((expression))
2525#endif
2626
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+
2734// ================================ Mandatory Asserts ================================
2835
2936// `ASSERT(expr)`:
4148// that are more expensive than you think. You can switch those to
4249// `CONDITIONAL_ASSERT` or `DEBUG_ASSERT` as needed.
4350
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+ } \
6156 } while (0 )
6257
63- #endif
64-
6558// Function that reports the actual failure when it occurs.
6659void ASSERT_failure (const char *expr, const char *file, int line, const char *func);
6760
You can’t perform that action at this time.
0 commit comments