xref: /llvm-project/libcxx/include/__support/xlocale/__strtonum_fallback.h (revision c6f3b7bcd0596d30f8dabecdfb9e44f9a07b6e4c)
1 // -*- C++ -*-
2 //===-----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 // These are reimplementations of some extended locale functions ( *_l ) that
10 // aren't part of POSIX.  They are widely available though (GLIBC, BSD, maybe
11 // others).  The unifying aspect in this case is that all of these functions
12 // convert strings to some numeric type.
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
16 #define _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
17 
18 #include <__config>
19 #include <stdlib.h>
20 
21 #if _LIBCPP_HAS_WIDE_CHARACTERS
22 #  include <wchar.h>
23 #endif
24 
25 inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t) {
26   return ::strtof(__nptr, __endptr);
27 }
28 
29 inline _LIBCPP_HIDE_FROM_ABI double strtod_l(const char* __nptr, char** __endptr, locale_t) {
30   return ::strtod(__nptr, __endptr);
31 }
32 
33 inline _LIBCPP_HIDE_FROM_ABI long double strtold_l(const char* __nptr, char** __endptr, locale_t) {
34   return ::strtold(__nptr, __endptr);
35 }
36 
37 inline _LIBCPP_HIDE_FROM_ABI long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
38   return ::strtoll(__nptr, __endptr, __base);
39 }
40 
41 inline _LIBCPP_HIDE_FROM_ABI unsigned long long strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
42   return ::strtoull(__nptr, __endptr, __base);
43 }
44 
45 #endif // _LIBCPP___SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
46