Build warnings on Windows
[21/140] Building CXX object lib/CMakeFiles/elements.dir/src/element/status_bar.cpp.obj
C:/_Projects/C++/Elements/lib/src/element/status_bar.cpp: In constructor 'cycfi::elements::busy_bar_base::busy_bar_base(double, double)':
C:/_Projects/C++/Elements/lib/src/element/status_bar.cpp:98:23: warning: operation on '((cycfi::elements::busy_bar_base*)this)->cycfi::elements::busy_bar_base::_status' may be undefined [-Wsequence-point]
98 | , _status{_status = -1 * _animation_width}
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
[51/140] Building CXX object lib/CMakeFiles/elements.dir/host/windows/base_view.cpp.obj
C:/_Projects/C++/Elements/lib/host/windows/base_view.cpp: In function 'void cycfi::elements::{anonymous}::on_scroll(HWND, view_info*, LPARAM, cycfi::elements::point)':
C:/_Projects/C++/Elements/lib/host/windows/base_view.cpp:340:34: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
340 | (info->_scroll_dir.x > 0 != dir.x > 0) ||
| ~~~~~~~~~~~~~~~~~~~~^~~
C:/_Projects/C++/Elements/lib/host/windows/base_view.cpp:341:34: warning: suggest parentheses around comparison in operand of '!=' [-Wparentheses]
341 | (info->_scroll_dir.y > 0 != dir.y > 0)
| ~~~~~~~~~~~~~~~~~~~~^~~
C:/_Projects/C++/Elements/lib/host/windows/base_view.cpp: In function 'HWND__* cycfi::elements::{anonymous}::make_window(cycfi::elements::base_view*, cycfi::elements::host_window_handle, RECT)':
C:/_Projects/C++/Elements/lib/host/windows/base_view.cpp:534:47: warning: missing initializer for member 'cycfi::elements::{anonymous}::view_info::_scroll_dir' [-Wmissing-field-initializers]
534 | view_info* info = new view_info{_this};
| ^
[53/140] Building CXX object lib/CMakeFiles/elements.dir/host/windows/drag_and_drop.cpp.obj
C:/_Projects/C++/Elements/lib/host/windows/drag_and_drop.cpp: In member function 'virtual ULONG DropTarget::Release()':
C:/_Projects/C++/Elements/lib/host/windows/drag_and_drop.cpp:55:7: warning: deleting object of polymorphic class type 'DropTarget' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
55 | delete this;
| ^~~~~~~~~~~
These are all safe to ignore. But if you care, feel free to prepare a PR with warning suppression :
#pragma warning(push) #pragma warning(disable : XXXX) // Replace XXXX with MSVC warning number
// Code that triggers warning
#pragma warning(pop)
making sure other compilers are not affected.
Are you sure about using suppressions? I'm compiling this using GCC with MinGW not MSVC. Using the instruction from https://cycfi.github.io/elements/elements/skia_2024/setup.html#_install_cmake_3 although selecting gtk3 fails on Windows as it's for Linux. I got cmake to output Ninja files for the build.
Are you sure about using suppressions?
Yes. Compilers tend to be too patronizing at times. This falls under the category of we know what we're doing :-)
Love to hear your thoughts if you disagree.
I'm compiling this using GCC with MinGW not MSVC.
Using the instruction from https://cycfi.github.io/elements/elements/skia_2024/setup.html#_install_cmake_3 although selecting gtk3 fails on Windows as it's for Linux. I got cmake to output Ninja files for the build.
Oh, OK. GCC then. If you are an expert on MinGW+WIN32, this is an area that I do not have much support for, Contributions welcome.
Are you sure about using suppressions?
Yes. Compilers tend to be too patronizing at times. This falls under the category of we know what we're doing :-)
Love to hear your thoughts if you disagree.
Oh, I'm OK with parens if that's what you mean.
warning: missing initializer for member 'cycfi::elements::{anonymous}::view_info::_scroll_dir' [-Wmissing-field-initializers] 534 | view_info* info = new view_info{_this};
Ah this better needs to be fixed. Sorry for the noise haha :-)
No problem, happy to help. I'll submit a PR with some fixes once I've tested (cough played around) some more!