Skip to content

Fix const discard warnings in fletcher32 #728

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

Merged

Conversation

jakirkham
Copy link
Member

@jakirkham jakirkham commented Apr 7, 2025

Fixes #725

When accessing a pointer from a const typed-memoryview, make sure the pointer itself is also typed as const to avoid compiler warnings about discarding const.

TODO:

  • Unit tests and/or doctests in docstrings
  • Tests pass locally
  • Docstrings and API docs for any new/modified user-facing classes and functions
  • Changes documented in docs/release.rst
  • Docs build locally
  • GitHub Actions CI passes
  • Test coverage to 100% (Codecov passes)

When accessing a pointer from a `const` typed-memoryview, make sure the
pointer itself is also typed as `const` to avoid compiler warnings about
discarding `const`.
@jakirkham jakirkham force-pushed the fix_const_discard_fletcher32 branch from bf6170c to 37d8a01 Compare April 7, 2025 21:14
@jakirkham
Copy link
Member Author

Thanks Davis! 🙏

Also can confirm the const discard warnings in fletcher32 are gone in CI:

  Compiling numcodecs/fletcher32.pyx because it changed.
  [1/1] Cythonizing numcodecs/fletcher32.pyx
  building 'numcodecs.fletcher32' extension
  /home/runner/miniconda3/envs/test/bin/x86_64-conda-linux-gnu-cc -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/runner/miniconda3/envs/test/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/runner/miniconda3/envs/test/include -fPIC -Inumcodecs -I/home/runner/miniconda3/envs/test/include/python3.12 -c numcodecs/fletcher32.c -o /tmp/tmpwx5r833u.build-temp/numcodecs/fletcher32.o
  /home/runner/miniconda3/envs/test/bin/x86_64-conda-linux-gnu-cc -shared -Wl,--allow-shlib-undefined -Wl,-rpath,/home/runner/miniconda3/envs/test/lib -Wl,-rpath-link,/home/runner/miniconda3/envs/test/lib -L/home/runner/miniconda3/envs/test/lib -Wl,--allow-shlib-undefined -Wl,-rpath,/home/runner/miniconda3/envs/test/lib -Wl,-rpath-link,/home/runner/miniconda3/envs/test/lib -L/home/runner/miniconda3/envs/test/lib -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,--allow-shlib-undefined -Wl,-rpath,/home/runner/miniconda3/envs/test/lib -Wl,-rpath-link,/home/runner/miniconda3/envs/test/lib -L/home/runner/miniconda3/envs/test/lib -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/runner/miniconda3/envs/test/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/runner/miniconda3/envs/test/include /tmp/tmpwx5r833u.build-temp/numcodecs/fletcher32.o -o /home/runner/work/numcodecs/numcodecs/numcodecs/fletcher32.cpython-312-x86_64-linux-gnu.so

@jakirkham jakirkham merged commit 96086c3 into zarr-developers:main Apr 7, 2025
30 checks passed
@jakirkham jakirkham deleted the fix_const_discard_fletcher32 branch April 7, 2025 21:33
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

Successfully merging this pull request may close these issues.

Warning: Discarding const from pointers in fletcher32
2 participants