mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Basic: Handle missing __FILE_NAME__ on Windows
This commit is contained in:
@@ -41,6 +41,9 @@
|
||||
// that are more expensive than you think. You can switch those to
|
||||
// `CONDITIONAL_ASSERT` or `DEBUG_ASSERT` as needed.
|
||||
|
||||
// Visual Studio doesn't have __FILE_NAME__
|
||||
#ifdef __FILE_NAME__
|
||||
|
||||
#define ASSERT(expr) \
|
||||
do { \
|
||||
if (ASSERT_UNLIKELY(!(expr))) { \
|
||||
@@ -48,6 +51,17 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define ASSERT(expr) \
|
||||
do { \
|
||||
if (ASSERT_UNLIKELY(!(expr))) { \
|
||||
ASSERT_failure(#expr, __FILE__, __LINE__, __func__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
// Function that reports the actual failure when it occurs.
|
||||
void ASSERT_failure(const char *expr, const char *file, int line, const char *func);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user