Skip to content

Commit d445dd7

Browse files
committed
Better abort_unless location reporting
1 parent b0585a2 commit d445dd7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/native/shared/cpp-util.hh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "helpers.hh"
1616

1717
static inline void
18-
do_abort_unless (const char* fmt, ...)
18+
do_abort_unless (std::source_location sloc, const char* fmt, ...)
1919
{
2020
va_list ap;
2121

@@ -24,12 +24,12 @@ do_abort_unless (const char* fmt, ...)
2424
int n = vasprintf (&message, fmt, ap);
2525
va_end (ap);
2626

27-
xamarin::android::Helpers::abort_application (n == -1 ? "Unable to allocate memory for abort message" : message);
27+
xamarin::android::Helpers::abort_application (n == -1 ? "Unable to allocate memory for abort message" : message, true /* log_location */, sloc);
2828
}
2929

3030
#define abort_unless(_condition_, _fmt_, ...) \
3131
if (!(_condition_)) [[unlikely]] { \
32-
do_abort_unless ("%s:%d (%s): " _fmt_, __FILE__, __LINE__, __FUNCTION__, ## __VA_ARGS__); \
32+
do_abort_unless (std::source_location::current (), _fmt_, ## __VA_ARGS__); \
3333
}
3434

3535
#define abort_if_invalid_pointer_argument(_ptr_) abort_unless ((_ptr_) != nullptr, "Parameter '%s' must be a valid pointer", #_ptr_)

0 commit comments

Comments
 (0)