From 3af9b108909ee1e138cb8b3b6659563ab763e038 Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Sun, 5 Apr 2026 15:45:27 +0200 Subject: internal: silence compiler warnings about unused return values (#13997) * misc: silence warnings about ignoring return value on reads silence warnings on ignored return values on read() and print an error if it occurs. * misc: silence warnings about ignoring return value on writes silence warnings on ignored return values on write() and print an error where we can, or pass them the maybe_unused attribute. * misc: silence warnings about ignoring return value on pipe silence warnings on ignored return value on pipe(), print an error and exit on failure. --- src/Compositor.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 18d158ae..2a9b0947 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -117,8 +117,8 @@ static void handleUnrecoverableSignal(int sig) { // Kill the program if the crash-reporter is caught in a deadlock. signal(SIGALRM, [](int _) { - char const* msg = "\nCrashReporter exceeded timeout, forcefully exiting\n"; - write(2, msg, strlen(msg)); + char const* msg = "\nCrashReporter exceeded timeout, forcefully exiting\n"; + [[maybe_unused]] auto w = write(2, msg, strlen(msg)); abort(); }); alarm(15); @@ -550,8 +550,8 @@ void CCompositor::cleanup() { if (!m_wlDisplay) return; - if (m_watchdogWriteFd.isValid()) - write(m_watchdogWriteFd.get(), "end", 3); + if (m_watchdogWriteFd.isValid()) [[maybe_unused]] + auto w = write(m_watchdogWriteFd.get(), "end", 3); signal(SIGABRT, SIG_DFL); signal(SIGSEGV, SIG_DFL); @@ -803,8 +803,10 @@ void CCompositor::startCompositor() { Event::bus()->m_events.ready.emit(); - if (m_watchdogWriteFd.isValid()) - write(m_watchdogWriteFd.get(), "vax", 3); + if (m_watchdogWriteFd.isValid()) { + if (write(m_watchdogWriteFd.get(), "vax", 3) < 0) + Log::logger->log(Log::ERR, "startCompositor: failed to write to watchdogWriteFd {}: {}", m_watchdogWriteFd.get(), strerror(errno)); + } // This blocks until we are done. Log::logger->log(Log::DEBUG, "Hyprland is ready, running the event loop!"); -- cgit v1.2.3