mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 20:18:49 +00:00
Simplify warning suppression
This commit is contained in:
parent
12f4683883
commit
6c3d584e67
@ -247,8 +247,10 @@ template <> FMT_FUNC int count_digits<4>(internal::uintptr n) {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
int format_float(char* buf, std::size_t size, const char* format, int precision,
|
int format_float(char* buf, std::size_t size, const char* format, int precision,
|
||||||
T value) {
|
T value) {
|
||||||
return precision < 0 ? FMT_SNPRINTF(buf, size, format, value)
|
// Suppress the warning about nonliteral format string.
|
||||||
: FMT_SNPRINTF(buf, size, format, precision, value);
|
auto snprintf_ptr = FMT_SNPRINTF;
|
||||||
|
return precision < 0 ? snprintf_ptr(buf, size, format, value)
|
||||||
|
: snprintf_ptr(buf, size, format, precision, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -70,10 +70,6 @@
|
|||||||
// Disable the warning about declaration shadowing because it affects too
|
// Disable the warning about declaration shadowing because it affects too
|
||||||
// many valid cases.
|
// many valid cases.
|
||||||
# pragma GCC diagnostic ignored "-Wshadow"
|
# pragma GCC diagnostic ignored "-Wshadow"
|
||||||
|
|
||||||
// Disable the warning about nonliteral format strings because we construct
|
|
||||||
// them dynamically when falling back to snprintf for FP formatting.
|
|
||||||
# pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FMT_CLANG_VERSION
|
#if FMT_CLANG_VERSION
|
||||||
|
Loading…
Reference in New Issue
Block a user