diff --git a/Editor/CodeEditor.cpp b/Editor/CodeEditor.cpp index 225b6d14..d67007c5 100644 --- a/Editor/CodeEditor.cpp +++ b/Editor/CodeEditor.cpp @@ -30,7 +30,7 @@ void CodeEditor::Render() { ImGuiTabBarFlags tabBarFlags = ImGuiTabBarFlags_AutoSelectNewTabs | ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_Reorderable; if(ImGui::BeginTabBar("#CodeEditorOpenTabs", tabBarFlags)) { - for (auto i = 0; i < tabs.size(); i++) { + for (size_t i = 0; i < tabs.size(); i++) { if (i == removedTabIndex) { continue; } auto& tab = tabs[i]; @@ -66,14 +66,14 @@ void CodeEditor::End() { ImGui::End(); ImGui::PopID(); - if (removedTabIndex != -1) { + if (removedTabIndex != std::numeric_limits::max()) { tabs.erase(tabs.begin() + removedTabIndex); - removedTabIndex = -1; + removedTabIndex = std::numeric_limits::max(); } } void CodeEditor::RenderMenuBar() { - bool menuBarEnabled = selectedTabIndex != -1; + bool menuBarEnabled = selectedTabIndex != std::numeric_limits::max(); if (menuBarEnabled) { bool shortcutsEnabled = menuBarEnabled; if (ImGui::Shortcut(ImGuiMod_Ctrl | ImGuiKey_S) && shortcutsEnabled) { @@ -185,10 +185,13 @@ void CodeEditor::AddTab(AssetHandle assetHandle) { selectedTabIndex++; } -void CodeEditor::CloseTabAt(int index) { +void CodeEditor::CloseTabAt(size_t index) { removedTabIndex = index; if (removedTabIndex <= selectedTabIndex) { - selectedTabIndex = std::max(0, selectedTabIndex--); + selectedTabIndex--; + if(selectedTabIndex == std::numeric_limits::max()) { + selectedTabIndex = 0; + } } } @@ -204,7 +207,7 @@ void CodeEditor::OnReimport(Assets& assets) { } } void CodeEditor::OnAssetDeleted(AssetHandle handle) { - for (int i = 0; i < tabs.size(); i++) { + for (size_t i = 0; i < tabs.size(); i++) { if (tabs[i].currentAsset == handle) { CloseTabAt(i); return; diff --git a/Editor/CodeEditor.hpp b/Editor/CodeEditor.hpp index 59924ceb..4b4b3c08 100644 --- a/Editor/CodeEditor.hpp +++ b/Editor/CodeEditor.hpp @@ -51,14 +51,14 @@ struct CodeEditor { bool isWhitespaceVisible{ true }; int tabSize{ 4 }; - int selectedTabIndex{ -1 }; + size_t selectedTabIndex{ std::numeric_limits::max() }; std::vector tabs{}; EditorTab emptyTab{}; - int removedTabIndex{ -1 }; + size_t removedTabIndex{ std::numeric_limits::max() }; void AddTab(AssetHandle assetHandle); - void CloseTabAt(int index); + void CloseTabAt(size_t index); void RenderMenuBar(); diff --git a/Editor/ImGuiDebugPanel.cpp b/Editor/ImGuiDebugPanel.cpp index 5c11c182..aee2f8fb 100644 --- a/Editor/ImGuiDebugPanel.cpp +++ b/Editor/ImGuiDebugPanel.cpp @@ -1,3 +1,9 @@ +// This is external code. Disabling warnings. +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wsign-compare" +#endif + #if _DEBUG #include @@ -232,4 +238,8 @@ void TextEditor::UnitTests() { assert(!FindNextOccurrence("lalal", 4, { 3, 5 }, outStart, outEnd)); // not found } } +#endif + +#if defined(__clang__) +#pragma clang diagnostic pop #endif \ No newline at end of file diff --git a/Editor/TextEditor.cpp b/Editor/TextEditor.cpp index f2bce898..776c3db9 100644 --- a/Editor/TextEditor.cpp +++ b/Editor/TextEditor.cpp @@ -1,3 +1,11 @@ +// This is external code. Disabling warnings. +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreorder-ctor" +#pragma clang diagnostic ignored "-Wsign-compare" +#pragma clang diagnostic ignored "-Wlogical-op-parantheses" +#endif + #include #include #include @@ -2489,4 +2497,8 @@ void TextEditor::UndoRecord::Redo(TextEditor* aEditor) { aEditor->mState = mAfter; aEditor->EnsureCursorVisible(); -} \ No newline at end of file +} + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif \ No newline at end of file diff --git a/Engine/SceneDeserializer.cpp b/Engine/SceneDeserializer.cpp index fee76100..f549c707 100644 --- a/Engine/SceneDeserializer.cpp +++ b/Engine/SceneDeserializer.cpp @@ -147,7 +147,7 @@ void SceneDeserializer::Entities::DefaultDeserializePerspectiveCameraComponent(t PerspectiveCameraComponent perspective{ entity, std::move(camera) }; scene.InsertComponent(perspective.GetEntity(), std::move(perspective)); } -void SceneDeserializer::Entities::DefaultDeserializeUserDefinedComponents(tinyxml2::XMLElement& componentNode, Scene& scene, Entity entity, const std::string& name) {} +void SceneDeserializer::Entities::DefaultDeserializeUserDefinedComponents([[maybe_unused]] tinyxml2::XMLElement& componentNode, [[maybe_unused]] Scene& scene, [[maybe_unused]] Entity entity, [[maybe_unused]] const std::string& name) {} int SceneDeserializer::Helpers::DeserializeEnum(const tinyxml2::XMLElement& property) { return property.IntAttribute("value"); diff --git a/Launcher/FileDialog.cpp b/Launcher/FileDialog.cpp index c416e5be..5749c13b 100644 --- a/Launcher/FileDialog.cpp +++ b/Launcher/FileDialog.cpp @@ -1,3 +1,9 @@ +// This is external code. Disabling warnings. +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunsequenced" // Disable -Wunsequenced, https://easings.net/#easeOutBounce +#endif + #include #include @@ -1532,4 +1538,8 @@ static const unsigned int folder_icon[] = { #ifndef _WIN32 static const char* GetDefaultFolderIcon() { return (const char*) &folder_icon[0]; } static const char* GetDefaultFileIcon() { return (const char*) &file_icon[0]; } +#endif + +#if defined(__clang__) +#pragma clang diagnostic pop #endif \ No newline at end of file