Skip to content

Commit

Permalink
Fix warnings in Release
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-dejoue committed Aug 12, 2023
1 parent 6aedcd4 commit 420be30
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/gui/src/draw_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <picross/picross.h>
#include <utils/grid_observer.h>

#include <imgui.h>
#include <imgui_wrap.h>

#include <cstddef>

Expand Down
2 changes: 1 addition & 1 deletion src/gui/src/err_window.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "err_window.h"

#include <imgui.h>
#include <imgui_wrap.h>

#include <mutex>
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/gui/src/goal_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "draw_grid.h"
#include "settings.h"

#include <imgui.h>
#include <imgui_wrap.h>


GoalWindow::GoalWindow(const picross::OutputGrid& goal, std::string_view name)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/src/grid_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stdutils/string.h>
#include <utils/input_grid_utils.h>

#include <imgui.h>
#include <imgui_wrap.h>

#include <iomanip>
#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion src/gui/src/grid_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <picross/picross.h>
#include <utils/picross_file_io.h>

#include <imgui.h>
#include <imgui_wrap.h>
#include <portable-file-dialogs.h>

#include <iostream>
Expand Down
7 changes: 7 additions & 0 deletions src/gui/src/imgui_wrap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#if defined(__GNUC__)
#pragma GCC system_header
#endif

#include <imgui.h>
4 changes: 2 additions & 2 deletions src/gui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include <picross/picross.h>
#include <stdutils/macros.h>

#include <portable-file-dialogs.h> // Include before glfw3.h
#include <pfd_wrap.h> // Include before glfw3.h
#include <GLFW/glfw3.h>
#include <imgui.h>
#include <imgui_wrap.h>
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>

Expand Down
7 changes: 7 additions & 0 deletions src/gui/src/pfd_wrap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#if defined(__GNUC__)
#pragma GCC system_header
#endif

#include <portable-file-dialogs.h>
2 changes: 1 addition & 1 deletion src/gui/src/settings_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "settings.h"

#include <imgui.h>
#include <imgui_wrap.h>

#include <cassert>

Expand Down
23 changes: 10 additions & 13 deletions src/picross/src/line_alternatives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace

private:
LineSpanW m_line;
bool m_reset;
bool m_reset;
};

LineAlternatives::Reduction from_line(const LineSpan& line, LineAlternatives::NbAlt nb_alt, bool full)
Expand All @@ -139,11 +139,11 @@ namespace
{
public:
LineExt(const LineSpan& line_span, Tile init_tile)
: m_tiles(line_span.size() + 2, init_tile)
: m_tiles(line_span.size() + 2u, init_tile)
, m_line_span(line_span.type(), line_span.index(), line_span.size(), m_tiles.data() + 1u)
{
m_tiles.front() = Tile::EMPTY;
m_tiles.back() = Tile::EMPTY;
m_tiles.back() = Tile::EMPTY;
}

LineExt(const LineSpan& line_span)
Expand All @@ -156,7 +156,7 @@ namespace
LineSpanW& line_span() { return m_line_span; }
private:
Line::Container m_tiles;
LineSpanW m_line_span;
LineSpanW m_line_span;
};

// An array of LineExt
Expand Down Expand Up @@ -249,10 +249,9 @@ namespace
const auto hole_end = l_holes.end();
assert(hole_it == hole_end || hole_it->m_index >= range.m_line_begin);
auto result_seg_it = result.begin();
const auto result_seg_end = result.end();
while (constraint_it != constraint_end && hole_it != hole_end)
{
assert(result_seg_it != result_seg_end);
assert(result_seg_it != result.end());
const auto seg_len = *constraint_it;
if (seg_len <= hole_it->m_length)
{
Expand Down Expand Up @@ -287,10 +286,9 @@ namespace
const auto hole_end = std::make_reverse_iterator(r_holes.begin());
assert(hole_it == hole_end || (hole_it->m_index + static_cast<int>(hole_it->m_length)) <= range.m_line_end);
auto result_seg_it = std::make_reverse_iterator(result.end());
const auto result_seg_end = std::make_reverse_iterator(result.begin());
while (constraint_it != constraint_end && hole_it != hole_end)
{
assert(result_seg_it != result_seg_end);
assert(result_seg_it != std::make_reverse_iterator(result.begin()));
const auto seg_len = *constraint_it;
if (seg_len <= hole_it->m_length)
{
Expand Down Expand Up @@ -688,9 +686,9 @@ bool LineAlternatives::Impl::narrow_down_segments_range(std::vector<SegmentRange
}

// Right to left pass to refine the leftmost index of each segment
if (nb_segments > 0)
if (nb_segments > 0 && constraint_it != constraint_end)
{
assert(constraint_it != constraint_end && std::next(constraint_it) == constraint_end);
assert(std::next(constraint_it) == constraint_end);
prev_segment_min_index(ranges[nb_segments - 1].m_leftmost_index, *constraint_it, m_bidirectional_range.m_line_end);
for (std::size_t k = nb_segments - 1; k > 0; k--)
{
Expand Down Expand Up @@ -723,10 +721,9 @@ LineAlternatives::Reduction LineAlternatives::Impl::linear_reduction(const std::

const auto nb_segments = ranges.size();
auto constraint_it = m_bidirectional_range.m_constraint_begin;
const auto constraint_end = m_bidirectional_range.m_constraint_end;
const auto line_begin = m_bidirectional_range.m_line_begin;
const auto line_end = m_bidirectional_range.m_line_end;
assert(nb_segments == static_cast<std::size_t>(std::distance(constraint_it, constraint_end)));
assert(nb_segments == static_cast<std::size_t>(std::distance(constraint_it, m_bidirectional_range.m_constraint_end)));

LineExtArray tiles_masks(m_known_tiles, 1u, Tile::UNKNOWN);

Expand All @@ -747,7 +744,7 @@ LineAlternatives::Reduction LineAlternatives::Impl::linear_reduction(const std::
NbAlt nb_alt = 0u;
int min_index = static_cast<int>(m_known_tiles.size() + 1u);
int max_index = -1;
assert(constraint_it != constraint_end);
assert(constraint_it != m_bidirectional_range.m_constraint_end);
const unsigned int seg_length = *constraint_it;
for (int seg_index = ranges[k].m_leftmost_index; seg_index <= ranges[k].m_rightmost_index; seg_index++)
{
Expand Down

0 comments on commit 420be30

Please sign in to comment.