Fix compatibility with GCC
This commit is contained in:
parent
eca77cbec0
commit
4f5219bbbe
|
@ -37,7 +37,7 @@ endif()
|
||||||
|
|
||||||
# https://t.me/NightShadowsHangout/670691
|
# https://t.me/NightShadowsHangout/670691
|
||||||
# https://t.me/NightShadowsHangout/688372
|
# 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
|
# i have no idea why this hack wasn't needed before but it's needed if sanitizers are used
|
||||||
add_link_options(${FLAGS})
|
add_link_options(${FLAGS})
|
||||||
|
|
4
file.h
4
file.h
|
@ -15,7 +15,7 @@ public:
|
||||||
File(const File&) = delete;
|
File(const File&) = delete;
|
||||||
File& operator=(const File&) = delete;
|
File& operator=(const File&) = delete;
|
||||||
|
|
||||||
inline constexpr File(File&& other) {
|
inline File(File&& other) {
|
||||||
try_close(this->_file);
|
try_close(this->_file);
|
||||||
this->_file = other._file;
|
this->_file = other._file;
|
||||||
other._file = nullptr;
|
other._file = nullptr;
|
||||||
|
@ -47,7 +47,7 @@ public:
|
||||||
throw_system_error("fwrite()");
|
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());
|
this->write(str.data(), str.size());
|
||||||
}
|
}
|
||||||
inline constexpr FILE* get() const noexcept {
|
inline constexpr FILE* get() const noexcept {
|
||||||
|
|
|
@ -105,7 +105,7 @@ static inline std::optional<File> save_file_picker() {
|
||||||
try {
|
try {
|
||||||
File file(path, "w");
|
File file(path, "w");
|
||||||
NFD_FreePath(path);
|
NFD_FreePath(path);
|
||||||
return std::move(file);
|
return file;
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
NFD_FreePath(path);
|
NFD_FreePath(path);
|
||||||
log(std::string("Failed to open file from file picker: ") + e.what());
|
log(std::string("Failed to open file from file picker: ") + e.what());
|
||||||
|
|
|
@ -139,7 +139,7 @@ static inline std::optional<File> open_file_picker() {
|
||||||
try {
|
try {
|
||||||
File file(path, "r");
|
File file(path, "r");
|
||||||
NFD_FreePath(path);
|
NFD_FreePath(path);
|
||||||
return std::move(file);
|
return file;
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
NFD_FreePath(path);
|
NFD_FreePath(path);
|
||||||
log(std::string("Failed to open file from file picker: ") + e.what());
|
log(std::string("Failed to open file from file picker: ") + e.what());
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wconversion"
|
||||||
#include <imgui/imgui_internal.h>
|
#include <imgui/imgui_internal.h>
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
#include "group_panel.h"
|
#include "group_panel.h"
|
||||||
|
|
||||||
// The following code is slightly modified public domain code from https://github.com/thedmd
|
// The following code is slightly modified public domain code from https://github.com/thedmd
|
||||||
|
|
4
log.cpp
4
log.cpp
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
std::vector<LogEntry> log_entries;
|
std::vector<LogEntry> 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;
|
size_t pos;
|
||||||
|
|
||||||
localtime_r(&time, &this->time);
|
localtime_r(&time_, &this->time);
|
||||||
while ((pos = this->message.find('\n')) != std::string::npos) {
|
while ((pos = this->message.find('\n')) != std::string::npos) {
|
||||||
this->message.replace(pos, 1, 1, ' ');
|
this->message.replace(pos, 1, 1, ' ');
|
||||||
}
|
}
|
||||||
|
|
2
log.h
2
log.h
|
@ -9,7 +9,7 @@ struct LogEntry {
|
||||||
std::string message;
|
std::string message;
|
||||||
|
|
||||||
LogEntry() = default;
|
LogEntry() = default;
|
||||||
LogEntry(time_t time, std::string message_);
|
LogEntry(time_t time_, std::string message_);
|
||||||
};
|
};
|
||||||
extern std::vector<LogEntry> log_entries;
|
extern std::vector<LogEntry> log_entries;
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ const char* to_string(Priority priority) {
|
||||||
case Priority::Fatal: return "Fatal";
|
case Priority::Fatal: return "Fatal";
|
||||||
case Priority::Unknown: return "Unknown";
|
case Priority::Unknown: return "Unknown";
|
||||||
}
|
}
|
||||||
|
return "Unknown??";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* to_string(Buffer buffer) {
|
const char* to_string(Buffer buffer) {
|
||||||
|
@ -47,6 +48,7 @@ const char* to_string(Buffer buffer) {
|
||||||
case Buffer::Crash: return "Crash";
|
case Buffer::Crash: return "Crash";
|
||||||
case Buffer::Unknown: return "Unknown";
|
case Buffer::Unknown: return "Unknown";
|
||||||
}
|
}
|
||||||
|
return "Unknown??";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* to_string_lower(Buffer buffer) {
|
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::Crash: return "crash";
|
||||||
case Buffer::Unknown: return "unknown";
|
case Buffer::Unknown: return "unknown";
|
||||||
}
|
}
|
||||||
|
return "Unknown??";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string to_string(const LogcatEntry& logcat_entry) {
|
std::string to_string(const LogcatEntry& logcat_entry) {
|
||||||
|
@ -127,7 +130,7 @@ std::optional<LogcatEntry> try_parse_logcat_entry(char* buf, size_t length, Buff
|
||||||
localtime_r(&time, &logcat_entry.time);
|
localtime_r(&time, &logcat_entry.time);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::move(logcat_entry);
|
return logcat_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<Buffer> try_parse_buffer(char* buf, size_t length) {
|
std::optional<Buffer> 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::Fatal: return 'F';
|
||||||
case Priority::Unknown: return 'U';
|
case Priority::Unknown: return 'U';
|
||||||
}
|
}
|
||||||
|
return 'U';
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline std::string rightpad(const std::string& str, size_t characters) {
|
static inline std::string rightpad(const std::string& str, size_t characters) {
|
||||||
|
|
3
misc.cpp
3
misc.cpp
|
@ -2,7 +2,10 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wconversion"
|
||||||
#include <imgui/imgui_internal.h>
|
#include <imgui/imgui_internal.h>
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include <imgui/imgui.cpp>
|
#include <imgui/imgui.h>
|
||||||
#include "../myimconfig.h"
|
#include "../myimconfig.h"
|
||||||
|
|
||||||
#include "../log.h"
|
#include "../log.h"
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wconversion"
|
||||||
#include <imgui/imgui_internal.h>
|
#include <imgui/imgui_internal.h>
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
Loading…
Reference in New Issue