mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 19:24:48 +02:00
Opt-in macro to enforce use of compile-time format strings
This commit is contained in:
committed by
Victor Zverovich
parent
699fe8e711
commit
d561cb47a7
@@ -1258,7 +1258,13 @@ template <typename T, typename Char> struct named_arg : named_arg_base<Char> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename..., typename S, FMT_ENABLE_IF(!is_compile_string<S>::value)>
|
template <typename..., typename S, FMT_ENABLE_IF(!is_compile_string<S>::value)>
|
||||||
inline void check_format_string(const S&) {}
|
inline void check_format_string(const S&) {
|
||||||
|
#if defined(FMT_ENFORCE_COMPILE_STRING)
|
||||||
|
static_assert(is_compile_string<S>::value,
|
||||||
|
"FMT_ENFORCE_COMPILE_STRING requires all format strings to "
|
||||||
|
"utilize FMT_STRING() or fmt().");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
template <typename..., typename S, FMT_ENABLE_IF(is_compile_string<S>::value)>
|
template <typename..., typename S, FMT_ENABLE_IF(is_compile_string<S>::value)>
|
||||||
void check_format_string(S);
|
void check_format_string(S);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user