[libc++] Refactor the configuration macros to being always defined (#112094)
This is a follow-up to #89178. This updates the `<__config_site>`
macros.
diff --git a/libcxx/src/string.cpp b/libcxx/src/string.cpp
index 12db538..dc16ce7 100644
--- a/libcxx/src/string.cpp
+++ b/libcxx/src/string.cpp
@@ -14,7 +14,7 @@
#include <stdexcept>
#include <string>
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
# include <cwchar>
#endif
@@ -40,12 +40,12 @@
#define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__;
#ifdef _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# if _LIBCPP_HAS_WIDE_CHARACTERS
_LIBCPP_STRING_UNSTABLE_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
# endif
#else
_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, char)
-# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# if _LIBCPP_HAS_WIDE_CHARACTERS
_LIBCPP_STRING_V1_EXTERN_TEMPLATE_LIST(_LIBCPP_EXTERN_TEMPLATE_DEFINE, wchar_t)
# endif
#endif
@@ -115,7 +115,7 @@
return as_integer_helper<unsigned long long>(func, s, idx, base, strtoull);
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
// wstring
template <>
inline int as_integer(const string& func, const wstring& s, size_t* idx, int base) {
@@ -145,7 +145,7 @@
inline unsigned long long as_integer(const string& func, const wstring& s, size_t* idx, int base) {
return as_integer_helper<unsigned long long>(func, s, idx, base, wcstoull);
}
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
// as_float
@@ -184,7 +184,7 @@
return as_float_helper<long double>(func, s, idx, strtold);
}
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
template <>
inline float as_float(const string& func, const wstring& s, size_t* idx) {
return as_float_helper<float>(func, s, idx, wcstof);
@@ -199,7 +199,7 @@
inline long double as_float(const string& func, const wstring& s, size_t* idx) {
return as_float_helper<long double>(func, s, idx, wcstold);
}
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
} // unnamed namespace
@@ -223,7 +223,7 @@
long double stold(const string& str, size_t* idx) { return as_float<long double>("stold", str, idx); }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
int stoi(const wstring& str, size_t* idx, int base) { return as_integer<int>("stoi", str, idx, base); }
long stol(const wstring& str, size_t* idx, int base) { return as_integer<long>("stol", str, idx, base); }
@@ -243,7 +243,7 @@
double stod(const wstring& str, size_t* idx) { return as_float<double>("stod", str, idx); }
long double stold(const wstring& str, size_t* idx) { return as_float<long double>("stold", str, idx); }
-#endif // !_LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
// to_string
@@ -283,7 +283,7 @@
}
};
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
template <>
struct initial_string<wstring> {
wstring operator()() const {
@@ -302,7 +302,7 @@
return static_cast<int(__cdecl*)(wchar_t* __restrict, size_t, const wchar_t* __restrict, ...)>(_snwprintf);
# endif
}
-#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#endif // _LIBCPP_HAS_WIDE_CHARACTERS
template <typename S, typename V>
S i_to_string(V v) {
@@ -325,7 +325,7 @@
string to_string(unsigned long val) { return i_to_string< string>(val); }
string to_string(unsigned long long val) { return i_to_string< string>(val); }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
wstring to_wstring(int val) { return i_to_string<wstring>(val); }
wstring to_wstring(long val) { return i_to_string<wstring>(val); }
wstring to_wstring(long long val) { return i_to_string<wstring>(val); }
@@ -338,7 +338,7 @@
string to_string(double val) { return as_string(snprintf, initial_string< string>()(), "%f", val); }
string to_string(long double val) { return as_string(snprintf, initial_string< string>()(), "%Lf", val); }
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+#if _LIBCPP_HAS_WIDE_CHARACTERS
wstring to_wstring(float val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
wstring to_wstring(double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%f", val); }
wstring to_wstring(long double val) { return as_string(get_swprintf(), initial_string<wstring>()(), L"%Lf", val); }