From 27e17ac78a076215c7fe0a9260fd4de9edf19e68 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Thu, 2 Sep 2021 20:59:20 +0200
Subject: [PATCH] BUILD: Fix gcc warnings

---
 PreCompiledHeaders.cmake | 1 +
 src/Lib/Log.cc           | 2 +-
 src/VivyApplication.cc   | 7 ++++++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/PreCompiledHeaders.cmake b/PreCompiledHeaders.cmake
index 4d9128d5..1de55147 100644
--- a/PreCompiledHeaders.cmake
+++ b/PreCompiledHeaders.cmake
@@ -25,6 +25,7 @@ set(STL_INC
     <mutex>
     <iomanip>
     <filesystem>
+    <bit>
 )
 
 set(EXT_INC PRIVATE
diff --git a/src/Lib/Log.cc b/src/Lib/Log.cc
index 51a8ee1a..db13553b 100644
--- a/src/Lib/Log.cc
+++ b/src/Lib/Log.cc
@@ -142,7 +142,7 @@ LogMessage::LogMessage(LogMessage &&other) noexcept
     , parentLogger(other.parentLogger)
 {
     std::memcpy(this, &other, sizeof(LogMessage));
-    std::memset(&other, 0, sizeof(LogMessage));
+    std::memset(reinterpret_cast<void *>(&other), 0, sizeof(LogMessage));
 }
 
 LogMessage &&
diff --git a/src/VivyApplication.cc b/src/VivyApplication.cc
index 343b2f14..286bd28e 100644
--- a/src/VivyApplication.cc
+++ b/src/VivyApplication.cc
@@ -33,6 +33,7 @@ VivyApplication::setTheme(Theme theme) noexcept
     QFile stylesheet(sheet);
     if (!stylesheet.exists()) {
         logFatal() << "Missing stylesheet!";
+        exit(EXIT_FAILURE);
     } else {
         stylesheet.open(QFile::ReadOnly | QFile::Text);
         QTextStream stylesheetStream(&stylesheet);
@@ -92,6 +93,9 @@ VivyApplication::exec() noexcept
         return QApplication::exec();
     }
     }
+
+    logFatal() << "Unreachable: undefined ApplicationType";
+    return 1;
 }
 
 QFont
@@ -111,7 +115,8 @@ VivyApplication::getApplicationFont(Font id) const noexcept
     }
 
     // Let the program crash
-    logFatal() << "Unreachable";
+    logError() << "Unreachable: undefined font id";
+    return getFontFromId(fontIdRegular);
 }
 
 MainWindow *
-- 
GitLab