[libcxx-commits] [libcxx] 3b6bc87 - [libc++] Remove Solaris related code

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 5 05:40:07 PDT 2023


Author: Louis Dionne
Date: 2023-05-05T08:39:51-04:00
New Revision: 3b6bc87520273d7ebc3b796b8493ddb401257038

URL: https://github.com/llvm/llvm-project/commit/3b6bc87520273d7ebc3b796b8493ddb401257038
DIFF: https://github.com/llvm/llvm-project/commit/3b6bc87520273d7ebc3b796b8493ddb401257038.diff

LOG: [libc++] Remove Solaris related code

This was contributed ~10 years ago, but we don't officially support it
and I am not aware of any bot testing it, so this has likely rotten to
the point where it is unusable.

Differential Revision: https://reviews.llvm.org/D138680

Added: 
    

Modified: 
    libcxx/include/CMakeLists.txt
    libcxx/include/__config
    libcxx/include/__locale
    libcxx/include/math.h
    libcxx/include/stdlib.h
    libcxx/include/string.h
    libcxx/src/CMakeLists.txt
    libcxx/src/include/config_elast.h
    libcxx/src/locale.cpp
    libcxx/src/random.cpp
    libcxx/utils/data/ignore_format.txt

Removed: 
    libcxx/include/__support/solaris/floatingpoint.h
    libcxx/include/__support/solaris/wchar.h
    libcxx/include/__support/solaris/xlocale.h
    libcxx/src/support/solaris/README.txt
    libcxx/src/support/solaris/mbsnrtowcs.inc
    libcxx/src/support/solaris/wcsnrtombs.inc
    libcxx/src/support/solaris/xlocale.cpp


################################################################################
diff  --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 8ca0ce73a65fc..4252ed00f7a42 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 671605864f998..5f3645808b470 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 <sys/isa_defs.h>
-#    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 a812427acba4e..f189ea631dfdb 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 <xlocale.h>
 #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 5f1628fbe4f59..0000000000000
--- 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 f01fd743a23c1..0000000000000
--- 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 373fbfbd6081c..0000000000000
--- 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 <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
-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 a23d1ff3ed378..5820151c4135a 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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1, class _A2>
 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 <class = int>
@@ -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 <class _A1>
 _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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1>
 _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 <class = int>
@@ -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 <class _A1>
 _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 <class = int>
@@ -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 <class _A1, class _A2>
 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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1>
 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 <class _A1>
 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 <class = int>
@@ -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 <class = int>
@@ -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 <class _A1, class _A2>
 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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1>
 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 <class = int>
@@ -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 <class _A1>
 inline _LIBCPP_HIDE_FROM_ABI

diff  --git a/libcxx/include/stdlib.h b/libcxx/include/stdlib.h
index 4dd3a9c14ab04..614e3730c2f66 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 <stdlib.h> 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 <stdlib.h> 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 3ec877bad310a..673d90316d002 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
 // <string.h>. 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 2ad3b644a9809..2d04f7704e09d 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 bef26ec5019ec..a772ea7a01bce 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 1e60c025b127a..930bf4f8f3a2b 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 <algorithm>
 #include <clocale>
@@ -1189,8 +1183,6 @@ ctype<char>::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<wchar_t>::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 c120d6a81d3ce..dfac89f75b5a7 100644
--- a/libcxx/src/random.cpp
+++ b/libcxx/src/random.cpp
@@ -17,10 +17,6 @@
 #include <limits>
 #include <random>
 
-#if defined(__sun__)
-#   define rename solaris_headers_are_broken
-#endif // defined(__sun__)
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>

diff  --git a/libcxx/src/support/solaris/README.txt b/libcxx/src/support/solaris/README.txt
deleted file mode 100644
index 89c887a3b4a39..0000000000000
--- 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 074045277ca18..0000000000000
--- 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 239079e4719fc..0000000000000
--- 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 d25adcd21d307..0000000000000
--- 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 <stdarg.h>
-#include <stdio.h>
-#include <sys/localedef.h>
-
-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 cfc617c1fb3fd..b50684a329784 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


        


More information about the libcxx-commits mailing list