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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,11 @@ add_library(avif_enable_warnings INTERFACE)
if(MSVC)
message(STATUS "libavif: Enabling warnings for MSVC")
target_compile_options(
avif_enable_warnings INTERFACE /W4 # For clang-cl, /W4 enables -Wall and -Wextra
/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.

# 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.

)
# Disable deprecation warnings about POSIX function names such as setmode (replaced by the ISO C and C++ conformant name _setmode).
# Disable deprecation warnings about unsafe CRT library functions such as fopen (replaced by fopen_s).
Expand Down
Loading