Skip to content

Commit

Permalink
fix macos build (#935)
Browse files Browse the repository at this point in the history
add ifdef for posix src version
  • Loading branch information
astrophysik authored Nov 9, 2023
1 parent 4420c1a commit 7052bca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions common/dl-utils-lite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,22 @@ void __assert_fail(const char *assertion, const char *file, unsigned int line, c
__builtin_unreachable();
}

void dl_assert__(const char *expr __attribute__((unused)), const char *file_name, const char *func_name,
int line, const char *desc, int use_perror, int generate_coredump) {
void dl_assert__([[maybe_unused]] const char *expr, const char *file_name, const char *func_name,
int line, const char *desc, int use_perror, [[maybe_unused]] int generate_coredump) {
snprintf(assert_message.data(), assert_message.size(),
"dl_assert failed [%s:%d: %s]: %s%s%s", kbasename(file_name), line, func_name, desc,
use_perror ? "; errno message = " : "",
use_perror ? strerror(errno) : "");
fprintf(stderr, "%s\n", assert_message.data());
#if _POSIX_C_SOURCE >= 199309L
sigval value{0};
if (generate_coredump) {
value.sival_int = static_cast<int>(ExtraSignalAction::GENERATE_COREDUMP);
}
sigqueue(getpid(), SIGABRT, value);
#else
abort();
#endif
}

static sigset_t old_mask;
Expand Down

0 comments on commit 7052bca

Please sign in to comment.