sokol_gfx: warnings when compiling with mingw-w64
edubart opened this issue · comments
Eduardo Bart commented
I am getting the following warnings when compiling with x86_64-w64-mingw32-gcc (GCC) 13.1.0
:
/mnt/libs/host/sokol_gfx.h: In function ‘_sg_d3d11_apply_pipeline’:
/mnt/libs/host/sokol_gfx.h:10875:5: warning: ‘_sg_d3d11_OMSetBlendState’ reading 16 bytes from a region of size 4 [-Wstringop-overread]
10875 | _sg_d3d11_OMSetBlendState(_sg.d3d11.ctx, pip->d3d11.bs, &pip->cmn.blend_color.r, 0xFFFFFFFF);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/libs/host/sokol_gfx.h:10875:5: note: referencing argument 3 of type ‘const FLOAT[4]’ {aka ‘const float[4]’}
/mnt/libs/host/sokol_gfx.h:9258:20: note: in a call to function ‘_sg_d3d11_OMSetBlendState’
9258 | static inline void _sg_d3d11_OMSetBlendState(ID3D11DeviceContext* self, ID3D11BlendState* pBlendState, const FLOAT BlendFactor[4], UINT SampleMask) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/libs/host/sokol_gfx.h: In function ‘_sg_d3d11_begin_pass’:
/mnt/libs/host/sokol_gfx.h:10758:13: warning: ‘_sg_d3d11_ClearRenderTargetView’ reading 16 bytes from a region of size 4 [-Wstringop-overread]
10758 | _sg_d3d11_ClearRenderTargetView(_sg.d3d11.ctx, rtvs[i], &action->colors[i].clear_value.r);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/libs/host/sokol_gfx.h:10758:13: note: referencing argument 3 of type ‘const FLOAT[4]’ {aka ‘const float[4]’}
/mnt/libs/host/sokol_gfx.h:9498:20: note: in a call to function ‘_sg_d3d11_ClearRenderTargetView’
9498 | static inline void _sg_d3d11_ClearRenderTargetView(ID3D11DeviceContext* self, ID3D11RenderTargetView* pRenderTargetView, const FLOAT ColorRGBA[4]) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Not really a critical issue, but changing to (float*)&pip->cmn.blend_color
can silence this.
Andre Weissflog commented
Ah right, I've seen this GCC warning in similar code. Maybe I should setup another CI test which uses the mingw toolchain on Windows.
Do you want to provide a PR? The (float*) cast is a good fix.
Eduardo Bart commented
Do you want to provide a PR? The (float*) cast is a good fix.
Just created PR #1028 with the fix.
Andre Weissflog commented
Ok, PR has been merged :)