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

Disable the MSVC C4232 warning #2449

Merged

Conversation

wantehchang
Copy link
Collaborator

The way we use the addresses of the libyuv functions in src/reformat_libyuv.c, the addresses of those functions do not need to be "static", which I think means fixed from execution to execution. As long as the addresses of those functions are fixed during an execution, that is fine for src/reformat_libyuv.c.

Fix #2447.

The way we use the addresses of the libyuv functions in
src/reformat_libyuv.c, the addresses of those functions do not need to
be "static", which I think means fixed from execution to execution. As
long as the addresses of those functions are fixed during an execution,
that is fine for src/reformat_libyuv.c.

Fix AOMediaCodec#2447.
Copy link
Collaborator Author

@wantehchang wantehchang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the MSVC warning C4232 documentation, the difficult part is what it means for the address of a function to be "static". I interpret it to mean the address of a function is fixed from execution to execution. Please see if you agree that is what "static" means in this context. Thanks!

INTERFACE /W4 # For clang-cl, /W4 enables -Wall and -Wextra
/wd4232 # Disable: address of dllimport 'dllimport' is not static,
# identity not guaranteed
/wd4324 # Disable: structure was padded due to alignment specifier
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake-format reformatted lines 296-300 here. The only real change is the addition of lines 298-299.

@wantehchang wantehchang merged commit cd49a3b into AOMediaCodec:main Sep 30, 2024
34 checks passed
@wantehchang wantehchang deleted the suppress-msvc-C4232-warning branch September 30, 2024 18:49
Copy link
Collaborator

@jzern jzern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

/wd4324 # Disable: structure was padded due to alignment specifier
avif_enable_warnings
INTERFACE /W4 # For clang-cl, /W4 enables -Wall and -Wextra
/wd4232 # Disable: address of dllimport 'dllimport' is not static,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though unlikely it sounds like this would be an error if /Za was used. Though I guess the alternative would be to manually load the functions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or have a wrapper as you suggested with the totw reference in the bug.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look at the MSVC C4232 warning documentation. The wrapper would also fix the CFI issue, so it seems like the best long-term solution.

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.

MSVC build error C2220 due to C4232
3 participants