Skip to content

Commit

Permalink
workaround for Walloc-size-larger-than in GCC 14 when LTO is enabled
Browse files Browse the repository at this point in the history
Fixes #85
  • Loading branch information
cfillion committed Aug 16, 2024
1 parent be024ec commit a92743e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/listview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ int ListView::columnWidth(const int index) const
return ListView_GetColumnWidth(handle(), index);
}

int ListView::columnCount() const
{
#ifdef __GNUC__
// workaround for Walloc-size-larger-than in GCC 14 when LTO is enabled
if(m_cols.size() > INT_MAX)
__builtin_unreachable();
#endif

return static_cast<int>(m_cols.size());
}

void ListView::sort()
{
static const auto compare = [](LPARAM aRow, LPARAM bRow, LPARAM param)
Expand Down
2 changes: 1 addition & 1 deletion src/listview.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class ListView : public Control {
const Column &column(int index) const { return m_cols[index]; }
void resizeColumn(int index, int width);
int columnWidth(int index) const;
int columnCount() const { return static_cast<int>(m_cols.size()); }
int columnCount() const;

void sortByColumn(int index, SortOrder order = AscendingOrder, bool user = false);
void setFilter(const std::string &);
Expand Down

0 comments on commit a92743e

Please sign in to comment.