commit 412e1fac8b033afe888192c3fdbc10425f78ba5c
parent 4462b7c5a0b13252464703ef066a4f69b3d53d35
Author: cfillion <cfillion@users.noreply.github.com>
Date: Thu, 27 Jun 2024 15:22:49 -0400
workaround for Walloc-size-larger-than in GCC 14 when LTO is enabled
Fixes #85
Diffstat:
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/listview.cpp b/src/listview.cpp
@@ -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)
diff --git a/src/listview.hpp b/src/listview.hpp
@@ -140,7 +140,7 @@ public:
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 &);