diff --git a/gui/ConfigHelper.cpp b/gui/ConfigHelper.cpp index 4491200..401539b 100644 --- a/gui/ConfigHelper.cpp +++ b/gui/ConfigHelper.cpp @@ -3,7 +3,7 @@ #include #include -char *OpenFile() { +static char *OpenFile() { char *filename = new char[512]; char cwd[1024]; char command[2048] = R"(zenity --file-selection --title="Select a config file" 2> /dev/null)"; @@ -25,7 +25,7 @@ char *OpenFile() { return res; } -char *SaveFile() { +static char *SaveFile() { char *filename = new char[512]; char cwd[1024]; char command[2048] = R"(zenity --save --file-selection --title="Save Config" 2> /dev/null)"; diff --git a/gui/CustomCurve.cpp b/gui/CustomCurve.cpp index 66949f6..70a8f30 100644 --- a/gui/CustomCurve.cpp +++ b/gui/CustomCurve.cpp @@ -27,7 +27,7 @@ void CustomCurve::ApplyCurveConstraints() { } // Cubic Bezier derivatives -ImVec2 BezierFirstOrderDerivative(ImVec2 p0, ImVec2 p1, ImVec2 p2, ImVec2 p3, float t) { +static ImVec2 BezierFirstOrderDerivative(ImVec2 p0, ImVec2 p1, ImVec2 p2, ImVec2 p3, float t) { float u = (1 - t); float w1 = 3 * (u * u); float w2 = 6 * (u * t); @@ -35,7 +35,7 @@ ImVec2 BezierFirstOrderDerivative(ImVec2 p0, ImVec2 p1, ImVec2 p2, ImVec2 p3, fl return ((p1 - p0) * w1) + ((p2 - p1) * w2) + ((p3 - p2) * w3); } -ImVec2 BezierSecondOrderDerivative(ImVec2 p0, ImVec2 p1, ImVec2 p2, ImVec2 p3, float t) { +static ImVec2 BezierSecondOrderDerivative(ImVec2 p0, ImVec2 p1, ImVec2 p2, ImVec2 p3, float t) { float u = (1 - t); float w1 = 6 * u; float w2 = 6 * t; diff --git a/gui/DriverHelper.cpp b/gui/DriverHelper.cpp index 79a0186..c4f9c9e 100644 --- a/gui/DriverHelper.cpp +++ b/gui/DriverHelper.cpp @@ -14,7 +14,7 @@ #include template -bool GetParameterTy(const std::string ¶m_name, Ty &value) { +static bool GetParameterTy(const std::string ¶m_name, Ty &value) { try { using namespace std; ifstream file(YEETMOUSE_PARAMS_DIR + param_name); @@ -31,7 +31,7 @@ bool GetParameterTy(const std::string ¶m_name, Ty &value) { } } -bool GetParameterTy(const std::string ¶m_name, std::string &value) { +static bool GetParameterTy(const std::string ¶m_name, std::string &value) { try { using namespace std; ifstream file(YEETMOUSE_PARAMS_DIR + param_name); @@ -152,7 +152,7 @@ namespace DriverHelper { } bool SaveParameters() { - return SetParameterTy("update", (int) 1); + return SetParameterTy("update", 1); } bool SavePersistentParameters() { diff --git a/gui/FunctionHelper.h b/gui/FunctionHelper.h index 3711923..7f3df81 100644 --- a/gui/FunctionHelper.h +++ b/gui/FunctionHelper.h @@ -22,7 +22,7 @@ class CachedFunction { CachedFunction(float xStride, Parameters *params); CachedFunction() { - }; + } float EvalFuncAt(float x) const; @@ -53,7 +53,7 @@ class CachedFunction { static constexpr bool velocity = true; std::vector data; - double xStart; + double xStart = 1.0; } synchronous_data; bool SynchronousBuildLUT(); diff --git a/gui/Makefile b/gui/Makefile index 6080be7..277d3d9 100644 --- a/gui/Makefile +++ b/gui/Makefile @@ -4,12 +4,18 @@ CXXFLAGS = -std=c++17 -I . -isystem External # ImPlot has few of these IMGUIFLAGS = -Wformat=0 -Wno-format-security +WARNFLAGS = -Wall -Wextra -pedantic -Wnon-virtual-dtor -Woverloaded-virtual -Wmisleading-indentation -Wformat=2 -Wextra-semi -Wzero-as-null-pointer-constant -Winit-self -Wmissing-declarations -Wdeprecated -Wcast-qual -Wcast-align -Wctor-dtor-privacy -Wno-sign-compare -Wno-unused-parameter + +ifeq (g++, $(CXX)) + WARNFLAGS += -Wduplicated-cond -Wduplicated-branches -Wuseless-cast -Wlogical-op +endif + ifneq (,$(findstring clang,$(CXX))) # ImGui produces many of these IMGUIFLAGS += -Wno-nontrivial-memcall + WARNFLAGS += -Wstring-conversion -Wsuggest-override -Wno-overlength-strings endif -WARNFLAGS = -Wall -Wno-sign-compare OPTIMIZATION_FLAGS = -O2 -flto=auto DEBUG_FLAGS = -g -O0 diff --git a/gui/gui.cpp b/gui/gui.cpp index 5987251..e5e45fb 100755 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -17,7 +17,7 @@ static void glfw_error_callback(int error, const char* description) // Use the default initialization that comes with ImGui as an Example -void SetupImGuiStyle() +static void SetupImGuiStyle() { // nice dark style from ImThemes ImGuiStyle& style = ImGui::GetStyle(); diff --git a/gui/main.cpp b/gui/main.cpp index 1a93643..669fbfa 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -47,7 +47,7 @@ void ResetParameters(); if(selected_device >= devices.size()) \ selected_device = devices.size() - 1;} -int OnGui() { +static int OnGui() { using namespace std::chrono; ImGuiContext &g = *GImGui;