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

Fix MSVC warnings in utils\* #6795

Merged
merged 1 commit into from
Nov 8, 2023
Merged

Conversation

obligaron
Copy link
Contributor

This reduces warnings by 14 (from 297 to 283)

There are some remaining warnings in utils left.
I'm not sure how to handle them the best way:

  [446/650] Building CXX object Source\CMakeFiles\libdevilutionx.dir\utils\console.cpp.obj
devilutionX\Source\utils\console.cpp(33): warning C4267: 'argument': conversion from 'size_t' to 'DWORD', possible loss of data

  [560/650] Building CXX object Source\CMakeFiles\libdevilutionx.dir\utils\file_util.cpp.obj
devilutionX\Source\utils\file_util.cpp(236): warning C4996: 'std::filesystem::u8path': warning STL4021: The std::filesystem::u8path() overloads are deprecated in C++20. The constructors of std::filesystem::path provide equivalent functionality via construction from u8string, u8string_view, or iterators with value_type char8_t. You can define _SILENCE_CXX20_U8PATH_DEPRECATION_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.
devilutionX\Source\utils\file_util.cpp(277): warning C4996: 'std::filesystem::u8path': warning STL4021: The std::filesystem::u8path() overloads are deprecated in C++20. The constructors of std::filesystem::path provide equivalent functionality via construction from u8string, u8string_view, or iterators with value_type char8_t. You can define _SILENCE_CXX20_U8PATH_DEPRECATION_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning.

@glebm glebm merged commit 45f8647 into diasurgical:master Nov 8, 2023
19 checks passed
@glebm
Copy link
Collaborator

glebm commented Nov 8, 2023

For u8path, it is fine to #define _SILENCE_CXX20_U8PATH_DEPRECATION_WARNING (right before #include <filesystem>).
That function is deprecated but there is no sensible alternative and it might even get un-deprecated.

For the utils/console.cpp:33 warning, static_cast the offending argument to DWORD.

@obligaron obligaron deleted the uwarning branch November 8, 2023 21:42
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.

2 participants