2018-07-26 Jonathan Wakely <jwakely@redhat.com>
+ * include/bits/basic_string.h [!_GLIBCXX_USE_C99_STDINT_TR1]
+ (hash<u16string>, hash<u32string>): Remove dependency on
+ _GLIBCXX_USE_C99_STDINT_TR1.
+ * include/bits/char_traits.h [!_GLIBCXX_USE_C99_STDINT_TR1]
+ (char_traits<char16_t>, char_traits<char32_t>): Remove dependency on
+ _GLIBCXX_USE_C99_STDINT_TR1. Use __UINT_LEAST16_TYPE__ and
+ __UINT_LEAST32_TYPE__ or make_unsigned when <stdint.h> is not usable.
+ * include/bits/codecvt.h [!_GLIBCXX_USE_C99_STDINT_TR1]
+ (codecvt<char16_t, char, mbstate_t>)
+ (codecvt<char32_t, char, mbstate_t>)
+ (codecvt_byname<char16_t, char, mbstate_t>)
+ (codecvt_byname<char32_t, char, mbstate_t>): Remove dependency
+ on _GLIBCXX_USE_C99_STDINT_TR1.
+ * include/bits/locale_facets.h [!_GLIBCXX_USE_C99_STDINT_TR1]
+ (_GLIBCXX_NUM_UNICODE_FACETS): Likewise.
+ * include/bits/stringfwd.h [!_GLIBCXX_USE_C99_STDINT_TR1]
+ (char_traits<char16_t>, char_traits<char32_t>)
+ (basic_string<char16_t>, basic_string<char32_t>): Remove dependency
+ on _GLIBCXX_USE_C99_STDINT_TR1.
+ * include/experimental/string_view [!_GLIBCXX_USE_C99_STDINT_TR1]
+ (u16string_view, u32string_view, hash<u16string_view>)
+ (hash<u32string_view>, operator""sv(const char16_t, size_t))
+ (operator""sv(const char32_t, size_t)): Likewise.
+ * include/ext/vstring.h [!_GLIBCXX_USE_C99_STDINT_TR1]
+ (hash<__u16vstring>, hash<__u32vstring>): Likewise.
+ * include/ext/vstring_fwd.h [!_GLIBCXX_USE_C99_STDINT_TR1]
+ (__u16vstring, __u16sso_string, __u16rc_string, __u32vstring)
+ (__u32sso_string, __u32rc_string): Likewise.
+ * include/std/codecvt [!_GLIBCXX_USE_C99_STDINT_TR1] (codecvt_mode)
+ (codecvt_utf8, codecvt_utf16, codecvt_utf8_utf16): Likewise.
+ * include/std/string_view [!_GLIBCXX_USE_C99_STDINT_TR1]
+ (u16string_view, u32string_view, hash<u16string_view>)
+ (hash<u32string_view>, operator""sv(const char16_t, size_t))
+ (operator""sv(const char32_t, size_t)): Likewise.
+ * src/c++11/codecvt.cc: Likewise.
+ * src/c++98/locale_init.cc: Likewise.
+ * src/c++98/localename.cc: Likewise.
+
* include/bits/atomic_futex.h [!_GLIBCXX_USE_C99_STDINT_TR1]
(__atomic_futex_unsigned_base): Remove dependency on
_GLIBCXX_USE_C99_STDINT_TR1 macro.
#endif
#endif /* _GLIBCXX_COMPATIBILITY_CXX0X */
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
/// std::hash specialization for u16string.
template<>
struct hash<u16string>
template<>
struct __is_fast_hash<hash<u32string>> : std::false_type
{ };
-#endif
#if __cplusplus > 201103L
{ return basic_string<wchar_t>{__str, __len}; }
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
_GLIBCXX_DEFAULT_ABI_TAG
inline basic_string<char16_t>
operator""s(const char16_t* __str, size_t __len)
inline basic_string<char32_t>
operator""s(const char32_t* __str, size_t __len)
{ return basic_string<char32_t>{__str, __len}; }
-#endif
#pragma GCC diagnostic pop
} // inline namespace string_literals
#include <cwchar> // For WEOF, wmemmove, wmemset, etc.
#ifndef _GLIBCXX_ALWAYS_INLINE
-#define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__))
+# define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__))
#endif
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#if ((__cplusplus >= 201103L) \
- && defined(_GLIBCXX_USE_C99_STDINT_TR1))
+#if __cplusplus >= 201103L
#include <cstdint>
struct char_traits<char16_t>
{
typedef char16_t char_type;
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
typedef uint_least16_t int_type;
+#elif defined __UINT_LEAST16_TYPE__
+ typedef __UINT_LEAST16_TYPE__ int_type;
+#else
+ typedef make_unsigned<char16_t>::type int_type;
+#endif
typedef streamoff off_type;
typedef u16streampos pos_type;
typedef mbstate_t state_type;
struct char_traits<char32_t>
{
typedef char32_t char_type;
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
typedef uint_least32_t int_type;
+#elif defined __UINT_LEAST32_TYPE__
+ typedef __UINT_LEAST32_TYPE__ int_type;
+#else
+ typedef make_unsigned<char32_t>::type int_type;
+#endif
typedef streamoff off_type;
typedef u32streampos pos_type;
typedef mbstate_t state_type;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#endif
+#endif // C++11
#endif // _CHAR_TRAITS_H
#endif //_GLIBCXX_USE_WCHAR_T
#if __cplusplus >= 201103L
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
/** @brief Class codecvt<char16_t, char, mbstate_t> specialization.
*
* Converts between UTF-16 and UTF-8.
do_max_length() const throw();
};
-#endif // _GLIBCXX_USE_C99_STDINT_TR1
#endif // C++11
/// class codecvt_byname [22.2.1.6].
~codecvt_byname() { }
};
-#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+#if __cplusplus >= 201103L
template<>
class codecvt_byname<char16_t, char, mbstate_t>
: public codecvt<char16_t, char, mbstate_t>
virtual
~codecvt_byname() { }
};
-#endif
+#endif // C++11
// Inhibit implicit instantiations for required instantiations,
// which are defined via explicit instantiations elsewhere.
has_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);
#endif
-#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+#if __cplusplus >= 201103L
extern template class codecvt_byname<char16_t, char, mbstate_t>;
extern template class codecvt_byname<char32_t, char, mbstate_t>;
#endif
# define _GLIBCXX_NUM_FACETS 14
# define _GLIBCXX_NUM_CXX11_FACETS 8
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-# define _GLIBCXX_NUM_UNICODE_FACETS 2
-#else
-# define _GLIBCXX_NUM_UNICODE_FACETS 0
-#endif
+#define _GLIBCXX_NUM_UNICODE_FACETS 2
// Convert string to numeric value of type _Tp and store results.
// NB: This is specialized for all required types, there is no
template<> struct char_traits<wchar_t>;
#endif
-#if ((__cplusplus >= 201103L) \
- && defined(_GLIBCXX_USE_C99_STDINT_TR1))
+#if __cplusplus >= 201103L
template<> struct char_traits<char16_t>;
template<> struct char_traits<char32_t>;
#endif
typedef basic_string<wchar_t> wstring;
#endif
-#if ((__cplusplus >= 201103L) \
- && defined(_GLIBCXX_USE_C99_STDINT_TR1))
+#if __cplusplus >= 201103L
/// A string of @c char16_t
typedef basic_string<char16_t> u16string;
#ifdef _GLIBCXX_USE_WCHAR_T
using wstring_view = basic_string_view<wchar_t>;
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
using u16string_view = basic_string_view<char16_t>;
using u32string_view = basic_string_view<char32_t>;
-#endif
} // namespace fundamentals_v1
} // namespace experimental
{ };
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
template<>
struct hash<experimental::u16string_view>
: public __hash_base<size_t, experimental::u16string_view>
template<>
struct __is_fast_hash<hash<experimental::u32string_view>> : std::false_type
{ };
-#endif
namespace experimental
{
{ return basic_string_view<wchar_t>{__str, __len}; }
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
inline constexpr basic_string_view<char16_t>
operator""sv(const char16_t* __str, size_t __len) noexcept
{ return basic_string_view<char16_t>{__str, __len}; }
inline constexpr basic_string_view<char32_t>
operator""sv(const char32_t* __str, size_t __len) noexcept
{ return basic_string_view<char32_t>{__str, __len}; }
-#endif
#pragma GCC diagnostic pop
} // namespace string_literals
} // namespace literals
};
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
/// std::hash specialization for __u16vstring.
template<>
struct hash<__gnu_cxx::__u16vstring>
{ return std::_Hash_impl::hash(__s.data(),
__s.length() * sizeof(char32_t)); }
};
-#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
std::allocator<wchar_t>, __rc_string_base> __wrc_string;
#endif
-#if ((__cplusplus >= 201103L) \
- && defined(_GLIBCXX_USE_C99_STDINT_TR1))
-
+#if __cplusplus >= 201103L
typedef __versa_string<char16_t> __u16vstring;
typedef __u16vstring __u16sso_string;
typedef
typedef
__versa_string<char32_t, std::char_traits<char32_t>,
std::allocator<char32_t>, __rc_string_base> __u32rc_string;
-
-#endif
+#endif // C++11
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#include <bits/locale_classes.h>
#include <bits/codecvt.h>
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#endif // _GLIBCXX_USE_C99_STDINT_TR1
-
-#endif
+#endif // C++11
#endif /* _GLIBCXX_CODECVT */
#ifdef _GLIBCXX_USE_WCHAR_T
using wstring_view = basic_string_view<wchar_t>;
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
using u16string_view = basic_string_view<char16_t>;
using u32string_view = basic_string_view<char32_t>;
-#endif
// [string.view.hash], hash support:
{ };
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
template<>
struct hash<u16string_view>
: public __hash_base<size_t, u16string_view>
template<>
struct __is_fast_hash<hash<u32string_view>> : std::false_type
{ };
-#endif
inline namespace literals
{
{ return basic_string_view<wchar_t>{__str, __len}; }
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
inline constexpr basic_string_view<char16_t>
operator""sv(const char16_t* __str, size_t __len) noexcept
{ return basic_string_view<char16_t>{__str, __len}; }
inline constexpr basic_string_view<char32_t>
operator""sv(const char32_t* __str, size_t __len) noexcept
{ return basic_string_view<char32_t>{__str, __len}; }
-#endif
+
#pragma GCC diagnostic pop
} // namespace string_literals
} // namespace literals
#include <cstring> // std::memcpy, std::memcmp
#include <bits/stl_algobase.h> // std::min
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
}
-#endif // _GLIBCXX_USE_C99_STDINT_TR1
fake_messages_w messages_w;
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
typedef char fake_codecvt_c16[sizeof(codecvt<char16_t, char, mbstate_t>)]
__attribute__ ((aligned(__alignof__(codecvt<char16_t, char, mbstate_t>))));
fake_codecvt_c16 codecvt_c16;
typedef char fake_codecvt_c32[sizeof(codecvt<char32_t, char, mbstate_t>)]
__attribute__ ((aligned(__alignof__(codecvt<char32_t, char, mbstate_t>))));
fake_codecvt_c32 codecvt_c32;
-#endif
// Storage for "C" locale caches.
typedef char fake_num_cache_c[sizeof(std::__numpunct_cache<char>)]
&std::ctype<wchar_t>::id,
&codecvt<wchar_t, char, mbstate_t>::id,
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+#if _GLIBCXX_NUM_UNICODE_FACETS != 0
&codecvt<char16_t, char, mbstate_t>::id,
&codecvt<char32_t, char, mbstate_t>::id,
#endif
_M_init_facet(new (&messages_w) std::messages<wchar_t>(1));
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+#ifdef _GLIBCXX_NUM_UNICODE_FACETS != 0
_M_init_facet(new (&codecvt_c16) codecvt<char16_t, char, mbstate_t>(1));
_M_init_facet(new (&codecvt_c32) codecvt<char32_t, char, mbstate_t>(1));
#endif
_M_init_facet(new std::messages<wchar_t>(__cloc, __s));
#endif
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+#if _GLIBCXX_NUM_UNICODE_FACETS != 0
_M_init_facet(new codecvt<char16_t, char, mbstate_t>);
_M_init_facet(new codecvt<char32_t, char, mbstate_t>);
#endif