Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'function': different 'const' qualifiers when compiling on Visual Studio 2019 / MSVC 14 #3515

Closed
indygreg opened this issue Feb 19, 2023 · 1 comment

Comments

@indygreg
Copy link
Contributor

Attempting to upgrade python-zstandard from 1.5.2 to 1.5.4. My Windows CI environment is still using GitHub's Windows 2019 runners with Visual Studio 2019 / MSVC 14.

Using the single file library with zstd.h + legacy support. I get the following error:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Ic-ext -Izstd -IC:\hostedtoolcache\windows\Python\3.11.2\x64\include -IC:\hostedtoolcache\windows\Python\3.11.2\x64\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt" /Tcc-ext\backend_c.c /Fobuild\temp.win-amd64-cpython-311\Release\c-ext\backend_c.obj -DZSTD_SINGLE_FILE -DZSTDLIB_VISIBLE= -DZDICTLIB_VISIBLE= -DZSTDERRORLIB_VISIBLE= /WX
backend_c.c
zstd\zstd.c(36246): error C2220: the following warning is treated as an error
zstd\zstd.c(36246): warning C4090: 'function': different 'const' qualifiers
zstd\zstd.c(36329): warning C4090: 'function': different 'const' qualifiers
zstd\zstd.c(37026): warning C4090: 'function': different 'const' qualifiers
zstd\zstd.c(37149): warning C4090: 'function': different 'const' qualifiers
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

See also https://github.com/indygreg/python-zstandard/actions/runs/4214186727/jobs/7314474490.

Here are direct links to the failing lines:

AFAICT all of these are the common pattern:

typedef struct {
    BYTE const* ip[4];
    ...
} HUF_DecompressFastArgs;

BYTE const* ip[4];
...
ZSTD_memcpy(&ip, &args->ip, sizeof(ip));
indygreg added a commit to indygreg/python-zstandard that referenced this issue Feb 19, 2023
Visual Studio 2019 isn't liking the const disagreement for the
destination argument. We have warnings as errors enabled and this
leads to build failures. Adding an inline cast to remove the `const`
seems to make things happy.

I reported this upstream at
facebook/zstd#3515.
@embg
Copy link
Contributor

embg commented Feb 20, 2023

Thanks for the report! This was fixed in #3495, which will be included in the next zstd release (1.5.5). That PR also fixes a couple Visual Studio 2022 warnings -- just want to make you aware in case you upgrade and run into them.

@embg embg closed this as completed Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants