-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Warning removals in test code #2399
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,9 +41,9 @@ TEST(util_test, utf16_to_utf8_empty_string) { | |
} | ||
|
||
template <typename Converter, typename Char> | ||
void check_utf_conversion_error( | ||
const char* message, | ||
fmt::basic_string_view<Char> str = fmt::basic_string_view<Char>(0, 1)) { | ||
void check_utf_conversion_error(const char* message, | ||
fmt::basic_string_view<Char> str = | ||
fmt::basic_string_view<Char>(nullptr, 1)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be |
||
fmt::memory_buffer out; | ||
fmt::detail::format_windows_error(out, ERROR_INVALID_PARAMETER, message); | ||
auto error = std::system_error(std::error_code()); | ||
|
@@ -63,7 +63,7 @@ TEST(util_test, utf16_to_utf8_error) { | |
|
||
TEST(util_test, utf16_to_utf8_convert) { | ||
fmt::detail::utf16_to_utf8 u; | ||
EXPECT_EQ(ERROR_INVALID_PARAMETER, u.convert(wstring_view(0, 1))); | ||
EXPECT_EQ(ERROR_INVALID_PARAMETER, u.convert(wstring_view(nullptr, 1))); | ||
EXPECT_EQ(ERROR_INVALID_PARAMETER, | ||
u.convert(wstring_view(L"foo", INT_MAX + 1u))); | ||
} | ||
|
@@ -81,12 +81,12 @@ TEST(os_test, format_std_error_code) { | |
} | ||
|
||
TEST(os_test, format_windows_error) { | ||
LPWSTR message = 0; | ||
LPWSTR message = nullptr; | ||
auto result = FormatMessageW( | ||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | | ||
FORMAT_MESSAGE_IGNORE_INSERTS, | ||
0, ERROR_FILE_EXISTS, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | ||
reinterpret_cast<LPWSTR>(&message), 0, 0); | ||
nullptr, ERROR_FILE_EXISTS, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | ||
reinterpret_cast<LPWSTR>(&message), 0, nullptr); | ||
fmt::detail::utf16_to_utf8 utf8_message(wstring_view(message, result - 2)); | ||
LocalFree(message); | ||
fmt::memory_buffer actual_message; | ||
|
@@ -97,17 +97,17 @@ TEST(os_test, format_windows_error) { | |
} | ||
|
||
TEST(os_test, format_long_windows_error) { | ||
LPWSTR message = 0; | ||
LPWSTR message = nullptr; | ||
// this error code is not available on all Windows platforms and | ||
// Windows SDKs, so do not fail the test if the error string cannot | ||
// be retrieved. | ||
int provisioning_not_allowed = 0x80284013L; // TBS_E_PROVISIONING_NOT_ALLOWED | ||
auto result = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | | ||
FORMAT_MESSAGE_FROM_SYSTEM | | ||
FORMAT_MESSAGE_IGNORE_INSERTS, | ||
0, static_cast<DWORD>(provisioning_not_allowed), | ||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | ||
reinterpret_cast<LPWSTR>(&message), 0, 0); | ||
auto result = FormatMessageW( | ||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | | ||
FORMAT_MESSAGE_IGNORE_INSERTS, | ||
nullptr, static_cast<DWORD>(provisioning_not_allowed), | ||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | ||
reinterpret_cast<LPWSTR>(&message), 0, nullptr); | ||
if (result == 0) { | ||
LocalFree(message); | ||
return; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use function
ignore_unused
fmt/include/fmt/core.h
Line 340 in 785908e
Example:
fmt/include/fmt/core.h
Lines 2746 to 2748 in 785908e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please.