| ... | @@ -60,6 +60,20 @@ | ... | @@ -60,6 +60,20 @@ |
| 60 | #define zig_breakpoint() raise(SIGTRAP) | 60 | #define zig_breakpoint() raise(SIGTRAP) |
| 61 | #endif | 61 | #endif |
| 62 | | 62 | |
| | 63 | #if defined(_MSC_VER) |
| | 64 | #define zig_return_address() _ReturnAddress() |
| | 65 | #elif defined(__GNUC__) |
| | 66 | #define zig_return_address() __builtin_extract_return_addr(__builtin_return_address(0)) |
| | 67 | #else |
| | 68 | #define zig_return_address() 0 |
| | 69 | #endif |
| | 70 | |
| | 71 | #if defined(__GNUC__) |
| | 72 | #define zig_frame_address() __builtin_frame_address(0) |
| | 73 | #else |
| | 74 | #define zig_frame_address() 0 |
| | 75 | #endif |
| | 76 | |
| 63 | #if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__) | 77 | #if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__) |
| 64 | #include <stdatomic.h> | 78 | #include <stdatomic.h> |
| 65 | #define zig_cmpxchg_strong(obj, expected, desired, succ, fail) atomic_compare_exchange_strong_explicit(obj, &(expected), desired, succ, fail) | 79 | #define zig_cmpxchg_strong(obj, expected, desired, succ, fail) atomic_compare_exchange_strong_explicit(obj, &(expected), desired, succ, fail) |