diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt index 8ca0ce73a65f..4252ed00f7a4 100644 --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -628,9 +628,6 @@ set(files __support/musl/xlocale.h __support/newlib/xlocale.h __support/openbsd/xlocale.h - __support/solaris/floatingpoint.h - __support/solaris/wchar.h - __support/solaris/xlocale.h __support/win32/locale_win32.h __support/xlocale/__nop_locale_mgmt.h __support/xlocale/__posix_l_fallback.h diff --git a/libcxx/include/__config b/libcxx/include/__config index 671605864f99..5f3645808b47 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -344,15 +344,6 @@ # define _LIBCPP_HAS_OPEN_WITH_WCHAR # endif // defined(_WIN32) -# ifdef __sun__ -# include -# ifdef _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# else -# define _LIBCPP_BIG_ENDIAN -# endif -# endif // __sun__ - # if defined(_AIX) && !defined(__64BIT__) // The size of wchar is 2 byte on 32-bit mode on AIX. # define _LIBCPP_SHORT_WCHAR 1 @@ -397,7 +388,7 @@ // When this option is used, the token passed to `std::random_device`'s // constructor *must* be "/dev/urandom" -- anything else is an error. # if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \ - defined(__DragonFly__) || defined(__sun__) + defined(__DragonFly__) # define _LIBCPP_USING_ARC4_RANDOM # elif defined(__wasi__) || defined(__EMSCRIPTEN__) # define _LIBCPP_USING_GETENTROPY @@ -726,8 +717,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD # define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) # endif // _LIBCPP_CXX03_LANG -# if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || defined(__sun__) || \ - defined(__NetBSD__) +# if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || defined(__NetBSD__) # define _LIBCPP_LOCALE__L_EXTENSIONS 1 # endif @@ -767,7 +757,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD # define _LIBCPP_HAS_DEFAULTRUNELOCALE # endif -# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) +# if defined(__APPLE__) || defined(__FreeBSD__) # define _LIBCPP_WCTYPE_IS_MASK # endif @@ -936,7 +926,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD defined(__linux__) || \ defined(__GNU__) || \ defined(__APPLE__) || \ - defined(__sun__) || \ defined(__MVS__) || \ defined(_AIX) || \ defined(__EMSCRIPTEN__) diff --git a/libcxx/include/__locale b/libcxx/include/__locale index a812427acba4..f189ea631dfd 100644 --- a/libcxx/include/__locale +++ b/libcxx/include/__locale @@ -35,9 +35,6 @@ # include <__support/ibm/xlocale.h> #elif defined(__ANDROID__) # include <__support/android/locale_bionic.h> -#elif defined(__sun__) -# include <__support/solaris/xlocale.h> -# include #elif defined(_NEWLIB_VERSION) # include <__support/newlib/xlocale.h> #elif defined(__OpenBSD__) @@ -432,7 +429,7 @@ public: static const mask blank = _CTYPE_B; static const mask __regex_word = 0x80; # endif -#elif defined(__sun__) || defined(_AIX) +#elif defined(_AIX) typedef unsigned int mask; static const mask space = _ISSPACE; static const mask print = _ISPRINT; @@ -444,11 +441,7 @@ public: static const mask punct = _ISPUNCT; static const mask xdigit = _ISXDIGIT; static const mask blank = _ISBLANK; -# if defined(_AIX) static const mask __regex_word = 0x8000; -# else - static const mask __regex_word = 0x80; -# endif #elif defined(_NEWLIB_VERSION) // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h. typedef char mask; diff --git a/libcxx/include/__support/solaris/floatingpoint.h b/libcxx/include/__support/solaris/floatingpoint.h deleted file mode 100644 index 5f1628fbe4f5..000000000000 --- a/libcxx/include/__support/solaris/floatingpoint.h +++ /dev/null @@ -1,13 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#define atof sun_atof -#define strtod sun_strtod -#include_next "floatingpoint.h" -#undef atof -#undef strtod diff --git a/libcxx/include/__support/solaris/wchar.h b/libcxx/include/__support/solaris/wchar.h deleted file mode 100644 index f01fd743a23c..000000000000 --- a/libcxx/include/__support/solaris/wchar.h +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#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/libcxx/include/__support/solaris/xlocale.h b/libcxx/include/__support/solaris/xlocale.h deleted file mode 100644 index 373fbfbd6081..000000000000 --- a/libcxx/include/__support/solaris/xlocale.h +++ /dev/null @@ -1,75 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -//////////////////////////////////////////////////////////////////////////////// -// 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 - -#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 -inline _LIBCPP_HIDE_FROM_ABI long long -strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) { - return ::strtoll(__nptr, __endptr, __base); -} - -inline _LIBCPP_HIDE_FROM_ABI long -strtol_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) { - return ::strtol(__nptr, __endptr, __base); -} - -inline _LIBCPP_HIDE_FROM_ABI unsigned long long -strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) - return ::strtoull(__nptr, __endptr, __base); -} - -inline _LIBCPP_HIDE_FROM_ABI unsigned long -strtoul_l(const char *__nptr, char **__endptr, int __base, locale_t __loc) { - return ::strtoul(__nptr, __endptr, __base); -} - -inline _LIBCPP_HIDE_FROM_ABI float -strtof_l(const char *__nptr, char **__endptr, locale_t __loc) { - return ::strtof(__nptr, __endptr); -} - -inline _LIBCPP_HIDE_FROM_ABI double -strtod_l(const char *__nptr, char **__endptr, locale_t __loc) { - return ::strtod(__nptr, __endptr); -} - -inline _LIBCPP_HIDE_FROM_ABI long double -strtold_l(const char *__nptr, char **__endptr, locale_t __loc) { - return ::strtold(__nptr, __endptr); -} - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/libcxx/include/math.h b/libcxx/include/math.h index a23d1ff3ed37..5820151c4135 100644 --- a/libcxx/include/math.h +++ b/libcxx/include/math.h @@ -554,7 +554,6 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isunordered(_A1 __x, _A2 // acos -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float acos(float __x) _NOEXCEPT {return __builtin_acosf(__x);} template @@ -563,7 +562,6 @@ _LIBCPP_HIDE_FROM_ABI double acos(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double acos(long double __x) _NOEXCEPT {return __builtin_acosl(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -572,7 +570,6 @@ acos(_A1 __x) _NOEXCEPT {return __builtin_acos((double)__x);} // asin -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float asin(float __x) _NOEXCEPT {return __builtin_asinf(__x);} template @@ -581,7 +578,6 @@ _LIBCPP_HIDE_FROM_ABI double asin(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double asin(long double __x) _NOEXCEPT {return __builtin_asinl(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -590,7 +586,6 @@ asin(_A1 __x) _NOEXCEPT {return __builtin_asin((double)__x);} // atan -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float atan(float __x) _NOEXCEPT {return __builtin_atanf(__x);} template @@ -599,7 +594,6 @@ _LIBCPP_HIDE_FROM_ABI double atan(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double atan(long double __x) _NOEXCEPT {return __builtin_atanl(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -608,7 +602,6 @@ atan(_A1 __x) _NOEXCEPT {return __builtin_atan((double)__x);} // atan2 -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float atan2(float __y, float __x) _NOEXCEPT {return __builtin_atan2f(__y, __x);} template @@ -617,7 +610,6 @@ _LIBCPP_HIDE_FROM_ABI double atan2(double __x, double __y) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double atan2(long double __y, long double __x) _NOEXCEPT {return __builtin_atan2l(__y, __x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -637,7 +629,6 @@ atan2(_A1 __y, _A2 __x) _NOEXCEPT // ceil -# if !defined(__sun__) _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float ceil(float __x) _NOEXCEPT {return __builtin_ceilf(__x);} template @@ -646,7 +637,6 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double ceil(double __x) _NOEXCEPT { } _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double ceil(long double __x) _NOEXCEPT {return __builtin_ceill(__x);} -# endif template _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI @@ -655,7 +645,6 @@ ceil(_A1 __x) _NOEXCEPT {return __builtin_ceil((double)__x);} // cos -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float cos(float __x) _NOEXCEPT {return __builtin_cosf(__x);} template @@ -664,7 +653,6 @@ _LIBCPP_HIDE_FROM_ABI double cos(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double cos(long double __x) _NOEXCEPT {return __builtin_cosl(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -673,7 +661,6 @@ cos(_A1 __x) _NOEXCEPT {return __builtin_cos((double)__x);} // cosh -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float cosh(float __x) _NOEXCEPT {return __builtin_coshf(__x);} template @@ -682,7 +669,6 @@ _LIBCPP_HIDE_FROM_ABI double cosh(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double cosh(long double __x) _NOEXCEPT {return __builtin_coshl(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -691,7 +677,6 @@ cosh(_A1 __x) _NOEXCEPT {return __builtin_cosh((double)__x);} // exp -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float exp(float __x) _NOEXCEPT {return __builtin_expf(__x);} template @@ -700,7 +685,6 @@ _LIBCPP_HIDE_FROM_ABI double exp(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double exp(long double __x) _NOEXCEPT {return __builtin_expl(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -709,7 +693,6 @@ exp(_A1 __x) _NOEXCEPT {return __builtin_exp((double)__x);} // fabs -# if !defined(__sun__) _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float fabs(float __x) _NOEXCEPT {return __builtin_fabsf(__x);} template @@ -718,7 +701,6 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double fabs(double __x) _NOEXCEPT { } _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fabs(long double __x) _NOEXCEPT {return __builtin_fabsl(__x);} -# endif template _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI @@ -727,7 +709,6 @@ fabs(_A1 __x) _NOEXCEPT {return __builtin_fabs((double)__x);} // floor -# if !defined(__sun__) _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float floor(float __x) _NOEXCEPT {return __builtin_floorf(__x);} template @@ -736,7 +717,6 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double floor(double __x) _NOEXCEPT { } _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double floor(long double __x) _NOEXCEPT {return __builtin_floorl(__x);} -# endif template _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI @@ -745,7 +725,6 @@ floor(_A1 __x) _NOEXCEPT {return __builtin_floor((double)__x);} // fmod -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float fmod(float __x, float __y) _NOEXCEPT {return __builtin_fmodf(__x, __y);} template @@ -754,7 +733,6 @@ _LIBCPP_HIDE_FROM_ABI double fmod(double __x, double __y) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double fmod(long double __x, long double __y) _NOEXCEPT {return __builtin_fmodl(__x, __y);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -774,7 +752,6 @@ fmod(_A1 __x, _A2 __y) _NOEXCEPT // frexp -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float frexp(float __x, int* __e) _NOEXCEPT {return __builtin_frexpf(__x, __e);} template @@ -783,7 +760,6 @@ _LIBCPP_HIDE_FROM_ABI double frexp(double __x, int* __e) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double frexp(long double __x, int* __e) _NOEXCEPT {return __builtin_frexpl(__x, __e);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -792,7 +768,6 @@ frexp(_A1 __x, int* __e) _NOEXCEPT {return __builtin_frexp((double)__x, __e);} // ldexp -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float ldexp(float __x, int __e) _NOEXCEPT {return __builtin_ldexpf(__x, __e);} template @@ -801,7 +776,6 @@ _LIBCPP_HIDE_FROM_ABI double ldexp(double __x, int __e) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double ldexp(long double __x, int __e) _NOEXCEPT {return __builtin_ldexpl(__x, __e);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -810,7 +784,6 @@ ldexp(_A1 __x, int __e) _NOEXCEPT {return __builtin_ldexp((double)__x, __e);} // log -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float log(float __x) _NOEXCEPT {return __builtin_logf(__x);} template @@ -819,7 +792,6 @@ _LIBCPP_HIDE_FROM_ABI double log(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double log(long double __x) _NOEXCEPT {return __builtin_logl(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -828,7 +800,6 @@ log(_A1 __x) _NOEXCEPT {return __builtin_log((double)__x);} // log10 -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float log10(float __x) _NOEXCEPT {return __builtin_log10f(__x);} @@ -838,7 +809,6 @@ _LIBCPP_HIDE_FROM_ABI double log10(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double log10(long double __x) _NOEXCEPT {return __builtin_log10l(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -847,7 +817,6 @@ log10(_A1 __x) _NOEXCEPT {return __builtin_log10((double)__x);} // modf -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float modf(float __x, float* __y) _NOEXCEPT {return __builtin_modff(__x, __y);} template @@ -856,11 +825,9 @@ _LIBCPP_HIDE_FROM_ABI double modf(double __x, double* __y) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double modf(long double __x, long double* __y) _NOEXCEPT {return __builtin_modfl(__x, __y);} -# endif // pow -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float pow(float __x, float __y) _NOEXCEPT {return __builtin_powf(__x, __y);} template @@ -869,7 +836,6 @@ _LIBCPP_HIDE_FROM_ABI double pow(double __x, double __y) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double pow(long double __x, long double __y) _NOEXCEPT {return __builtin_powl(__x, __y);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -889,7 +855,6 @@ pow(_A1 __x, _A2 __y) _NOEXCEPT // sin -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float sin(float __x) _NOEXCEPT {return __builtin_sinf(__x);} template @@ -898,7 +863,6 @@ _LIBCPP_HIDE_FROM_ABI double sin(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double sin(long double __x) _NOEXCEPT {return __builtin_sinl(__x);} -#endif template inline _LIBCPP_HIDE_FROM_ABI @@ -907,7 +871,6 @@ sin(_A1 __x) _NOEXCEPT {return __builtin_sin((double)__x);} // sinh -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float sinh(float __x) _NOEXCEPT {return __builtin_sinhf(__x);} template @@ -916,7 +879,6 @@ _LIBCPP_HIDE_FROM_ABI double sinh(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double sinh(long double __x) _NOEXCEPT {return __builtin_sinhl(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -925,7 +887,6 @@ sinh(_A1 __x) _NOEXCEPT {return __builtin_sinh((double)__x);} // sqrt -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float sqrt(float __x) _NOEXCEPT {return __builtin_sqrtf(__x);} template @@ -934,7 +895,6 @@ _LIBCPP_HIDE_FROM_ABI double sqrt(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double sqrt(long double __x) _NOEXCEPT {return __builtin_sqrtl(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -943,7 +903,6 @@ sqrt(_A1 __x) _NOEXCEPT {return __builtin_sqrt((double)__x);} // tan -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float tan(float __x) _NOEXCEPT {return __builtin_tanf(__x);} template @@ -952,7 +911,6 @@ _LIBCPP_HIDE_FROM_ABI double tan(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double tan(long double __x) _NOEXCEPT {return __builtin_tanl(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI @@ -961,7 +919,6 @@ tan(_A1 __x) _NOEXCEPT {return __builtin_tan((double)__x);} // tanh -# if !defined(__sun__) inline _LIBCPP_HIDE_FROM_ABI float tanh(float __x) _NOEXCEPT {return __builtin_tanhf(__x);} template @@ -970,7 +927,6 @@ _LIBCPP_HIDE_FROM_ABI double tanh(double __x) _NOEXCEPT { } inline _LIBCPP_HIDE_FROM_ABI long double tanh(long double __x) _NOEXCEPT {return __builtin_tanhl(__x);} -# endif template inline _LIBCPP_HIDE_FROM_ABI diff --git a/libcxx/include/stdlib.h b/libcxx/include/stdlib.h index 4dd3a9c14ab0..614e3730c2f6 100644 --- a/libcxx/include/stdlib.h +++ b/libcxx/include/stdlib.h @@ -109,16 +109,15 @@ extern "C++" { #endif // MSVCRT already has the correct prototype in if __cplusplus is defined -#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) +#if !defined(_LIBCPP_MSVCRT) _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT { return __builtin_labs(__x); } _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT { return __builtin_llabs(__x); } -#endif // !defined(_LIBCPP_MSVCRT) && !defined(__sun__) +#endif // !defined(_LIBCPP_MSVCRT) -#if !defined(__sun__) _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT { return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h } @@ -131,7 +130,6 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long double abs(long double __lcpp_x) _NOEXCEPT { return __builtin_fabsl(__lcpp_x); } -#endif // !defined(__sun__) // div @@ -146,7 +144,7 @@ abs(long double __lcpp_x) _NOEXCEPT { #endif // MSVCRT already has the correct prototype in if __cplusplus is defined -#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) +#if !defined(_LIBCPP_MSVCRT) inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT { return ::ldiv(__x, __y); } @@ -156,7 +154,7 @@ inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, return ::lldiv(__x, __y); } #endif -#endif // _LIBCPP_MSVCRT / __sun__ +#endif // _LIBCPP_MSVCRT } // extern "C++" #endif // __cplusplus diff --git a/libcxx/include/string.h b/libcxx/include/string.h index 3ec877bad310..673d90316d00 100644 --- a/libcxx/include/string.h +++ b/libcxx/include/string.h @@ -64,8 +64,7 @@ size_t strlen(const char* s); // MSVCRT, GNU libc and its derivates may already have the correct prototype in // . This macro can be defined by users if their C library provides // the right signature. -#if defined(__CORRECT_ISO_CPP_STRING_H_PROTO) || defined(_LIBCPP_MSVCRT) || \ - defined(__sun__) || defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_) +#if defined(__CORRECT_ISO_CPP_STRING_H_PROTO) || defined(_LIBCPP_MSVCRT) || defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_) #define _LIBCPP_STRING_H_HAS_CONST_OVERLOADS #endif diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt index 2ad3b644a980..2d04f7704e09 100644 --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -100,12 +100,6 @@ if(WIN32) support/win32/thread_win32.cpp ) endif() -elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS") - list(APPEND LIBCXX_SOURCES - support/solaris/mbsnrtowcs.inc - support/solaris/wcsnrtombs.inc - support/solaris/xlocale.cpp - ) elseif(ZOS) list(APPEND LIBCXX_SOURCES support/ibm/mbsnrtowcs.cpp diff --git a/libcxx/src/include/config_elast.h b/libcxx/src/include/config_elast.h index bef26ec5019e..a772ea7a01bc 100644 --- a/libcxx/src/include/config_elast.h +++ b/libcxx/src/include/config_elast.h @@ -35,8 +35,6 @@ #define _LIBCPP_ELAST 4095 #elif defined(__APPLE__) // No _LIBCPP_ELAST needed on Apple -#elif defined(__sun__) -#define _LIBCPP_ELAST ESTALE #elif defined(__MVS__) #define _LIBCPP_ELAST 1160 #elif defined(_LIBCPP_MSVCRT_LIKE) diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp index 1e60c025b127..930bf4f8f3a2 100644 --- a/libcxx/src/locale.cpp +++ b/libcxx/src/locale.cpp @@ -6,12 +6,6 @@ // //===----------------------------------------------------------------------===// -// On Solaris, we need to define something to make the C99 parts of localeconv -// visible. -#ifdef __sun__ -#define _LCONV_C99 -#endif - #include <__utility/unreachable.h> #include #include @@ -1189,8 +1183,6 @@ ctype::classic_table() noexcept return _C_ctype_tab_ + 1; #elif defined(__GLIBC__) return _LIBCPP_GET_C_LOCALE->__ctype_b; -#elif defined(__sun__) - return __ctype_mask; #elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) return __pctype_func(); #elif defined(__EMSCRIPTEN__) @@ -1411,10 +1403,8 @@ ctype_byname::do_is(const char_type* low, const char_type* high, mask* if (iswxdigit_l(ch, __l_)) *vec |= xdigit; #endif -#if !defined(__sun__) if (iswblank_l(ch, __l_)) *vec |= blank; -#endif } } return low; diff --git a/libcxx/src/random.cpp b/libcxx/src/random.cpp index c120d6a81d3c..dfac89f75b5a 100644 --- a/libcxx/src/random.cpp +++ b/libcxx/src/random.cpp @@ -17,10 +17,6 @@ #include #include -#if defined(__sun__) -# define rename solaris_headers_are_broken -#endif // defined(__sun__) - #include #include #include diff --git a/libcxx/src/support/solaris/README.txt b/libcxx/src/support/solaris/README.txt deleted file mode 100644 index 89c887a3b4a3..000000000000 --- a/libcxx/src/support/solaris/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -This directory contains a partial implementation of the xlocale APIs for -Solaris. Some portions are lifted from FreeBSD libc, and so are covered by a -2-clause BSD license instead of the MIT/UUIC license that the rest of libc++ is -distributed under. diff --git a/libcxx/src/support/solaris/mbsnrtowcs.inc b/libcxx/src/support/solaris/mbsnrtowcs.inc deleted file mode 100644 index 074045277ca1..000000000000 --- a/libcxx/src/support/solaris/mbsnrtowcs.inc +++ /dev/null @@ -1,76 +0,0 @@ - - -/*- - * As noted in the source, some portions of this implementation are copied from - * FreeBSD libc. These are covered by the following copyright: - * - * Copyright (c) 2002-2004 Tim J. Robbins. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -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) -{ - const char *s; - size_t nchr; - wchar_t wc; - size_t nb; - FIX_LOCALE(loc); - - s = *src; - nchr = 0; - - if (dst == NULL) { - for (;;) { - if ((nb = mbrtowc_l(&wc, s, nms, ps, loc)) == (size_t)-1) - /* Invalid sequence - mbrtowc() sets errno. */ - return ((size_t)-1); - else if (nb == 0 || nb == (size_t)-2) - return (nchr); - s += nb; - nms -= nb; - nchr++; - } - /*NOTREACHED*/ - } - - while (len-- > 0) { - if ((nb = mbrtowc_l(dst, s, nms, ps, loc)) == (size_t)-1) { - *src = s; - return ((size_t)-1); - } else if (nb == (size_t)-2) { - *src = s + nms; - return (nchr); - } else if (nb == 0) { - *src = NULL; - return (nchr); - } - s += nb; - nms -= nb; - nchr++; - dst++; - } - *src = s; - return (nchr); -} diff --git a/libcxx/src/support/solaris/wcsnrtombs.inc b/libcxx/src/support/solaris/wcsnrtombs.inc deleted file mode 100644 index 239079e4719f..000000000000 --- a/libcxx/src/support/solaris/wcsnrtombs.inc +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * Copyright (c) 2002-2004 Tim J. Robbins. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - - -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) -{ - FIX_LOCALE(loc); - mbstate_t mbsbak; - char buf[MB_CUR_MAX_L(loc)]; - const wchar_t *s; - size_t nbytes; - size_t nb; - - s = *src; - nbytes = 0; - - if (dst == NULL) { - while (nwc-- > 0) { - if ((nb = wcrtomb_l(buf, *s, ps, loc)) == (size_t)-1) - /* Invalid character - wcrtomb() sets errno. */ - return ((size_t)-1); - else if (*s == L'\0') - return (nbytes + nb - 1); - s++; - nbytes += nb; - } - return (nbytes); - } - - while (len > 0 && nwc-- > 0) { - if (len > (size_t)MB_CUR_MAX_L(loc)) { - /* Enough space to translate in-place. */ - if ((nb = wcrtomb_l(dst, *s, ps, loc)) == (size_t)-1) { - *src = s; - return ((size_t)-1); - } - } else { - /* - * May not be enough space; use temp. buffer. - * - * We need to save a copy of the conversion state - * here so we can restore it if the multibyte - * character is too long for the buffer. - */ - mbsbak = *ps; - if ((nb = wcrtomb_l(buf, *s, ps, loc)) == (size_t)-1) { - *src = s; - return ((size_t)-1); - } - if (nb > (int)len) { - /* MB sequence for character won't fit. */ - *ps = mbsbak; - break; - } - memcpy(dst, buf, nb); - } - if (*s == L'\0') { - *src = NULL; - return (nbytes + nb - 1); - } - s++; - dst += nb; - len -= nb; - nbytes += nb; - } - *src = s; - return (nbytes); -} diff --git a/libcxx/src/support/solaris/xlocale.cpp b/libcxx/src/support/solaris/xlocale.cpp deleted file mode 100644 index d25adcd21d30..000000000000 --- a/libcxx/src/support/solaris/xlocale.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifdef __sun__ - -#include "__support/solaris/xlocale.h" -#include -#include -#include - -extern "C" { - -int isxdigit_l(int __c, locale_t __l) { - return isxdigit(__c); -} - -int iswxdigit_l(wint_t __c, locale_t __l) { - return isxdigit(__c); -} - -// FIXME: This disregards the locale, which is Very Wrong -#define vsnprintf_l(__s, __n, __l, __format, __va) \ - vsnprintf(__s, __n, __format, __va) - -int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) -{ - va_list __va; - va_start(__va, __format); - int __res = vsnprintf_l(__s, __n , __l, __format, __va); - va_end(__va); - return __res; -} - -int asprintf_l(char **__s, locale_t __l, const char *__format, ...) { - va_list __va; - va_start(__va, __format); - // FIXME: - int __res = vasprintf(__s, __format, __va); - va_end(__va); - return __res; -} - -int sscanf_l(const char *__s, locale_t __l, const char *__format, ...) { - va_list __va; - va_start(__va, __format); - // FIXME: - int __res = vsscanf(__s, __format, __va); - va_end(__va); - return __res; -} - -size_t mbrtowc_l(wchar_t *__pwc, const char *__pmb, - size_t __max, mbstate_t *__ps, locale_t __loc) { - return mbrtowc(__pwc, __pmb, __max, __ps); -} - -struct lconv *localeconv_l(locale_t __l) { - return localeconv(); -} - -}; - -#endif // __sun__ diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt index cfc617c1fb3f..b50684a32978 100644 --- a/libcxx/utils/data/ignore_format.txt +++ b/libcxx/utils/data/ignore_format.txt @@ -626,7 +626,6 @@ libcxx/include/__support/ibm/locale_mgmt_zos.h libcxx/include/__support/ibm/nanosleep.h libcxx/include/__support/ibm/xlocale.h libcxx/include/__support/newlib/xlocale.h -libcxx/include/__support/solaris/xlocale.h libcxx/include/__support/win32/locale_win32.h libcxx/include/__support/xlocale/__nop_locale_mgmt.h libcxx/include/__system_error/errc.h @@ -841,9 +840,6 @@ libcxx/src/support/runtime/exception_pointer_unimplemented.ipp libcxx/src/support/runtime/new_handler_fallback.ipp libcxx/src/support/runtime/stdexcept_default.ipp libcxx/src/support/runtime/stdexcept_vcruntime.ipp -libcxx/src/support/solaris/mbsnrtowcs.inc -libcxx/src/support/solaris/wcsnrtombs.inc -libcxx/src/support/solaris/xlocale.cpp libcxx/src/support/win32/locale_win32.cpp libcxx/src/support/win32/support.cpp libcxx/src/support/win32/thread_win32.cpp