Skip to content

Commit

Permalink
FMT_USE_FCNTL can be predefined (#2573)
Browse files Browse the repository at this point in the history
'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.
  • Loading branch information
timkalu authored Oct 30, 2021
1 parent 1031eed commit 0697c5e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions include/fmt/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@

#include "format.h"

#ifndef FMT_USE_FCNTL
// UWP doesn't provide _pipe.
#if FMT_HAS_INCLUDE("winapifamily.h")
# include <winapifamily.h>
#endif
#if (FMT_HAS_INCLUDE(<fcntl.h>) || defined(__APPLE__) || \
defined(__linux__)) && \
(!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP))
# if FMT_HAS_INCLUDE("winapifamily.h")
# include <winapifamily.h>
# endif
# if (FMT_HAS_INCLUDE(<fcntl.h>) || defined(__APPLE__) || \
defined(__linux__)) && \
(!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP))
# include <fcntl.h> // for O_RDONLY
# define FMT_USE_FCNTL 1
#else
# define FMT_USE_FCNTL 0
# define FMT_USE_FCNTL 1
# else
# define FMT_USE_FCNTL 0
# endif
#endif

#ifndef FMT_POSIX
Expand Down

0 comments on commit 0697c5e

Please sign in to comment.