diff --git a/CMakeLists.txt b/CMakeLists.txt index 851e31324dd4f2e0756babc065a3f58ffb64426b..a3c43afa8408714259ec920c47f0c70b913604d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,11 +86,15 @@ endif() # end windows support ## - # engine #add_subdirectory(vendor/imgui/) add_subdirectory(fggl) +## G++ enable insane checks +target_compile_options( ${PROJECT_NAME} PRIVATE -Wall -fno-strict-aliasing -fno-strict-overflow ) + + + # extras #add_subdirectory(tests) add_subdirectory(demo) diff --git a/fggl/data/model.cpp b/fggl/data/model.cpp index b57aa33f2f6ec5edda22e2930dd122ddc4b9da07..157c2a5067123fd7075748853b32d4ac5282c02b 100644 --- a/fggl/data/model.cpp +++ b/fggl/data/model.cpp @@ -6,7 +6,7 @@ using namespace fggl::data; -Mesh::Mesh() : m_verts(0), m_index(0), restartVertex(Mesh::INVALID_IDX) { +Mesh::Mesh() : restartVertex(Mesh::INVALID_IDX), m_verts(0), m_index(0) { } void Mesh::pushIndex(unsigned int idx) { diff --git a/fggl/data/procedural.cpp b/fggl/data/procedural.cpp index ec408f2a0082d881422e7a3530c18413cbea8092..2598f7220631dd8ce4bc4850d954f10fab6ac06a 100644 --- a/fggl/data/procedural.cpp +++ b/fggl/data/procedural.cpp @@ -1,4 +1,5 @@ +#include <cstddef> #include <fggl/data/procedural.hpp> #include <fggl/data/model.hpp> @@ -53,7 +54,7 @@ static void compute_normals(fggl::data::Mesh& mesh, // we need to calculate the contribution for each vertex // this assumes IDXList describes a raw triangle list (ie, not quads and not a strip) - for ( int i=0; i < idxList.size(); i += 3) { + for ( std::size_t i=0; i < idxList.size(); i += 3) { auto& v1 = mesh.vertex( idxMapping[idxList[i]] ); auto& v2 = mesh.vertex( idxMapping[idxList[i + 1]] ); auto& v3 = mesh.vertex( idxMapping[idxList[i + 2]] ); diff --git a/fggl/ecs3/fast/Container.cpp b/fggl/ecs3/fast/Container.cpp index 1473365dcc973fd9c240f80914bb21de7e2ab725..7941260d57536ee01e51f66f22419832105df7e5 100644 --- a/fggl/ecs3/fast/Container.cpp +++ b/fggl/ecs3/fast/Container.cpp @@ -8,7 +8,7 @@ namespace fggl::ecs3 { std::ostream& operator<<(std::ostream& out, RecordIdentifier const& curr) { out << "record("; - for (int i=0; i<curr.count; i++) { + for (std::size_t i=0; i<curr.count; i++) { out << i; if ( i != curr.count-1) { out << ","; diff --git a/fggl/gfx/input.cpp b/fggl/gfx/input.cpp index ef7329fa0498e9936370e0bed47252ca425444b4..47fc410d7191762ed68098a0ee1978be45af20d6 100644 --- a/fggl/gfx/input.cpp +++ b/fggl/gfx/input.cpp @@ -6,7 +6,7 @@ using fggl::gfx::Input; -Input::Input() : m_mouse_curr(), m_mouse_last(), m_joydata(), m_joysticks(), m_pad_last(), m_pad_curr() { +Input::Input() : m_mouse_curr(), m_mouse_last(), m_joysticks(), m_joydata(), m_pad_curr(), m_pad_last() { clear(); } diff --git a/fggl/math/triangulation.cpp b/fggl/math/triangulation.cpp index d235b8ef7130b0e9fd9ebe5530235a459d25fdd9..f855734e92a3ab2e6e0f2afcd82efbdf5fff78e7 100644 --- a/fggl/math/triangulation.cpp +++ b/fggl/math/triangulation.cpp @@ -35,7 +35,7 @@ namespace fggl::math { // deal with the indices const auto nTris = polygon.size() - 2; - for (auto i = 0; i < nTris; i++) { + for (auto i = 0u; i < nTris; i++) { mesh.add_index(firstIdx); mesh.add_index(prevIdx); diff --git a/include/fggl/ecs3/fast/Container.h b/include/fggl/ecs3/fast/Container.h index 4b6a5290b2ed5190faefc6fa83183917ac5cbeda..18b1fa158192ecc9517dcba059cb24a2aef73c82 100644 --- a/include/fggl/ecs3/fast/Container.h +++ b/include/fggl/ecs3/fast/Container.h @@ -13,17 +13,17 @@ namespace fggl::ecs3 { + class Container { public: const RecordIdentifier m_identifier; Container(const TypeRegistry ®, RecordIdentifier id) : + m_identifier(id), m_types(reg), - m_identifier(id), backingStore(nullptr), - m_capacity(0), - m_size(0) { - }; + m_size(0), + m_capacity(0) {}; ~Container() { delete[] backingStore; @@ -80,7 +80,7 @@ namespace fggl::ecs3 { inline std::size_t idx(entity_t entity) { auto *entityData = data<EntityMeta>(); - for (int i = 0; i < m_size; i++) { + for (std::size_t i = 0; i < m_size; i++) { if (entityData[i].id == entity) { return i; } diff --git a/include/fggl/ecs3/prototype/world.h b/include/fggl/ecs3/prototype/world.h index 7b633487bbf97c837c92dd0933806fdd6a2625e6..4cc8a5bdbb790b7c82972446685cfe34c3f693a7 100644 --- a/include/fggl/ecs3/prototype/world.h +++ b/include/fggl/ecs3/prototype/world.h @@ -19,7 +19,7 @@ namespace fggl::ecs3::prototype { public: bool m_abstract; - explicit Entity(entity_t id) : m_id(id), m_abstract(false) {}; + explicit Entity(entity_t id) : m_abstract(false), m_id(id) {}; Entity(const Entity &entity) : m_id(entity.m_id), m_components(entity.m_components) { //spdlog::info("entity created fro copy: {}", m_id); diff --git a/include/fggl/ecs3/types.hpp b/include/fggl/ecs3/types.hpp index 4a7ffc33c819382ee4a9ce7f6c79f3bc008995be..6c011d3602a100117bfe143c10fbad3327b94639 100644 --- a/include/fggl/ecs3/types.hpp +++ b/include/fggl/ecs3/types.hpp @@ -101,7 +101,7 @@ namespace fggl::ecs3 { } else if (count > other.count) { return false; } else { - for (int i = 0; i < count; i++) { + for (std::size_t i = 0; i < count; i++) { if (types[i] != other.types[i]) { return types[i] < other.types[i]; } @@ -115,7 +115,7 @@ namespace fggl::ecs3 { return false; } - for (int i = 0; i < count; i++) { + for (std::size_t i = 0; i < count; i++) { if (types[i] != arg.types[i]) { return false; } diff --git a/include/fggl/math/types.hpp b/include/fggl/math/types.hpp index 4639d48fa9c0b34a8e33099c04ff1c4739cbea19..6125c37223b421329c547550b1b5d6d78e4619ef 100644 --- a/include/fggl/math/types.hpp +++ b/include/fggl/math/types.hpp @@ -90,7 +90,7 @@ namespace fggl::math { struct Transform { constexpr static const char name[] = "Transform"; - Transform() : m_local(1.0f), m_origin(0.0f), m_model(1.0f), m_rotation(1.0f, 0.0f, 0.0f, 0.0f) { + Transform() : m_local(1.0f), m_model(1.0f), m_origin(0.0f), m_rotation(1.0f, 0.0f, 0.0f, 0.0f) { } // local reference vectors