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

Warning removals in test code #2399

Merged
merged 2 commits into from
Jul 9, 2021
Merged

Warning removals in test code #2399

merged 2 commits into from
Jul 9, 2021

Conversation

mwinterb
Copy link
Contributor

Mostly 0 to nullptr and adding override to virtual function implementations.

Mostly 0 to nullptr and adding override to virtual function implementations.
@mwinterb
Copy link
Contributor Author

I hadn't tried to compile the module test, I'll see if I can fix that warning up without using FMT_MAYBE_UNUSED.

@@ -129,6 +129,7 @@ class suppress_assert {
~suppress_assert() {
_set_invalid_parameter_handler(original_handler_);
_CrtSetReportMode(_CRT_ASSERT, original_report_mode_);
(void)original_report_mode_;
Copy link
Contributor

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

template <class T> void ignore_unused(const T&) {}
to suppress warning?

Example:

fmt/include/fmt/core.h

Lines 2746 to 2748 in 785908e

FMT_CONSTEXPR bool invalid_format =
(parse_format_string<true>(s, checker(s, {})), true);
ignore_unused(invalid_format);

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes please.

Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. LGTM but please address the inline nits.

@@ -129,6 +129,7 @@ class suppress_assert {
~suppress_assert() {
_set_invalid_parameter_handler(original_handler_);
_CrtSetReportMode(_CRT_ASSERT, original_report_mode_);
(void)original_report_mode_;
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes please.

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)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be = {nullptr, 1}?

@vitaut vitaut changed the title Warning removals in test code. Warning removals in test code Jul 2, 2021
@mwinterb
Copy link
Contributor Author

mwinterb commented Jul 7, 2021

Hi, sorry. I've just been busy. Both those seem fine. One question, though: it seems unintentional that ignore_unused is in the fmt namespace instead of fmt::detail? But then so it can be used in this test, presumably actually in fmt::detail_exported?

@vitaut
Copy link
Contributor

vitaut commented Jul 7, 2021

it seems unintentional that ignore_unused is in the fmt namespace instead of fmt::detail?

Good catch, could you move it to detail while at it?

But then so it can be used in this test, presumably actually in fmt::detail_exported?

This is probably an overkill, let's keep cast to void since it's just a test.

@vitaut vitaut merged commit 3d53d15 into fmtlib:master Jul 9, 2021
@vitaut
Copy link
Contributor

vitaut commented Jul 9, 2021

I think it's good as is, merged.

@mwinterb
Copy link
Contributor Author

Thank you for merging it and taking care of the namespace fix, too.

@mwinterb mwinterb deleted the testwarnings branch July 12, 2021 19:28
PoetaKodu pushed a commit to pacc-repo/fmt that referenced this pull request Nov 11, 2021
* Warning removals in test code.

Mostly 0 to nullptr and adding override to virtual function implementations.

* Fix module-test.
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.

3 participants