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

suppress unused variable warnings #2381

Merged
merged 3 commits into from
Jun 30, 2021
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
8 changes: 7 additions & 1 deletion include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ struct monostate {
constexpr monostate() {}
};

// Eliminate "unused variable" warnings on all compilers. The
// `(void)var` method does not work on many intel compilers. This is
// from Herb Sutter, "Shutting up compiler warnings",
// https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/
template <class T> void ignore_unused(const T&) {}

// An enable_if helper to be used in template parameters which results in much
// shorter symbols: https://godbolt.org/z/sWw4vP. Extra parentheses are needed
// to workaround a bug in MSVC 2019 (see #1140 and #1186).
Expand Down Expand Up @@ -2731,7 +2737,7 @@ void check_format_string(S format_str) {
remove_cvref_t<Args>...>;
FMT_CONSTEXPR bool invalid_format =
(parse_format_string<true>(s, checker(s, {})), true);
(void)invalid_format;
ignore_unused(invalid_format);
}

template <typename Char>
Expand Down