Opt-in macro to enforce use of compile-time format strings
This commit is contained in:
parent
da2d33f1f1
commit
24874ebc2d
@ -1256,7 +1256,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);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user