summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-02 11:38:37 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-02 11:38:37 +0100
commitb98f3159744b800e664d2aae61aa6faf9453f057 (patch)
treecc1a967de80af2c837bc8a47ea7857104985b9f7
parentf8663e13d49e50412c2faccf0d6c46bc3a90a9f1 (diff)
c
-rw-r--r--editor/inspect-draw.cpp6
-rw-r--r--editor/tests/raycast-test.cpp2
-rw-r--r--editor/update.cpp4
-rw-r--r--editor/vobj-editor.cpp4
-rw-r--r--userconfig-sthalik@Windows-GNU.cmake11
5 files changed, 17 insertions, 10 deletions
diff --git a/editor/inspect-draw.cpp b/editor/inspect-draw.cpp
index 34c096ea..e47ac692 100644
--- a/editor/inspect-draw.cpp
+++ b/editor/inspect-draw.cpp
@@ -20,13 +20,13 @@ void app::draw_inspector()
const auto dpi = M->dpi_scale();
auto& w = M->world();
- for (auto i = inspectors.size()-1; i != -1uz; i--)
+ for (auto i = (int)(inspectors.size()-1); i >= 0; i--)
{
auto [id, target] = inspectors[i];
auto e_ = w.find_object(id);
if (!e_)
{
- erase_inspector(i);
+ erase_inspector((unsigned)i);
continue;
}
auto& e = *e_;
@@ -53,7 +53,7 @@ auto z = e.coord.z();
(void)ret;
}
if (!is_open)
- erase_inspector(i);
+ erase_inspector((unsigned)i);
}
}
diff --git a/editor/tests/raycast-test.cpp b/editor/tests/raycast-test.cpp
index 24f0fde2..ec0dc5ec 100644
--- a/editor/tests/raycast-test.cpp
+++ b/editor/tests/raycast-test.cpp
@@ -225,7 +225,7 @@ struct raycast_test : base_test
auto size = Vector2ui(Math::round(Math::abs(v)));
const auto half = Vector2i(v*.5);
- auto nsteps = (uint32_t)Math::ceil(Math::abs(vec[long_axis] / step));
+ auto nsteps = (uint32_t)Math::max(1., Math::ceil(Math::abs(vec[long_axis] / step)));
result.path.clear();
result.path.reserve(nsteps);
diff --git a/editor/update.cpp b/editor/update.cpp
index 62f0e5d3..6e6a18e7 100644
--- a/editor/update.cpp
+++ b/editor/update.cpp
@@ -209,8 +209,8 @@ void app::update_world(float dt)
auto& c = *c_;
const auto& es = c.objects();
const auto size = es.size();
- for (auto i = size-1; i != (size_t)-1; i--)
- es[i]->update(i, dt);
+ for (auto i = (int)(size-1); i >= 0; i--)
+ es[i]->update((unsigned)i, dt);
}
}
diff --git a/editor/vobj-editor.cpp b/editor/vobj-editor.cpp
index 61eb0de7..ea9b8659 100644
--- a/editor/vobj-editor.cpp
+++ b/editor/vobj-editor.cpp
@@ -47,11 +47,11 @@ void vobj_editor::place_tile(world& w, global_coords pos, const vobj_* x, struct
const auto& es = c.objects();
start: while (auto id = a.get_object_colliding_with_cursor())
{
- for (auto i = es.size()-1; i != (size_t)-1; i--)
+ for (auto i = (int)(es.size()-1); i >= 0; i--)
{
if (es[i]->id == id)
{
- c.remove_object(i);
+ c.remove_object((unsigned)i);
goto start;
}
}
diff --git a/userconfig-sthalik@Windows-GNU.cmake b/userconfig-sthalik@Windows-GNU.cmake
index 0a7d7cc1..632950cf 100644
--- a/userconfig-sthalik@Windows-GNU.cmake
+++ b/userconfig-sthalik@Windows-GNU.cmake
@@ -1,7 +1,7 @@
sets(STRING
CMAKE_C_FLAGS ""
CMAKE_C_FLAGS_DEBUG "-O0 -g -ggdb -fstack-protector-all"
- CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -ftree-vectorize -march=core2 -mtune=native -mavx -flto -fipa-pta -static"
+ CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -ftree-vectorize -funsafe-loop-optimizations -march=core2 -mtune=native -mavx -flto -fipa-pta -static"
)
sets(STRING
@@ -16,11 +16,15 @@ list(APPEND CMAKE_IGNORE_PREFIX_PATH "c:/msys64" "c:/msys64/clang64")
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fconcepts-diagnostics-depth=3>)
add_compile_options(-fdiagnostics-color=always)
set(OpenCV_DIR "f:/dev/opentrack-depends/opencv/build-gcc/install" CACHE PATH "" FORCE)
+add_compile_options(-fstack-usage -Wstack-usage=8192)
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
add_definitions(-D_GLIBCXX_ASSERTIONS)
add_definitions(-D_GLIBCXX_USE_DEPRECATED=0 -D_GLIBCXX_USE_CXX11_ABI)
add_definitions(-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_GLIBCXX_DEBUG_BACKTRACE)
+ add_definitions(-D_FORTIFY_SOURCE=3)
+else()
+ add_definitions(-D_FORTIFY_SOURCE=2)
endif()
set(FLOORMAT_SUBMODULE-SDL2 1)
@@ -59,13 +63,16 @@ function(fm-userconfig-external)
MAGNUM_BUILD_STATIC_UNIQUE_GLOBALS OFF
)
endif()
-
endfunction()
# for floormat sources only
function(fm-userconfig-src)
add_compile_options(
-Wall -Wextra -Wpedantic -Wno-old-style-cast -Wno-padded
+ -Wstringop-overflow -Wstringop-truncation
+ -Wswitch-enum -Wlarger-than=8192
+ -Wlogical-op
+ -Wunsafe-loop-optimizations
#-fconcepts-diagnostics-depth=2
)
#add_compile_options(-Wuseless-cast)