Add pedantic warnings to CMake & fix all warnings
This commit is contained in:
parent
9ee0e42695
commit
c7dba5eef2
8 changed files with 25 additions and 17 deletions
|
|
@ -11,6 +11,11 @@ if(PSEMEK_BUILD_TYPE STREQUAL "DEBUG")
|
|||
list(APPEND PSEMEK_DEFINITIONS "-DPSEMEK_DEBUG=1")
|
||||
endif()
|
||||
|
||||
set(PSEMEK_CXX_FLAGS)
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
|
||||
list(APPEND PSEMEK_CXX_FLAGS -Wall -Werror -Wextra -pedantic)
|
||||
endif()
|
||||
|
||||
add_subdirectory(tools)
|
||||
add_subdirectory(libs)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ list(REMOVE_ITEM PSEMEK_LIBRARIES "CMakeLists.txt")
|
|||
foreach(lib ${PSEMEK_LIBRARIES})
|
||||
add_subdirectory(${lib})
|
||||
target_compile_definitions(${lib} PUBLIC ${PSEMEK_DEFINITIONS})
|
||||
target_compile_options(${lib} PUBLIC ${PSEMEK_CXX_FLAGS})
|
||||
endforeach()
|
||||
|
||||
set(PSEMEK_LIBRARIES ${PSEMEK_LIBRARIES} PARENT_SCOPE)
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ namespace psemek::app
|
|||
virtual void on_scene_enter() {}
|
||||
virtual void on_scene_exit() {}
|
||||
|
||||
virtual void on_resize(int width, int height) {}
|
||||
virtual void on_resize(int /* width */, int /* height */) {}
|
||||
virtual void on_focus_gained() {}
|
||||
virtual void on_focus_lost() {}
|
||||
|
||||
virtual void on_mouse_move(int x, int y) {}
|
||||
virtual void on_mouse_wheel(int delta) {}
|
||||
virtual void on_mouse_move(int /* x */, int /* y */) {}
|
||||
virtual void on_mouse_wheel(int /* delta */) {}
|
||||
virtual void on_left_button_down() {}
|
||||
virtual void on_left_button_up() {}
|
||||
virtual void on_middle_button_down() {}
|
||||
|
|
@ -25,8 +25,8 @@ namespace psemek::app
|
|||
virtual void on_right_button_down() {}
|
||||
virtual void on_right_button_up() {}
|
||||
|
||||
virtual void on_key_down(SDL_Keycode key) {}
|
||||
virtual void on_key_up(SDL_Keycode key) {}
|
||||
virtual void on_key_down(SDL_Keycode /* key */) {}
|
||||
virtual void on_key_up(SDL_Keycode /* key */) {}
|
||||
|
||||
virtual void update() {}
|
||||
virtual void render() {}
|
||||
|
|
|
|||
|
|
@ -266,17 +266,17 @@ namespace psemek::gfx
|
|||
|
||||
for (char c : str)
|
||||
{
|
||||
if (c < 32 || c > 128) c = '?';
|
||||
// Guard against unsigned char
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
if ((c < 32) || (c >= 128)) c = '?';
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
int ty = (c - 32) / 16;
|
||||
int tx = (c - 32) % 16;
|
||||
|
||||
std::uint32_t const base = impl().text_vertices.size();
|
||||
|
||||
geom::point<float, 2> position;
|
||||
color_rgba color;
|
||||
geom::point<std::uint16_t, 2> texcoord;
|
||||
|
||||
impl().text_vertices.push_back({pen, opts.c, to_texcoord(tx, ty)});
|
||||
impl().text_vertices.push_back({pen + sx, opts.c, to_texcoord(tx + 1, ty)});
|
||||
impl().text_vertices.push_back({pen + sy, opts.c, to_texcoord(tx, ty + 1)});
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
namespace psemek::log
|
||||
{
|
||||
|
||||
void set_max_thread_name_length(int length);
|
||||
void set_max_thread_name_length(std::size_t length);
|
||||
|
||||
void register_thread(std::string name);
|
||||
void register_thread(std::thread::id id, std::string name);
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@
|
|||
namespace psemek::log
|
||||
{
|
||||
|
||||
static int max_thread_name_length = 5;
|
||||
static std::size_t max_thread_name_length = 5;
|
||||
|
||||
void set_max_thread_name_length(int length)
|
||||
void set_max_thread_name_length(std::size_t length)
|
||||
{
|
||||
max_thread_name_length = length;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ namespace psemek::pcg
|
|||
|
||||
auto c = gauss_coeffs(size, sigma);
|
||||
|
||||
for (int y = 0; y < p.height(); ++y)
|
||||
for (std::size_t y = 0; y < p.height(); ++y)
|
||||
{
|
||||
for (int x = 0; x < p.width(); ++x)
|
||||
for (std::size_t x = 0; x < p.width(); ++x)
|
||||
{
|
||||
for (int j = - size; j <= size; ++j)
|
||||
{
|
||||
|
|
@ -37,11 +37,11 @@ namespace psemek::pcg
|
|||
{
|
||||
int ix = (x + i);
|
||||
while (ix < 0) ix += p.width();
|
||||
if (ix >= p.width()) ix = ix % p.width();
|
||||
if (static_cast<std::size_t>(ix) >= p.width()) ix = ix % p.width();
|
||||
|
||||
int iy = (y + j);
|
||||
while (iy < 0) iy += p.height();
|
||||
if (iy >= p.height()) iy = iy % p.height();
|
||||
if (static_cast<std::size_t>(iy) >= p.height()) iy = iy % p.height();
|
||||
|
||||
res(x, y) += p(ix, iy) * c[i + size] * c[j + size];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <psemek/util/threadpool.hpp>
|
||||
#include <psemek/util/unused.hpp>
|
||||
|
||||
namespace psemek::util
|
||||
{
|
||||
|
|
@ -27,6 +28,7 @@ namespace psemek::util
|
|||
tasks_queue.clear();
|
||||
for (auto const & thread: threads)
|
||||
{
|
||||
unused(thread);
|
||||
tasks_queue.push({});
|
||||
}
|
||||
threads.clear();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue