From 0cdf005db8492266ce81baf9a30b8902baa0291b Mon Sep 17 00:00:00 2001 From: timkalu <73777326+timkalu@users.noreply.github.com> Date: Thu, 28 Oct 2021 20:23:25 +0200 Subject: [PATCH] FMT_USE_FCNTL can be predefined 'os.h' accepts a predefined FMT_USE_FCNTL override so using FMT with e.g. the NXP toolchain for ARM (e.g. for FreeRTOS) does not have a fcntl() call, but the detection routine does not detect this correctly. --- include/fmt/os.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/include/fmt/os.h b/include/fmt/os.h index 400e2c17..ec5f73ad 100644 --- a/include/fmt/os.h +++ b/include/fmt/os.h @@ -21,17 +21,20 @@ #include "format.h" +// FMT_USE_FCNTL can be predefined +#ifndef FMT_USE_FCNTL // UWP doesn't provide _pipe. -#if FMT_HAS_INCLUDE("winapifamily.h") -# include -#endif -#if (FMT_HAS_INCLUDE() || defined(__APPLE__) || \ - defined(__linux__)) && \ - (!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)) -# include // for O_RDONLY -# define FMT_USE_FCNTL 1 -#else -# define FMT_USE_FCNTL 0 +# if FMT_HAS_INCLUDE("winapifamily.h") +# include +# endif +# if (FMT_HAS_INCLUDE() || defined(__APPLE__) || \ + defined(__linux__)) && \ + (!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)) +# i nclude // for O_RDONLY +# define FMT_USE_FCNTL 1 +# else +# define FMT_USE_FCNTL 0 +# endif #endif #ifndef FMT_POSIX