Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.h should accept a predefined FMT_USE_FCNTL #2570

Closed
timkalu opened this issue Oct 28, 2021 · 1 comment
Closed

os.h should accept a predefined FMT_USE_FCNTL #2570

timkalu opened this issue Oct 28, 2021 · 1 comment

Comments

@timkalu
Copy link
Contributor

timkalu commented Oct 28, 2021

os.h should accept a predefined FMT_USE_FCNTL override so using FMT with e.g. the NXP toolchain for ARM (under FreeRTOS) does not have a fnctl call.

How about this:
os.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))
#  i  nclude <fcntl.h>  // for O_RDONLY
#    define FMT_USE_FCNTL 1
#  else
#    define FMT_USE_FCNTL 0
#  endif
#endif

The detection of FMT_HAS_INCLUDE does not work correctly for this toolchain.
(see also #2277)

@vitaut
Copy link
Contributor

vitaut commented Oct 28, 2021

Sounds reasonable, a PR would be welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants