8000 Fix MSVC cast warnings by QuLogic · Pull Request #28967 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix MSVC cast warnings #28967

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
merged 4 commits into from
Oct 25, 2024
Merged

Fix MSVC cast warnings #28967

merged 4 commits into from
Oct 25, 2024

Conversation

QuLogic
Copy link
Member
@QuLogic QuLogic commented Oct 11, 2024

PR summary

MSVC on the Azure/AppVeyor builds currently produce a few warnings. These are due to some lax input types, or otherwise because of differing type sizes on Windows. The values are generally not in the range where it would matter, so we can make the casts explicit to silence the warnings.

For the incorrect types, the old types are deprecated, but still accepted.

This is based on #28842 at the moment due to conflicting changes, but the last four commits are the relevant ones here.

PR checklist

@QuLogic
Copy link
Member Author
QuLogic commented Oct 11, 2024

I see one more on AppVeyor to fix:

  [80/97] Compiling C++ object src/ft2font.cp311-win_amd64.pyd.p/ft2font_wrapper.cpp.obj
  ../../src/ft2font_wrapper.cpp(964): warning C4244: 'argument': conversion from 'double' to 'int', possible loss of data
  ../../src/ft2font_wrapper.cpp(964): warning C4244: 'argument': conversion from 'double' to 'int', possible loss of data

These were silently truncated to int anyway, so we should make the types
explicit.
The Agg API uses `double`s here, but the array sizes are
`pybind11::ssize_t`, which are technically bigger (in some ways), and
cause a warning on MSVC. We don't accept a backing surface larger than
~2^24, so there's no worry about these overflowing.
These were silently truncated to int anyway, so we should make the types
explicit.
@QuLogic QuLogic removed backend: pdf Documentation: examples files in galleries/examples labels Oct 24, 2024
@QuLogic
Copy link
Member Author
QuLogic commented Oct 24, 2024

AppVeyor and Azure Windows builds are now warning free.

@QuLogic QuLogic marked this pull request as ready for review October 24, 2024 22:54
@QuLogic QuLogic added this to the v3.10.0 milestone Oct 24, 2024
@ianthomas23 ianthomas23 merged commit 3770dfe into matplotlib:main Oct 25, 2024
65 of 66 checks passed
@QuLogic QuLogic deleted the msvc-casts branch October 25, 2024 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0