diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 18:01:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 18:01:01 +0000 |
commit | b7332b04df5d50c92640c74cfeb138ecb7e3f7ae (patch) | |
tree | b1b49faa0cab1482905e0cda6f0ee5d97e3fe08f /include | |
parent | 6012fe9abb1f01b1b5b4ca908464804c21ff8602 (diff) |
Notes
Diffstat (limited to 'include')
-rw-r--r-- | include/CMakeLists.txt | 273 | ||||
-rw-r--r-- | include/__config_site.in | 35 | ||||
-rw-r--r-- | include/support/android/locale_bionic.h | 68 | ||||
-rw-r--r-- | include/support/fuchsia/xlocale.h | 23 | ||||
-rw-r--r-- | include/support/ibm/limits.h | 99 | ||||
-rw-r--r-- | include/support/ibm/locale_mgmt_aix.h | 85 | ||||
-rw-r--r-- | include/support/ibm/support.h | 54 | ||||
-rw-r--r-- | include/support/ibm/xlocale.h | 271 | ||||
-rw-r--r-- | include/support/musl/xlocale.h | 58 | ||||
-rw-r--r-- | include/support/newlib/xlocale.h | 28 | ||||
-rw-r--r-- | include/support/solaris/floatingpoint.h | 14 | ||||
-rw-r--r-- | include/support/solaris/wchar.h | 47 | ||||
-rw-r--r-- | include/support/solaris/xlocale.h | 77 | ||||
-rw-r--r-- | include/support/win32/limits_msvc_win32.h | 72 | ||||
-rw-r--r-- | include/support/win32/locale_win32.h | 199 | ||||
-rw-r--r-- | include/support/xlocale/__nop_locale_mgmt.h | 52 | ||||
-rw-r--r-- | include/support/xlocale/__posix_l_fallback.h | 165 | ||||
-rw-r--r-- | include/support/xlocale/__strtonum_fallback.h | 67 | ||||
-rw-r--r-- | include/support/xlocale/xlocale.h | 0 |
19 files changed, 0 insertions, 1687 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt deleted file mode 100644 index 73f7cfc4d8e38..0000000000000 --- a/include/CMakeLists.txt +++ /dev/null @@ -1,273 +0,0 @@ -set(files - __bit_reference - __bsd_locale_defaults.h - __bsd_locale_fallbacks.h - __errc - __debug - __functional_03 - __functional_base - __functional_base_03 - __hash_table - __libcpp_version - __locale - __mutex_base - __node_handle - __nullptr - __split_buffer - __sso_allocator - __std_stream - __string - __threading_support - __tree - __tuple - __undef_macros - algorithm - any - array - atomic - bit - bitset - cassert - ccomplex - cctype - cerrno - cfenv - cfloat - charconv - chrono - cinttypes - ciso646 - climits - clocale - cmath - codecvt - compare - complex - complex.h - condition_variable - csetjmp - csignal - cstdarg - cstdbool - cstddef - cstdint - cstdio - cstdlib - cstring - ctgmath - ctime - ctype.h - cwchar - cwctype - deque - errno.h - exception - experimental/__config - experimental/__memory - experimental/algorithm - experimental/any - experimental/chrono - experimental/coroutine - experimental/deque - experimental/filesystem - experimental/forward_list - experimental/functional - experimental/iterator - experimental/list - experimental/map - experimental/memory_resource - experimental/numeric - experimental/optional - experimental/propagate_const - experimental/ratio - experimental/regex - experimental/set - experimental/simd - experimental/string - experimental/string_view - experimental/system_error - experimental/tuple - experimental/type_traits - experimental/unordered_map - experimental/unordered_set - experimental/utility - experimental/vector - ext/__hash - ext/hash_map - ext/hash_set - filesystem - float.h - forward_list - fstream - functional - future - initializer_list - inttypes.h - iomanip - ios - iosfwd - iostream - istream - iterator - limits - limits.h - list - locale - locale.h - map - math.h - memory - module.modulemap - mutex - new - numeric - optional - ostream - queue - random - ratio - regex - scoped_allocator - set - setjmp.h - shared_mutex - span - sstream - stack - stdbool.h - stddef.h - stdexcept - stdint.h - stdio.h - stdlib.h - streambuf - string - string.h - string_view - strstream - system_error - tgmath.h - thread - tuple - type_traits - typeindex - typeinfo - unordered_map - unordered_set - utility - valarray - variant - vector - version - wchar.h - wctype.h - ) - -if(LIBCXX_INSTALL_SUPPORT_HEADERS) - set(files - ${files} - support/android/locale_bionic.h - support/fuchsia/xlocale.h - support/ibm/limits.h - support/ibm/locale_mgmt_aix.h - support/ibm/support.h - support/ibm/xlocale.h - support/musl/xlocale.h - support/newlib/xlocale.h - support/solaris/floatingpoint.h - support/solaris/wchar.h - support/solaris/xlocale.h - support/win32/limits_msvc_win32.h - support/win32/locale_win32.h - support/xlocale/__nop_locale_mgmt.h - support/xlocale/__posix_l_fallback.h - support/xlocale/__strtonum_fallback.h - support/xlocale/xlocale.h - ) -endif() - -if (LIBCXX_NEEDS_SITE_CONFIG) - # Generate a custom __config header. The new header is created - # by prepending __config_site to the current __config header. - add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config - COMMAND ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/cat_files.py - ${LIBCXX_BINARY_DIR}/__config_site - ${LIBCXX_SOURCE_DIR}/include/__config - -o ${LIBCXX_BINARY_DIR}/__generated_config - DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config - ${LIBCXX_BINARY_DIR}/__config_site - ) - # Add a target that executes the generation commands. - add_custom_target(cxx-generated-config ALL - DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config) - set(generated_config_deps cxx-generated-config) -else() - set(files - ${files} - __config - ) -endif() - -if(NOT LIBCXX_USING_INSTALLED_LLVM AND LIBCXX_HEADER_DIR) - set(output_dir ${LIBCXX_HEADER_DIR}/include/c++/v1) - - set(out_files) - foreach(f ${files}) - set(src ${CMAKE_CURRENT_SOURCE_DIR}/${f}) - set(dst ${output_dir}/${f}) - add_custom_command(OUTPUT ${dst} - DEPENDS ${src} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} - COMMENT "Copying CXX header ${f}") - list(APPEND out_files ${dst}) - endforeach() - - if (LIBCXX_NEEDS_SITE_CONFIG) - # Copy the generated header as __config into build directory. - set(src ${LIBCXX_BINARY_DIR}/__generated_config) - set(dst ${output_dir}/__config) - add_custom_command(OUTPUT ${dst} - DEPENDS ${src} ${generated_config_deps} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} - COMMENT "Copying CXX __config") - list(APPEND out_files ${dst}) - endif() - - add_custom_target(cxx-headers ALL DEPENDS ${out_files} ${LIBCXX_CXX_ABI_HEADER_TARGET}) -else() - add_custom_target(cxx-headers) -endif() -set_target_properties(cxx-headers PROPERTIES FOLDER "Misc") - -if (LIBCXX_INSTALL_HEADERS) - foreach(file ${files}) - get_filename_component(dir ${file} DIRECTORY) - install(FILES ${file} - DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1/${dir} - COMPONENT cxx-headers - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - ) - endforeach() - - if (LIBCXX_NEEDS_SITE_CONFIG) - # Install the generated header as __config. - install(FILES ${LIBCXX_BINARY_DIR}/__generated_config - DESTINATION ${LIBCXX_INSTALL_HEADER_PREFIX}include/c++/v1 - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - RENAME __config - COMPONENT cxx-headers) - endif() - - if (NOT CMAKE_CONFIGURATION_TYPES) - add_custom_target(install-cxx-headers - DEPENDS cxx-headers ${generated_config_deps} - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx-headers - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") - # Stripping is a no-op for headers - add_custom_target(install-cxx-headers-stripped DEPENDS install-cxx-headers) - - add_custom_target(install-libcxx-headers DEPENDS install-cxx-headers) - add_custom_target(install-libcxx-headers-stripped DEPENDS install-cxx-headers-stripped) - endif() -endif() diff --git a/include/__config_site.in b/include/__config_site.in deleted file mode 100644 index 580a6aa4c07bb..0000000000000 --- a/include/__config_site.in +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_CONFIG_SITE -#define _LIBCPP_CONFIG_SITE - -#cmakedefine _LIBCPP_ABI_VERSION @_LIBCPP_ABI_VERSION@ -#cmakedefine _LIBCPP_ABI_UNSTABLE -#cmakedefine _LIBCPP_ABI_FORCE_ITANIUM -#cmakedefine _LIBCPP_ABI_FORCE_MICROSOFT -#cmakedefine _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT -#cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE -#cmakedefine _LIBCPP_HAS_NO_STDIN -#cmakedefine _LIBCPP_HAS_NO_STDOUT -#cmakedefine _LIBCPP_HAS_NO_THREADS -#cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK -#cmakedefine _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS -#cmakedefine _LIBCPP_HAS_MUSL_LIBC -#cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD -#cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL -#cmakedefine _LIBCPP_HAS_THREAD_API_WIN32 -#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL -#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -#cmakedefine _LIBCPP_NO_VCRUNTIME -#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@ - -@_LIBCPP_ABI_DEFINES@ - -#endif // _LIBCPP_CONFIG_SITE diff --git a/include/support/android/locale_bionic.h b/include/support/android/locale_bionic.h deleted file mode 100644 index 50fcf5c36a774..0000000000000 --- a/include/support/android/locale_bionic.h +++ /dev/null @@ -1,68 +0,0 @@ -// -*- C++ -*- -//===------------------- support/android/locale_bionic.h ------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H -#define _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H - -#if defined(__BIONIC__) - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdlib.h> -#include <xlocale.h> - -#ifdef __cplusplus -} -#endif - -#if defined(__ANDROID__) - -#include <android/api-level.h> -#include <android/ndk-version.h> -#include <support/xlocale/__posix_l_fallback.h> -// In NDK versions later than 16, locale-aware functions are provided by -// legacy_stdlib_inlines.h -#if __NDK_MAJOR__ <= 16 -#if __ANDROID_API__ < 21 -#include <support/xlocale/__strtonum_fallback.h> -#elif __ANDROID_API__ < 26 - -#if defined(__cplusplus) -extern "C" { -#endif - -inline _LIBCPP_INLINE_VISIBILITY float strtof_l(const char* __nptr, char** __endptr, - locale_t) { - return ::strtof(__nptr, __endptr); -} - -inline _LIBCPP_INLINE_VISIBILITY double strtod_l(const char* __nptr, - char** __endptr, locale_t) { - return ::strtod(__nptr, __endptr); -} - -inline _LIBCPP_INLINE_VISIBILITY long strtol_l(const char* __nptr, char** __endptr, - int __base, locale_t) { - return ::strtol(__nptr, __endptr, __base); -} - -#if defined(__cplusplus) -} -#endif - -#endif // __ANDROID_API__ < 26 - -#endif // __NDK_MAJOR__ <= 16 -#endif // defined(__ANDROID__) - -#endif // defined(__BIONIC__) -#endif // _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H diff --git a/include/support/fuchsia/xlocale.h b/include/support/fuchsia/xlocale.h deleted file mode 100644 index 1de2fca28e226..0000000000000 --- a/include/support/fuchsia/xlocale.h +++ /dev/null @@ -1,23 +0,0 @@ -// -*- C++ -*- -//===------------------- support/fuchsia/xlocale.h ------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H -#define _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H - -#if defined(__Fuchsia__) - -#include <cstdlib> -#include <cwchar> -#include <support/xlocale/__posix_l_fallback.h> -#include <support/xlocale/__strtonum_fallback.h> - -#endif // defined(__Fuchsia__) - -#endif // _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H diff --git a/include/support/ibm/limits.h b/include/support/ibm/limits.h deleted file mode 100644 index efdb359659653..0000000000000 --- a/include/support/ibm/limits.h +++ /dev/null @@ -1,99 +0,0 @@ -// -*- C++ -*- -//===--------------------- support/ibm/limits.h ---------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_IBM_LIMITS_H -#define _LIBCPP_SUPPORT_IBM_LIMITS_H - -#if !defined(_AIX) // Linux -#include <math.h> // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN - -static const unsigned int _QNAN_F = 0x7fc00000; -#define NANF (*((float *)(&_QNAN_F))) -static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0}; -#define NANL (*((long double *)(&_QNAN_LDBL128))) -static const unsigned int _SNAN_F= 0x7f855555; -#define NANSF (*((float *)(&_SNAN_F))) -static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555}; -#define NANS (*((double *)(&_SNAN_D))) -static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0}; -#define NANSL (*((long double *)(&_SNAN_LDBL128))) - -#define __builtin_huge_val() HUGE_VAL -#define __builtin_huge_valf() HUGE_VALF -#define __builtin_huge_vall() HUGE_VALL -#define __builtin_nan(__dummy) NAN -#define __builtin_nanf(__dummy) NANF -#define __builtin_nanl(__dummy) NANL -#define __builtin_nans(__dummy) NANS -#define __builtin_nansf(__dummy) NANSF -#define __builtin_nansl(__dummy) NANSL - -#else - -#include <math.h> -#include <float.h> // limit constants - -#define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000 -#define __builtin_huge_valf() HUGE_VALF //0x7f800000 -#define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000 -#define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000 -#define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000 -#define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000 -#define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555 -#define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555 -#define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555 - -#define __FLT_MANT_DIG__ FLT_MANT_DIG -#define __FLT_DIG__ FLT_DIG -#define __FLT_RADIX__ FLT_RADIX -#define __FLT_MIN_EXP__ FLT_MIN_EXP -#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP -#define __FLT_MAX_EXP__ FLT_MAX_EXP -#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP -#define __FLT_MIN__ FLT_MIN -#define __FLT_MAX__ FLT_MAX -#define __FLT_EPSILON__ FLT_EPSILON -// predefined by XLC on LoP -#define __FLT_DENORM_MIN__ 1.40129846e-45F - -#define __DBL_MANT_DIG__ DBL_MANT_DIG -#define __DBL_DIG__ DBL_DIG -#define __DBL_MIN_EXP__ DBL_MIN_EXP -#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP -#define __DBL_MAX_EXP__ DBL_MAX_EXP -#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP -#define __DBL_MIN__ DBL_MIN -#define __DBL_MAX__ DBL_MAX -#define __DBL_EPSILON__ DBL_EPSILON -// predefined by XLC on LoP -#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 - -#define __LDBL_MANT_DIG__ LDBL_MANT_DIG -#define __LDBL_DIG__ LDBL_DIG -#define __LDBL_MIN_EXP__ LDBL_MIN_EXP -#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP -#define __LDBL_MAX_EXP__ LDBL_MAX_EXP -#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP -#define __LDBL_MIN__ LDBL_MIN -#define __LDBL_MAX__ LDBL_MAX -#define __LDBL_EPSILON__ LDBL_EPSILON -// predefined by XLC on LoP -#if __LONGDOUBLE128 -#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L -#else -#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L -#endif - -// predefined by XLC on LoP -#define __CHAR_BIT__ 8 - -#endif // _AIX - -#endif // _LIBCPP_SUPPORT_IBM_LIMITS_H diff --git a/include/support/ibm/locale_mgmt_aix.h b/include/support/ibm/locale_mgmt_aix.h deleted file mode 100644 index e3b7a78c45a0f..0000000000000 --- a/include/support/ibm/locale_mgmt_aix.h +++ /dev/null @@ -1,85 +0,0 @@ -// -*- C++ -*- -//===------------------- support/ibm/locale_mgmt_aix.h --------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H -#define _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H - -#if defined(_AIX) -#include "cstdlib" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_AIX71) -// AIX 7.1 and higher has these definitions. Definitions and stubs -// are provied here as a temporary workaround on AIX 6.1. - -#define LC_COLLATE_MASK 1 -#define LC_CTYPE_MASK 2 -#define LC_MESSAGES_MASK 4 -#define LC_MONETARY_MASK 8 -#define LC_NUMERIC_MASK 16 -#define LC_TIME_MASK 32 -#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | \ - LC_MESSAGES_MASK | LC_MONETARY_MASK |\ - LC_NUMERIC_MASK | LC_TIME_MASK) - -typedef void* locale_t; - -// The following are stubs. They are not supported on AIX 6.1. -static inline -locale_t newlocale(int category_mask, const char *locale, locale_t base) -{ - _LC_locale_t *newloc, *loc; - if ((loc = (_LC_locale_t *)__xopen_locale(locale)) == NULL) - { - errno = EINVAL; - return (locale_t)0; - } - if ((newloc = (_LC_locale_t *)calloc(1, sizeof(_LC_locale_t))) == NULL) - { - errno = ENOMEM; - return (locale_t)0; - } - if (!base) - base = (_LC_locale_t *)__xopen_locale("C"); - memcpy(newloc, base, sizeof (_LC_locale_t)); - if (category_mask & LC_COLLATE_MASK) - newloc->lc_collate = loc->lc_collate; - if (category_mask & LC_CTYPE_MASK) - newloc->lc_ctype = loc->lc_ctype; - //if (category_mask & LC_MESSAGES_MASK) - // newloc->lc_messages = loc->lc_messages; - if (category_mask & LC_MONETARY_MASK) - newloc->lc_monetary = loc->lc_monetary; - if (category_mask & LC_TIME_MASK) - newloc->lc_time = loc->lc_time; - if (category_mask & LC_NUMERIC_MASK) - newloc->lc_numeric = loc->lc_numeric; - return (locale_t)newloc; -} -static inline -void freelocale(locale_t locobj) -{ - free(locobj); -} -static inline -locale_t uselocale(locale_t newloc) -{ - return (locale_t)0; -} -#endif // !defined(_AIX71) - -#ifdef __cplusplus -} -#endif -#endif // defined(_AIX) -#endif // _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H diff --git a/include/support/ibm/support.h b/include/support/ibm/support.h deleted file mode 100644 index 0abfa7f95a65a..0000000000000 --- a/include/support/ibm/support.h +++ /dev/null @@ -1,54 +0,0 @@ -// -*- C++ -*- -//===----------------------- support/ibm/support.h ----------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_IBM_SUPPORT_H -#define _LIBCPP_SUPPORT_IBM_SUPPORT_H - -extern "builtin" int __popcnt4(unsigned int); -extern "builtin" int __popcnt8(unsigned long long); -extern "builtin" unsigned int __cnttz4(unsigned int); -extern "builtin" unsigned int __cnttz8(unsigned long long); -extern "builtin" unsigned int __cntlz4(unsigned int); -extern "builtin" unsigned int __cntlz8(unsigned long long); - -// Builtin functions for counting population -#define __builtin_popcount(x) __popcnt4(x) -#define __builtin_popcountll(x) __popcnt8(x) -#if defined(__64BIT__) -#define __builtin_popcountl(x) __builtin_popcountll(x) -#else -#define __builtin_popcountl(x) __builtin_popcount(x) -#endif - -// Builtin functions for counting trailing zeros -#define __builtin_ctz(x) __cnttz4(x) -#define __builtin_ctzll(x) __cnttz8(x) -#if defined(__64BIT__) -#define __builtin_ctzl(x) __builtin_ctzll(x) -#else -#define __builtin_ctzl(x) __builtin_ctz(x) -#endif - -// Builtin functions for counting leading zeros -#define __builtin_clz(x) __cntlz4(x) -#define __builtin_clzll(x) __cntlz8(x) -#if defined(__64BIT__) -#define __builtin_clzl(x) __builtin_clzll(x) -#else -#define __builtin_clzl(x) __builtin_clz(x) -#endif - -#if defined(__64BIT__) -#define __SIZE_WIDTH__ 64 -#else -#define __SIZE_WIDTH__ 32 -#endif - -#endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H diff --git a/include/support/ibm/xlocale.h b/include/support/ibm/xlocale.h deleted file mode 100644 index f39c0ba95d901..0000000000000 --- a/include/support/ibm/xlocale.h +++ /dev/null @@ -1,271 +0,0 @@ -// -*- C++ -*- -//===--------------------- support/ibm/xlocale.h -------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_IBM_XLOCALE_H -#define _LIBCPP_SUPPORT_IBM_XLOCALE_H -#include <support/ibm/locale_mgmt_aix.h> - -#if defined(_AIX) -#include "cstdlib" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_AIX71) -// AIX 7.1 and higher has these definitions. Definitions and stubs -// are provied here as a temporary workaround on AIX 6.1. -static inline -int isalnum_l(int c, locale_t locale) -{ - return __xisalnum(locale, c); -} -static inline -int isalpha_l(int c, locale_t locale) -{ - return __xisalpha(locale, c); -} -static inline -int isblank_l(int c, locale_t locale) -{ - return __xisblank(locale, c); -} -static inline -int iscntrl_l(int c, locale_t locale) -{ - return __xiscntrl(locale, c); -} -static inline -int isdigit_l(int c, locale_t locale) -{ - return __xisdigit(locale, c); -} -static inline -int isgraph_l(int c, locale_t locale) -{ - return __xisgraph(locale, c); -} -static inline -int islower_l(int c, locale_t locale) -{ - return __xislower(locale, c); -} -static inline -int isprint_l(int c, locale_t locale) -{ - return __xisprint(locale, c); -} - -static inline -int ispunct_l(int c, locale_t locale) -{ - return __xispunct(locale, c); -} -static inline -int isspace_l(int c, locale_t locale) -{ - return __xisspace(locale, c); -} -static inline -int isupper_l(int c, locale_t locale) -{ - return __xisupper(locale, c); -} - -static inline -int isxdigit_l(int c, locale_t locale) -{ - return __xisxdigit(locale, c); -} - -static inline -int iswalnum_l(wchar_t wc, locale_t locale) -{ - return __xiswalnum(locale, wc); -} - -static inline -int iswalpha_l(wchar_t wc, locale_t locale) -{ - return __xiswalpha(locale, wc); -} - -static inline -int iswblank_l(wchar_t wc, locale_t locale) -{ - return __xiswblank(locale, wc); -} - -static inline -int iswcntrl_l(wchar_t wc, locale_t locale) -{ - return __xiswcntrl(locale, wc); -} - -static inline -int iswdigit_l(wchar_t wc, locale_t locale) -{ - return __xiswdigit(locale, wc); -} - -static inline -int iswgraph_l(wchar_t wc, locale_t locale) -{ - return __xiswgraph(locale, wc); -} - -static inline -int iswlower_l(wchar_t wc, locale_t locale) -{ - return __xiswlower(locale, wc); -} - -static inline -int iswprint_l(wchar_t wc, locale_t locale) -{ - return __xiswprint(locale, wc); -} - -static inline -int iswpunct_l(wchar_t wc, locale_t locale) -{ - return __xiswpunct(locale, wc); -} - -static inline -int iswspace_l(wchar_t wc, locale_t locale) -{ - return __xiswspace(locale, wc); -} - -static inline -int iswupper_l(wchar_t wc, locale_t locale) -{ - return __xiswupper(locale, wc); -} - -static inline -int iswxdigit_l(wchar_t wc, locale_t locale) -{ - return __xiswxdigit(locale, wc); -} - -static inline -int iswctype_l(wint_t wc, wctype_t desc, locale_t locale) -{ - return __xiswctype(locale, wc, desc); -} - -static inline -int toupper_l(int c, locale_t locale) -{ - return __xtoupper(locale, c); -} -static inline -int tolower_l(int c, locale_t locale) -{ - return __xtolower(locale, c); -} -static inline -wint_t towupper_l(wint_t wc, locale_t locale) -{ - return __xtowupper(locale, wc); -} -static inline -wint_t towlower_l(wint_t wc, locale_t locale) -{ - return __xtowlower(locale, wc); -} - -static inline -int strcoll_l(const char *__s1, const char *__s2, locale_t locale) -{ - return __xstrcoll(locale, __s1, __s2); -} -static inline -int wcscoll_l(const wchar_t *__s1, const wchar_t *__s2, locale_t locale) -{ - return __xwcscoll(locale, __s1, __s2); -} -static inline -size_t strxfrm_l(char *__s1, const char *__s2, size_t __n, locale_t locale) -{ - return __xstrxfrm(locale, __s1, __s2, __n); -} - -static inline -size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n, - locale_t locale) -{ - return __xwcsxfrm(locale, __ws1, __ws2, __n); -} -#endif // !defined(_AIX71) - -// strftime_l() is defined by POSIX. However, AIX 7.1 does not have it -// implemented yet. -static inline -size_t strftime_l(char *__s, size_t __size, const char *__fmt, - const struct tm *__tm, locale_t locale) { - return __xstrftime(locale, __s, __size, __fmt, __tm); -} - -// The following are not POSIX routines. These are quick-and-dirty hacks -// to make things pretend to work -static inline -long long strtoll_l(const char *__nptr, char **__endptr, - int __base, locale_t locale) { - return strtoll(__nptr, __endptr, __base); -} -static inline -long strtol_l(const char *__nptr, char **__endptr, - int __base, locale_t locale) { - return strtol(__nptr, __endptr, __base); -} -static inline -long double strtold_l(const char *__nptr, char **__endptr, - locale_t locale) { - return strtold(__nptr, __endptr); -} -static inline -unsigned long long strtoull_l(const char *__nptr, char **__endptr, - int __base, locale_t locale) { - return strtoull(__nptr, __endptr, __base); -} -static inline -unsigned long strtoul_l(const char *__nptr, char **__endptr, - int __base, locale_t locale) { - return strtoul(__nptr, __endptr, __base); -} - -static inline -int vasprintf(char **strp, const char *fmt, va_list ap) -{ - const size_t buff_size = 256; - int str_size; - if ((*strp = (char *)malloc(buff_size)) == NULL) - { - return -1; - } - if ((str_size = vsnprintf(*strp, buff_size, fmt, ap)) >= buff_size) - { - if ((*strp = (char *)realloc(*strp, str_size + 1)) == NULL) - { - return -1; - } - str_size = vsnprintf(*strp, str_size + 1, fmt, ap); - } - return str_size; -} - -#ifdef __cplusplus -} -#endif -#endif // defined(_AIX) -#endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H diff --git a/include/support/musl/xlocale.h b/include/support/musl/xlocale.h deleted file mode 100644 index 3e31c99596ce9..0000000000000 --- a/include/support/musl/xlocale.h +++ /dev/null @@ -1,58 +0,0 @@ -// -*- C++ -*- -//===------------------- support/musl/xlocale.h ------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// This adds support for the extended locale functions that are currently -// missing from the Musl C library. -// -// This only works when the specified locale is "C" or "POSIX", but that's -// about as good as we can do without implementing full xlocale support -// in Musl. -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_MUSL_XLOCALE_H -#define _LIBCPP_SUPPORT_MUSL_XLOCALE_H - -#include <cstdlib> -#include <cwchar> - -#ifdef __cplusplus -extern "C" { -#endif - -static inline long long strtoll_l(const char *nptr, char **endptr, int base, - locale_t) { - return strtoll(nptr, endptr, base); -} - -static inline unsigned long long strtoull_l(const char *nptr, char **endptr, - int base, locale_t) { - return strtoull(nptr, endptr, base); -} - -static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr, - int base, locale_t) { - return wcstoll(nptr, endptr, base); -} - -static inline unsigned long long wcstoull_l(const wchar_t *nptr, - wchar_t **endptr, int base, - locale_t) { - return wcstoull(nptr, endptr, base); -} - -static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr, - locale_t) { - return wcstold(nptr, endptr); -} - -#ifdef __cplusplus -} -#endif - -#endif // _LIBCPP_SUPPORT_MUSL_XLOCALE_H diff --git a/include/support/newlib/xlocale.h b/include/support/newlib/xlocale.h deleted file mode 100644 index 09f9e39875267..0000000000000 --- a/include/support/newlib/xlocale.h +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H -#define _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H - -#if defined(_NEWLIB_VERSION) - -#include <cstdlib> -#include <clocale> -#include <cwctype> -#include <ctype.h> -#if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \ - __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5 -#include <support/xlocale/__nop_locale_mgmt.h> -#include <support/xlocale/__posix_l_fallback.h> -#include <support/xlocale/__strtonum_fallback.h> -#endif - -#endif // _NEWLIB_VERSION - -#endif diff --git a/include/support/solaris/floatingpoint.h b/include/support/solaris/floatingpoint.h deleted file mode 100644 index 999d144b1f2e5..0000000000000 --- a/include/support/solaris/floatingpoint.h +++ /dev/null @@ -1,14 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#define atof sun_atof -#define strtod sun_strtod -#include_next "floatingpoint.h" -#undef atof -#undef strtod diff --git a/include/support/solaris/wchar.h b/include/support/solaris/wchar.h deleted file mode 100644 index 0e8e660c8bd4f..0000000000000 --- a/include/support/solaris/wchar.h +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#define iswalpha sun_iswalpha -#define iswupper sun_iswupper -#define iswlower sun_iswlower -#define iswdigit sun_iswdigit -#define iswxdigit sun_iswxdigit -#define iswalnum sun_iswalnum -#define iswspace sun_iswspace -#define iswpunct sun_iswpunct -#define iswprint sun_iswprint -#define iswgraph sun_iswgraph -#define iswcntrl sun_iswcntrl -#define iswctype sun_iswctype -#define towlower sun_towlower -#define towupper sun_towupper -#define wcswcs sun_wcswcs -#define wcswidth sun_wcswidth -#define wcwidth sun_wcwidth -#define wctype sun_wctype -#define _WCHAR_T 1 -#include_next "wchar.h" -#undef iswalpha -#undef iswupper -#undef iswlower -#undef iswdigit -#undef iswxdigit -#undef iswalnum -#undef iswspace -#undef iswpunct -#undef iswprint -#undef iswgraph -#undef iswcntrl -#undef iswctype -#undef towlower -#undef towupper -#undef wcswcs -#undef wcswidth -#undef wcwidth -#undef wctype diff --git a/include/support/solaris/xlocale.h b/include/support/solaris/xlocale.h deleted file mode 100644 index e20ef7a6e53b2..0000000000000 --- a/include/support/solaris/xlocale.h +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -//////////////////////////////////////////////////////////////////////////////// -// Minimal xlocale implementation for Solaris. This implements the subset of -// the xlocale APIs that libc++ depends on. -//////////////////////////////////////////////////////////////////////////////// -#ifndef __XLOCALE_H_INCLUDED -#define __XLOCALE_H_INCLUDED - -#include <stdlib.h> - -#ifdef __cplusplus -extern "C" { -#endif - - -int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...); -int asprintf_l(char **__s, locale_t __l, const char *__format, ...); - -int sscanf_l(const char *__s, locale_t __l, const char *__format, ...); - -int toupper_l(int __c, locale_t __l); -int tolower_l(int __c, locale_t __l); - -struct lconv *localeconv(void); -struct lconv *localeconv_l(locale_t __l); - -// FIXME: These are quick-and-dirty hacks to make things pretend to work -static inline -long long strtoll_l(const char *__nptr, char **__endptr, - int __base, locale_t __loc) { - return strtoll(__nptr, __endptr, __base); -} -static inline -long strtol_l(const char *__nptr, char **__endptr, - int __base, locale_t __loc) { - return strtol(__nptr, __endptr, __base); -} -static inline -unsigned long long strtoull_l(const char *__nptr, char **__endptr, - int __base, locale_t __loc) { - return strtoull(__nptr, __endptr, __base); -} -static inline -unsigned long strtoul_l(const char *__nptr, char **__endptr, - int __base, locale_t __loc) { - return strtoul(__nptr, __endptr, __base); -} -static inline -float strtof_l(const char *__nptr, char **__endptr, - locale_t __loc) { - return strtof(__nptr, __endptr); -} -static inline -double strtod_l(const char *__nptr, char **__endptr, - locale_t __loc) { - return strtod(__nptr, __endptr); -} -static inline -long double strtold_l(const char *__nptr, char **__endptr, - locale_t __loc) { - return strtold(__nptr, __endptr); -} - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/support/win32/limits_msvc_win32.h b/include/support/win32/limits_msvc_win32.h deleted file mode 100644 index 1ab2e0b6dc1b2..0000000000000 --- a/include/support/win32/limits_msvc_win32.h +++ /dev/null @@ -1,72 +0,0 @@ -// -*- C++ -*- -//===------------------ support/win32/limits_msvc_win32.h -----------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H -#define _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H - -#if !defined(_LIBCPP_MSVCRT) -#error "This header complements the Microsoft C Runtime library, and should not be included otherwise." -#endif -#if defined(__clang__) -#error "This header should only be included when using Microsofts C1XX frontend" -#endif - -#include <limits.h> // CHAR_BIT -#include <float.h> // limit constants -#include <math.h> // HUGE_VAL -#include <ymath.h> // internal MSVC header providing the needed functionality - -#define __CHAR_BIT__ CHAR_BIT - -#define __FLT_MANT_DIG__ FLT_MANT_DIG -#define __FLT_DIG__ FLT_DIG -#define __FLT_RADIX__ FLT_RADIX -#define __FLT_MIN_EXP__ FLT_MIN_EXP -#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP -#define __FLT_MAX_EXP__ FLT_MAX_EXP -#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP -#define __FLT_MIN__ FLT_MIN -#define __FLT_MAX__ FLT_MAX -#define __FLT_EPSILON__ FLT_EPSILON -// predefined by MinGW GCC -#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F - -#define __DBL_MANT_DIG__ DBL_MANT_DIG -#define __DBL_DIG__ DBL_DIG -#define __DBL_RADIX__ DBL_RADIX -#define __DBL_MIN_EXP__ DBL_MIN_EXP -#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP -#define __DBL_MAX_EXP__ DBL_MAX_EXP -#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP -#define __DBL_MIN__ DBL_MIN -#define __DBL_MAX__ DBL_MAX -#define __DBL_EPSILON__ DBL_EPSILON -// predefined by MinGW GCC -#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L) - -#define __LDBL_MANT_DIG__ LDBL_MANT_DIG -#define __LDBL_DIG__ LDBL_DIG -#define __LDBL_RADIX__ LDBL_RADIX -#define __LDBL_MIN_EXP__ LDBL_MIN_EXP -#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP -#define __LDBL_MAX_EXP__ LDBL_MAX_EXP -#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP -#define __LDBL_MIN__ LDBL_MIN -#define __LDBL_MAX__ LDBL_MAX -#define __LDBL_EPSILON__ LDBL_EPSILON -// predefined by MinGW GCC -#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L - -// __builtin replacements/workarounds -#define __builtin_huge_vall() _LInf._Long_double -#define __builtin_nanl(__dummmy) _LNan._Long_double -#define __builtin_nansl(__dummy) _LSnan._Long_double - -#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H diff --git a/include/support/win32/locale_win32.h b/include/support/win32/locale_win32.h deleted file mode 100644 index c7c6d786cb835..0000000000000 --- a/include/support/win32/locale_win32.h +++ /dev/null @@ -1,199 +0,0 @@ -// -*- C++ -*- -//===--------------------- support/win32/locale_win32.h -------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H -#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H - -#include <__config> -#include <stdio.h> -#include <xlocinfo.h> // _locale_t -#include <__nullptr> - -#define LC_COLLATE_MASK _M_COLLATE -#define LC_CTYPE_MASK _M_CTYPE -#define LC_MONETARY_MASK _M_MONETARY -#define LC_NUMERIC_MASK _M_NUMERIC -#define LC_TIME_MASK _M_TIME -#define LC_MESSAGES_MASK _M_MESSAGES -#define LC_ALL_MASK ( LC_COLLATE_MASK \ - | LC_CTYPE_MASK \ - | LC_MESSAGES_MASK \ - | LC_MONETARY_MASK \ - | LC_NUMERIC_MASK \ - | LC_TIME_MASK ) - -class locale_t { -public: - locale_t() - : __locale(nullptr), __locale_str(nullptr) {} - locale_t(std::nullptr_t) - : __locale(nullptr), __locale_str(nullptr) {} - locale_t(_locale_t __xlocale, const char* __xlocale_str) - : __locale(__xlocale), __locale_str(__xlocale_str) {} - - friend bool operator==(const locale_t& __left, const locale_t& __right) { - return __left.__locale == __right.__locale; - } - - friend bool operator==(const locale_t& __left, int __right) { - return __left.__locale == nullptr && __right == 0; - } - - friend bool operator==(const locale_t& __left, long long __right) { - return __left.__locale == nullptr && __right == 0; - } - - friend bool operator==(const locale_t& __left, std::nullptr_t) { - return __left.__locale == nullptr; - } - - friend bool operator==(int __left, const locale_t& __right) { - return __left == 0 && nullptr == __right.__locale; - } - - friend bool operator==(std::nullptr_t, const locale_t& __right) { - return nullptr == __right.__locale; - } - - friend bool operator!=(const locale_t& __left, const locale_t& __right) { - return !(__left == __right); - } - - friend bool operator!=(const locale_t& __left, int __right) { - return !(__left == __right); - } - - friend bool operator!=(const locale_t& __left, long long __right) { - return !(__left == __right); - } - - friend bool operator!=(const locale_t& __left, std::nullptr_t __right) { - return !(__left == __right); - } - - friend bool operator!=(int __left, const locale_t& __right) { - return !(__left == __right); - } - - friend bool operator!=(std::nullptr_t __left, const locale_t& __right) { - return !(__left == __right); - } - - operator bool() const { - return __locale != nullptr; - } - - const char* __get_locale() const { return __locale_str; } - - operator _locale_t() const { - return __locale; - } -private: - _locale_t __locale; - const char* __locale_str; -}; - -// Locale management functions -#define freelocale _free_locale -// FIXME: base currently unused. Needs manual work to construct the new locale -locale_t newlocale( int mask, const char * locale, locale_t base ); -// uselocale can't be implemented on Windows because Windows allows partial modification -// of thread-local locale and so _get_current_locale() returns a copy while uselocale does -// not create any copies. -// We can still implement raii even without uselocale though. - - -lconv *localeconv_l( locale_t loc ); -size_t mbrlen_l( const char *__restrict s, size_t n, - mbstate_t *__restrict ps, locale_t loc); -size_t mbsrtowcs_l( wchar_t *__restrict dst, const char **__restrict src, - size_t len, mbstate_t *__restrict ps, locale_t loc ); -size_t wcrtomb_l( char *__restrict s, wchar_t wc, mbstate_t *__restrict ps, - locale_t loc); -size_t mbrtowc_l( wchar_t *__restrict pwc, const char *__restrict s, - size_t n, mbstate_t *__restrict ps, locale_t loc); -size_t mbsnrtowcs_l( wchar_t *__restrict dst, const char **__restrict src, - size_t nms, size_t len, mbstate_t *__restrict ps, locale_t loc); -size_t wcsnrtombs_l( char *__restrict dst, const wchar_t **__restrict src, - size_t nwc, size_t len, mbstate_t *__restrict ps, locale_t loc); -wint_t btowc_l( int c, locale_t loc ); -int wctob_l( wint_t c, locale_t loc ); - -decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l ); - -// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+ -#define mbtowc_l _mbtowc_l -#define strtoll_l _strtoi64_l -#define strtoull_l _strtoui64_l -#define strtod_l _strtod_l -#if defined(_LIBCPP_MSVCRT) -#define strtof_l _strtof_l -#define strtold_l _strtold_l -#else -float strtof_l(const char*, char**, locale_t); -long double strtold_l(const char*, char**, locale_t); -#endif -inline _LIBCPP_INLINE_VISIBILITY -int -islower_l(int c, _locale_t loc) -{ - return _islower_l((int)c, loc); -} - -inline _LIBCPP_INLINE_VISIBILITY -int -isupper_l(int c, _locale_t loc) -{ - return _isupper_l((int)c, loc); -} - -#define isdigit_l _isdigit_l -#define isxdigit_l _isxdigit_l -#define strcoll_l _strcoll_l -#define strxfrm_l _strxfrm_l -#define wcscoll_l _wcscoll_l -#define wcsxfrm_l _wcsxfrm_l -#define toupper_l _toupper_l -#define tolower_l _tolower_l -#define iswspace_l _iswspace_l -#define iswprint_l _iswprint_l -#define iswcntrl_l _iswcntrl_l -#define iswupper_l _iswupper_l -#define iswlower_l _iswlower_l -#define iswalpha_l _iswalpha_l -#define iswdigit_l _iswdigit_l -#define iswpunct_l _iswpunct_l -#define iswxdigit_l _iswxdigit_l -#define towupper_l _towupper_l -#define towlower_l _towlower_l -#if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800 -#define strftime_l( __s, __l, __f, __tm, __loc ) strftime( __s, __l, __f, __tm ) -#else -#define strftime_l _strftime_l -#endif -#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ ) -#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ ) -#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ ) -#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ ) -_LIBCPP_FUNC_VIS int snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...); -_LIBCPP_FUNC_VIS int asprintf_l( char **ret, locale_t loc, const char *format, ... ); -_LIBCPP_FUNC_VIS int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap ); - -// not-so-pressing FIXME: use locale to determine blank characters -inline int isblank_l( int c, locale_t /*loc*/ ) -{ - return ( c == ' ' || c == '\t' ); -} -inline int iswblank_l( wint_t c, locale_t /*loc*/ ) -{ - return ( c == L' ' || c == L'\t' ); -} - -#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H diff --git a/include/support/xlocale/__nop_locale_mgmt.h b/include/support/xlocale/__nop_locale_mgmt.h deleted file mode 100644 index 0d3f23a2c9698..0000000000000 --- a/include/support/xlocale/__nop_locale_mgmt.h +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- -//===------------ support/xlocale/__nop_locale_mgmt.h -----------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H -#define _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H - -#ifdef __cplusplus -extern "C" { -#endif - -// Patch over lack of extended locale support -typedef void *locale_t; -static inline locale_t duplocale(locale_t) { - return NULL; -} - -static inline void freelocale(locale_t) { -} - -static inline locale_t newlocale(int, const char *, locale_t) { - return NULL; -} - -static inline locale_t uselocale(locale_t) { - return NULL; -} - -#define LC_COLLATE_MASK (1 << LC_COLLATE) -#define LC_CTYPE_MASK (1 << LC_CTYPE) -#define LC_MESSAGES_MASK (1 << LC_MESSAGES) -#define LC_MONETARY_MASK (1 << LC_MONETARY) -#define LC_NUMERIC_MASK (1 << LC_NUMERIC) -#define LC_TIME_MASK (1 << LC_TIME) -#define LC_ALL_MASK (LC_COLLATE_MASK|\ - LC_CTYPE_MASK|\ - LC_MONETARY_MASK|\ - LC_NUMERIC_MASK|\ - LC_TIME_MASK|\ - LC_MESSAGES_MASK) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H diff --git a/include/support/xlocale/__posix_l_fallback.h b/include/support/xlocale/__posix_l_fallback.h deleted file mode 100644 index b9a0939f8fa1c..0000000000000 --- a/include/support/xlocale/__posix_l_fallback.h +++ /dev/null @@ -1,165 +0,0 @@ -// -*- C++ -*- -//===--------------- support/xlocale/__posix_l_fallback.h -----------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// These are reimplementations of some extended locale functions ( *_l ) that -// are normally part of POSIX. This shared implementation provides parts of the -// extended locale support for libc's that normally don't have any (like -// Android's bionic and Newlib). -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H -#define _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H - -#ifdef __cplusplus -extern "C" { -#endif - -inline _LIBCPP_INLINE_VISIBILITY int isalnum_l(int c, locale_t) { - return ::isalnum(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int isalpha_l(int c, locale_t) { - return ::isalpha(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int isblank_l(int c, locale_t) { - return ::isblank(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iscntrl_l(int c, locale_t) { - return ::iscntrl(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int isdigit_l(int c, locale_t) { - return ::isdigit(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int isgraph_l(int c, locale_t) { - return ::isgraph(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int islower_l(int c, locale_t) { - return ::islower(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int isprint_l(int c, locale_t) { - return ::isprint(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int ispunct_l(int c, locale_t) { - return ::ispunct(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int isspace_l(int c, locale_t) { - return ::isspace(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int isupper_l(int c, locale_t) { - return ::isupper(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int isxdigit_l(int c, locale_t) { - return ::isxdigit(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswalnum_l(wint_t c, locale_t) { - return ::iswalnum(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswalpha_l(wint_t c, locale_t) { - return ::iswalpha(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswblank_l(wint_t c, locale_t) { - return ::iswblank(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswcntrl_l(wint_t c, locale_t) { - return ::iswcntrl(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswdigit_l(wint_t c, locale_t) { - return ::iswdigit(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswgraph_l(wint_t c, locale_t) { - return ::iswgraph(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswlower_l(wint_t c, locale_t) { - return ::iswlower(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswprint_l(wint_t c, locale_t) { - return ::iswprint(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswpunct_l(wint_t c, locale_t) { - return ::iswpunct(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswspace_l(wint_t c, locale_t) { - return ::iswspace(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswupper_l(wint_t c, locale_t) { - return ::iswupper(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int iswxdigit_l(wint_t c, locale_t) { - return ::iswxdigit(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int toupper_l(int c, locale_t) { - return ::toupper(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int tolower_l(int c, locale_t) { - return ::tolower(c); -} - -inline _LIBCPP_INLINE_VISIBILITY wint_t towupper_l(wint_t c, locale_t) { - return ::towupper(c); -} - -inline _LIBCPP_INLINE_VISIBILITY wint_t towlower_l(wint_t c, locale_t) { - return ::towlower(c); -} - -inline _LIBCPP_INLINE_VISIBILITY int strcoll_l(const char *s1, const char *s2, - locale_t) { - return ::strcoll(s1, s2); -} - -inline _LIBCPP_INLINE_VISIBILITY size_t strxfrm_l(char *dest, const char *src, - size_t n, locale_t) { - return ::strxfrm(dest, src, n); -} - -inline _LIBCPP_INLINE_VISIBILITY size_t strftime_l(char *s, size_t max, - const char *format, - const struct tm *tm, locale_t) { - return ::strftime(s, max, format, tm); -} - -inline _LIBCPP_INLINE_VISIBILITY int wcscoll_l(const wchar_t *ws1, - const wchar_t *ws2, locale_t) { - return ::wcscoll(ws1, ws2); -} - -inline _LIBCPP_INLINE_VISIBILITY size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, - size_t n, locale_t) { - return ::wcsxfrm(dest, src, n); -} - -#ifdef __cplusplus -} -#endif - -#endif // _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H diff --git a/include/support/xlocale/__strtonum_fallback.h b/include/support/xlocale/__strtonum_fallback.h deleted file mode 100644 index 50b4db354277c..0000000000000 --- a/include/support/xlocale/__strtonum_fallback.h +++ /dev/null @@ -1,67 +0,0 @@ -// -*- C++ -*- -//===-------------- support/xlocale/__strtonum_fallback.h -----------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// These are reimplementations of some extended locale functions ( *_l ) that -// aren't part of POSIX. They are widely available though (GLIBC, BSD, maybe -// others). The unifying aspect in this case is that all of these functions -// convert strings to some numeric type. -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H -#define _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H - -#ifdef __cplusplus -extern "C" { -#endif - -inline _LIBCPP_INLINE_VISIBILITY float strtof_l(const char *nptr, - char **endptr, locale_t) { - return ::strtof(nptr, endptr); -} - -inline _LIBCPP_INLINE_VISIBILITY double strtod_l(const char *nptr, - char **endptr, locale_t) { - return ::strtod(nptr, endptr); -} - -inline _LIBCPP_INLINE_VISIBILITY long double strtold_l(const char *nptr, - char **endptr, locale_t) { - return ::strtold(nptr, endptr); -} - -inline _LIBCPP_INLINE_VISIBILITY long long -strtoll_l(const char *nptr, char **endptr, int base, locale_t) { - return ::strtoll(nptr, endptr, base); -} - -inline _LIBCPP_INLINE_VISIBILITY unsigned long long -strtoull_l(const char *nptr, char **endptr, int base, locale_t) { - return ::strtoull(nptr, endptr, base); -} - -inline _LIBCPP_INLINE_VISIBILITY long long -wcstoll_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) { - return ::wcstoll(nptr, endptr, base); -} - -inline _LIBCPP_INLINE_VISIBILITY unsigned long long -wcstoull_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) { - return ::wcstoull(nptr, endptr, base); -} - -inline _LIBCPP_INLINE_VISIBILITY long double wcstold_l(const wchar_t *nptr, - wchar_t **endptr, locale_t) { - return ::wcstold(nptr, endptr); -} - -#ifdef __cplusplus -} -#endif - -#endif // _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H diff --git a/include/support/xlocale/xlocale.h b/include/support/xlocale/xlocale.h deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/include/support/xlocale/xlocale.h +++ /dev/null |