Add FMT_USE_FLOCKFILE macro to force has_flockfile trait to false (#4666)

Fixes fmtlib/fmt#4646
This commit is contained in:
Mike Vastola 2026-02-03 15:45:07 -05:00 committed by GitHub
parent eb99f6eba6
commit 2eda43e9be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1489,12 +1489,16 @@ template <typename F> auto getc_unlocked(F* f) -> decltype(_fgetc_nolock(f)) {
}
#endif
#ifndef FMT_USE_FLOCKFILE
# define FMT_USE_FLOCKFILE 1
#endif
template <typename F = FILE, typename Enable = void>
struct has_flockfile : std::false_type {};
template <typename F>
struct has_flockfile<F, void_t<decltype(flockfile(&std::declval<F&>()))>>
: std::true_type {};
: bool_constant<FMT_USE_FLOCKFILE != 0> {};
// A FILE wrapper. F is FILE defined as a template parameter to make system API
// detection work.