diff --git a/CMakeLists.txt b/CMakeLists.txt index e4517eb..42a4122 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ endif() # https://t.me/NightShadowsHangout/670691 # https://t.me/NightShadowsHangout/688372 -list(APPEND FLAGS -Werror -Wall -Wextra -Wshadow -Wpedantic -Wno-gnu-anonymous-struct -fPIC -Wconversion -Wno-unused-parameter -Wimplicit-fallthrough) +list(APPEND FLAGS -Werror -Wall -Wextra -Wshadow -Wpedantic -Wno-gnu-anonymous-struct -fPIC -Wconversion -Wno-unused-parameter -Wimplicit-fallthrough -Wno-missing-field-initializers) # i have no idea why this hack wasn't needed before but it's needed if sanitizers are used add_link_options(${FLAGS}) diff --git a/file.h b/file.h index 039c704..cf7166d 100644 --- a/file.h +++ b/file.h @@ -15,7 +15,7 @@ public: File(const File&) = delete; File& operator=(const File&) = delete; - inline constexpr File(File&& other) { + inline File(File&& other) { try_close(this->_file); this->_file = other._file; other._file = nullptr; @@ -47,7 +47,7 @@ public: throw_system_error("fwrite()"); } } - inline constexpr void write(const std::string& str) { + inline void write(const std::string& str) { this->write(str.data(), str.size()); } inline constexpr FILE* get() const noexcept { diff --git a/fragments/export.cpp b/fragments/export.cpp index 3ebcc75..db5c8a0 100644 --- a/fragments/export.cpp +++ b/fragments/export.cpp @@ -105,7 +105,7 @@ static inline std::optional save_file_picker() { try { File file(path, "w"); NFD_FreePath(path); - return std::move(file); + return file; } catch (const std::exception& e) { NFD_FreePath(path); log(std::string("Failed to open file from file picker: ") + e.what()); diff --git a/fragments/import.cpp b/fragments/import.cpp index 2804252..d953135 100644 --- a/fragments/import.cpp +++ b/fragments/import.cpp @@ -139,7 +139,7 @@ static inline std::optional open_file_picker() { try { File file(path, "r"); NFD_FreePath(path); - return std::move(file); + return file; } catch (const std::exception& e) { NFD_FreePath(path); log(std::string("Failed to open file from file picker: ") + e.what()); diff --git a/group_panel.cpp b/group_panel.cpp index e151f11..805fff4 100644 --- a/group_panel.cpp +++ b/group_panel.cpp @@ -1,6 +1,9 @@ #define IMGUI_DEFINE_MATH_OPERATORS #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" #include +#pragma GCC diagnostic pop #include "group_panel.h" // The following code is slightly modified public domain code from https://github.com/thedmd diff --git a/log.cpp b/log.cpp index addf634..1944afa 100644 --- a/log.cpp +++ b/log.cpp @@ -6,10 +6,10 @@ std::vector log_entries; -LogEntry::LogEntry(time_t time, std::string message_) : message(std::move(message_)) { +LogEntry::LogEntry(time_t time_, std::string message_) : message(std::move(message_)) { size_t pos; - localtime_r(&time, &this->time); + localtime_r(&time_, &this->time); while ((pos = this->message.find('\n')) != std::string::npos) { this->message.replace(pos, 1, 1, ' '); } diff --git a/log.h b/log.h index 3b3e3dd..a84d2a1 100644 --- a/log.h +++ b/log.h @@ -9,7 +9,7 @@ struct LogEntry { std::string message; LogEntry() = default; - LogEntry(time_t time, std::string message_); + LogEntry(time_t time_, std::string message_); }; extern std::vector log_entries; diff --git a/logcat_entry.cpp b/logcat_entry.cpp index cc1613b..1518569 100644 --- a/logcat_entry.cpp +++ b/logcat_entry.cpp @@ -36,6 +36,7 @@ const char* to_string(Priority priority) { case Priority::Fatal: return "Fatal"; case Priority::Unknown: return "Unknown"; } + return "Unknown??"; } const char* to_string(Buffer buffer) { @@ -47,6 +48,7 @@ const char* to_string(Buffer buffer) { case Buffer::Crash: return "Crash"; case Buffer::Unknown: return "Unknown"; } + return "Unknown??"; } const char* to_string_lower(Buffer buffer) { @@ -58,6 +60,7 @@ const char* to_string_lower(Buffer buffer) { case Buffer::Crash: return "crash"; case Buffer::Unknown: return "unknown"; } + return "Unknown??"; } std::string to_string(const LogcatEntry& logcat_entry) { @@ -127,7 +130,7 @@ std::optional try_parse_logcat_entry(char* buf, size_t length, Buff localtime_r(&time, &logcat_entry.time); } - return std::move(logcat_entry); + return logcat_entry; } std::optional try_parse_buffer(char* buf, size_t length) { @@ -234,6 +237,7 @@ static inline char to_char(Priority priority) { case Priority::Fatal: return 'F'; case Priority::Unknown: return 'U'; } + return 'U'; } static inline std::string rightpad(const std::string& str, size_t characters) { diff --git a/misc.cpp b/misc.cpp index 9a8d43b..87fc8d9 100644 --- a/misc.cpp +++ b/misc.cpp @@ -2,7 +2,10 @@ #include #include #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" #include +#pragma GCC diagnostic pop #include "misc.h" diff --git a/windows/debug.cpp b/windows/debug.cpp index 5fa4461..79a14b1 100644 --- a/windows/debug.cpp +++ b/windows/debug.cpp @@ -1,4 +1,4 @@ -#include +#include #include "../myimconfig.h" #include "../log.h" diff --git a/windows/main.cpp b/windows/main.cpp index 60aeff6..77c4684 100644 --- a/windows/main.cpp +++ b/windows/main.cpp @@ -1,5 +1,8 @@ #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" #include +#pragma GCC diagnostic pop #include #include #include