Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion samples/hello/hello-baseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ std::string BaselineCheck::failText(std::uint64_t emitted) const {
"\n run: " + lineB_;
}
if (emitted != baseline_.size()) {
const std::uint64_t at = std::min(emitted, baseline_.size());
// Both arguments must be one type for std::min's template deduction:
// on platforms where uint64_t is not size_t (macOS: unsigned long
// long vs unsigned long) the mixed call is a hard compile error.
const std::uint64_t at =
std::min(emitted, static_cast<std::uint64_t>(baseline_.size()));
return "baseline stream length mismatch: the baseline has " +
std::to_string(baseline_.size()) + " lines, the run produces " +
std::to_string(emitted) + " (first missing/extra at tick " +
Expand Down
10 changes: 9 additions & 1 deletion src/laige-core/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,15 @@ namespace {
// disposition (core dump / debugger / abort) continues unchanged.
void crashHandler(int signum, siginfo_t*, void*) {
static const char msg[] = "laige: fatal signal received; flushing logs\n";
(void)write(STDERR_FILENO, msg, sizeof(msg) - 1);
// glibc declares write() with warn_unused_result (attached under
// fortification, i.e. optimized builds); a (void) cast does not
// suppress it, and the engine's -Werror makes it fatal. Consume the
// result instead — the notice is best-effort, and there is no
// async-signal-safe fallback if the write fails (LOG-007).
const ssize_t written = write(STDERR_FILENO, msg, sizeof(msg) - 1);
if (written == -1) {
// Intentionally empty: nothing else is async-signal-safe here.
}
Logger::instance().crashFlush();
raise(signum);
}
Expand Down
Loading