xref: /freebsd/contrib/llvm-project/libcxx/src/include/config_elast.h (revision 1db9f3b21e39176dd5b67cf8ac378633b172463e)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef _LIBCPP_CONFIG_ELAST
10 #define _LIBCPP_CONFIG_ELAST
11 
12 #include <__config>
13 
14 #if defined(_LIBCPP_MSVCRT_LIKE)
15 #  include <stdlib.h>
16 #else
17 #  include <errno.h>
18 #endif
19 
20 // Note: _LIBCPP_ELAST needs to be defined only on platforms
21 // where strerror/strerror_r can't handle out-of-range errno values.
22 #if defined(ELAST)
23 #  define _LIBCPP_ELAST ELAST
24 #elif defined(_NEWLIB_VERSION)
25 #  define _LIBCPP_ELAST __ELASTERROR
26 #elif defined(__NuttX__)
27 // No _LIBCPP_ELAST needed on NuttX
28 #elif defined(__Fuchsia__)
29 // No _LIBCPP_ELAST needed on Fuchsia
30 #elif defined(__wasi__)
31 // No _LIBCPP_ELAST needed on WASI
32 #elif defined(__EMSCRIPTEN__)
33 // No _LIBCPP_ELAST needed on Emscripten
34 #elif defined(__linux__) || defined(_LIBCPP_HAS_MUSL_LIBC)
35 #  define _LIBCPP_ELAST 4095
36 #elif defined(__APPLE__)
37 // No _LIBCPP_ELAST needed on Apple
38 #elif defined(__MVS__)
39 #  define _LIBCPP_ELAST 1160
40 #elif defined(_LIBCPP_MSVCRT_LIKE)
41 #  define _LIBCPP_ELAST (_sys_nerr - 1)
42 #elif defined(_AIX)
43 #  define _LIBCPP_ELAST 127
44 #else
45 // Warn here so that the person doing the libcxx port has an easier time:
46 #  warning ELAST for this platform not yet implemented
47 #endif
48 
49 #endif // _LIBCPP_CONFIG_ELAST
50