mirror of
https://github.com/fmtlib/fmt.git
synced 2024-10-06 06:50:00 +00:00
Fix Mingw support
If the ``_POSIX_`` flag is set, _fdopen will not be defined by Mingw headers, which is addressed by this commit. For what is worth, as opposed to ``fdopen``, ``_pipe`` *will* actually have the ``_`` prefix when ``_POSIX_`` is set.
This commit is contained in:
parent
1a716caf5d
commit
51bf9cfacb
@ -50,7 +50,7 @@
|
|||||||
#ifdef FMT_SYSTEM
|
#ifdef FMT_SYSTEM
|
||||||
# define FMT_POSIX_CALL(call) FMT_SYSTEM(call)
|
# define FMT_POSIX_CALL(call) FMT_SYSTEM(call)
|
||||||
#else
|
#else
|
||||||
# define FMT_SYSTEM(call) call
|
# define FMT_SYSTEM(call) ::call
|
||||||
# ifdef _WIN32
|
# ifdef _WIN32
|
||||||
// Fix warnings about deprecated symbols.
|
// Fix warnings about deprecated symbols.
|
||||||
# define FMT_POSIX_CALL(call) ::_##call
|
# define FMT_POSIX_CALL(call) ::_##call
|
||||||
|
@ -289,7 +289,11 @@ void file::pipe(file& read_end, file& write_end) {
|
|||||||
|
|
||||||
buffered_file file::fdopen(const char* mode) {
|
buffered_file file::fdopen(const char* mode) {
|
||||||
// Don't retry as fdopen doesn't return EINTR.
|
// Don't retry as fdopen doesn't return EINTR.
|
||||||
|
#if defined(__MINGW32__) && defined(_POSIX_)
|
||||||
|
FILE* f = ::fdopen(fd_, mode);
|
||||||
|
#else
|
||||||
FILE* f = FMT_POSIX_CALL(fdopen(fd_, mode));
|
FILE* f = FMT_POSIX_CALL(fdopen(fd_, mode));
|
||||||
|
#endif
|
||||||
if (!f)
|
if (!f)
|
||||||
FMT_THROW(
|
FMT_THROW(
|
||||||
system_error(errno, "cannot associate stream with file descriptor"));
|
system_error(errno, "cannot associate stream with file descriptor"));
|
||||||
|
Loading…
Reference in New Issue
Block a user