floooh / sokol

minimal cross-platform standalone C headers

Home Page:https://floooh.github.io/sokol-html5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sokol_gfx: warnings when compiling with mingw-w64

edubart opened this issue · comments

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_OMSetBlendStatereading 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 typeconst FLOAT[4]’ {akaconst float[4]’}
/mnt/libs/host/sokol_gfx.h:9258:20: note: in a call to function_sg_d3d11_OMSetBlendState9258 | 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_ClearRenderTargetViewreading 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 typeconst FLOAT[4]’ {akaconst float[4]’}
/mnt/libs/host/sokol_gfx.h:9498:20: note: in a call to function_sg_d3d11_ClearRenderTargetView9498 | 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.

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.

Do you want to provide a PR? The (float*) cast is a good fix.

Just created PR #1028 with the fix.

Ok, PR has been merged :)