summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authordj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-14 19:44:36 +0000
committerdj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-14 19:44:36 +0000
commit9f75f0266e3611513f196c898088e2712a71eaf4 (patch)
treee12f293c8d0e0b83e0dc6b0b250a64fb5d4bcd50 /libstdc++-v3
parentb59bd98f4b8df2e37835310db9ad8d627a2cf3cc (diff)
downloadgcc-9f75f0266e3611513f196c898088e2712a71eaf4.tar.gz
* machmode.h (int_n_data_t): New.
(int_n_enabled_p): New. (int_n_data): New. * tree.c (int_n_enabled_p): New. (int_n_trees): New. (make_or_reuse_type): Check for all __intN types, not just __int128. (build_common_tree_nodes): Likewise. Also fill in integer_typs[] entries. * tree.h (int128_integer_type_node): Remove. (int128_unsigned_type_node): Remove. (int_n_trees_t): New. (int_n_enabled_p): New. (int_n_trees): New. * toplev.c (standard_type_bitsize): New. (do_compile): Check which __intN types are enabled for the current run. * builtin-types.def (BT_INT128): Remove. (BT_UINT128): Remove. * machmode.def: Add macro to create __int128 for all targets. * stor-layout.c (mode_for_size): Support __intN types. (smallest_mode_for_size): Likewise. (initialize_sizetypes): Support __intN types. * genmodes.c (struct mode_data): Add int_n field. (blank_mode): Likewise. (INT_N): New. (make_int_n): New. (emit_insn_modes_h): Count __intN entries and define NUM_INT_N_ENTS. (emit_mode_int_n): New. (emit_insn_modes_c): Call it. * gimple.c (gimple_signed_or_unsigned_type): Check for all __intN types, not just __int128. * tree-core.h (integer_type_kind): Remove __int128-specific entries, reserve spots for __intN entries. libstdc++-v3/ * src/c++11/limits.cc: Add support for __intN types. * include/std/type_traits: Likewise. * include/std/limits: Likewise. * include/c_std/cstdlib: Likewise. * include/bits/cpp_type_traits.h: Likewise. * include/c_global/cstdlib: Likewise. c-family/ * c-pretty-print.c (pp_c_integer_constant): Check for all __intN types, not just __int128. * c-cppbuiltin.c (c_cpp_builtins): Add builtins for all __intN types, not just __int128. (cpp_atomic_builtins): Round pointer sizes up. (type_suffix): Use type precision, not specific types. * c-common.c (c_common_reswords): Remove __int128 special case. (c_common_type_for_size): Check for all __intN types, not just __int128. (c_common_type_for_mode): Likewise. (c_common_signed_or_unsigned_type): Likewise. (c_build_bitfield_integer_type): Likewise. (c_common_nodes_and_builtins): Likewise. (keyword_begins_type_specifier): Likewise. * c-common.h (rid): Remove RID_INT128 and add RID_INT_N_* for all __intN variants. c/ * c-parser.c (c_parse_init): Add RID entries for each __intN. (c_token_starts_typename): Check all __intN, not just __int128. (c_token_starts_declspecs): Likewise. (c_parser_declspecs): Likewise. (c_parser_attribute_any_word): Likewise. (c_parser_objc_selector): Likewise. * c-tree.h (c_typespec_keyword): cts_int128 -> cts_int_n. (struct c_declspecs): Add int_n_idx field to record *which* __intN is specified. * c-decl.c (declspecs_add_type): Check for all __intN, not just __int128. (finish_declspecs): Likewise. testsuite/ * g++.dg/abi/mangle64.C: New. cp/ * typeck.c (cp_common_type): Check for all __intN types, not just __int128. * decl.c (grokdeclarator): Likewise. * rtti.c (emit_support_tinfos): Check for all __intN types, not just __int128. * parser.c (cp_lexer_next_token_is_decl_specifier_keyword): Check for all __intN types, not just __int128. (cp_parser_simple_type_specifier): Likewise. * mangle.c (integer_type_codes): Remove int128-specific codes. * cp-tree.h (cp_decl_specifier_seq): Add int_n_idx to store which __intN was specified. * lex.c (init_reswords): Reserve all __intN keywords. lto/ * lto-lang.c (lto_build_c_type_nodes): Check intN types for size-type as well. (lto_init): Initialize all intN types, not just int128. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216220 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/include/bits/cpp_type_traits.h32
-rw-r--r--libstdc++-v3/include/c_global/cstdlib19
-rw-r--r--libstdc++-v3/include/c_std/cstdlib18
-rw-r--r--libstdc++-v3/include/std/limits329
-rw-r--r--libstdc++-v3/include/std/type_traits77
-rw-r--r--libstdc++-v3/src/c++11/limits.cc108
7 files changed, 383 insertions, 209 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a20ae1ccade..cc052f082b5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,12 @@
+2014-10-14 DJ Delorie <dj@redhat.com>
+
+ * src/c++11/limits.cc: Add support for __intN types.
+ * include/std/type_traits: Likewise.
+ * include/std/limits: Likewise.
+ * include/c_std/cstdlib: Likewise.
+ * include/bits/cpp_type_traits.h: Likewise.
+ * include/c_global/cstdlib: Likewise.
+
2014-10-14 Jonathan Wakely <jwakely@redhat.com>
* testsuite/20_util/align/1.cc: Add dg-require-stdint.
diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h
index 8df81a705ea..46067f18a1e 100644
--- a/libstdc++-v3/include/bits/cpp_type_traits.h
+++ b/libstdc++-v3/include/bits/cpp_type_traits.h
@@ -141,7 +141,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Thirteen specializations (yes there are eleven standard integer
// types; <em>long long</em> and <em>unsigned long long</em> are
- // supported as extensions)
+ // supported as extensions). Up to four target-specific __int<N>
+ // types are supported as well.
template<>
struct __is_integer<bool>
{
@@ -251,6 +252,35 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef __true_type __type;
};
+#define __INT_N(TYPE) \
+ template<> \
+ struct __is_integer<TYPE> \
+ { \
+ enum { __value = 1 }; \
+ typedef __true_type __type; \
+ }; \
+ template<> \
+ struct __is_integer<unsigned TYPE> \
+ { \
+ enum { __value = 1 }; \
+ typedef __true_type __type; \
+ };
+
+#ifdef __GLIBCXX_TYPE_INT_N_0
+__INT_N(__GLIBCXX_TYPE_INT_N_0)
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_1
+__INT_N(__GLIBCXX_TYPE_INT_N_1)
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_2
+__INT_N(__GLIBCXX_TYPE_INT_N_2)
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_3
+__INT_N(__GLIBCXX_TYPE_INT_N_3)
+#endif
+
+#undef __INT_N
+
//
// Floating point types
//
diff --git a/libstdc++-v3/include/c_global/cstdlib b/libstdc++-v3/include/c_global/cstdlib
index e98a7262817..f1b36f3db61 100644
--- a/libstdc++-v3/include/c_global/cstdlib
+++ b/libstdc++-v3/include/c_global/cstdlib
@@ -174,10 +174,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
abs(long long __x) { return __builtin_llabs (__x); }
#endif
-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
- inline __int128
- abs(__int128 __x) { return __x >= 0 ? __x : -__x; }
+#if defined(__GLIBCXX_TYPE_INT_N_0)
+ inline __GLIBCXX_TYPE_INT_N_0
+ abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
#endif
+#if defined(__GLIBCXX_TYPE_INT_N_1)
+ inline __GLIBCXX_TYPE_INT_N_1
+ abs(__GLIBCXX_TYPE_INT_N_1 __x) { return __x >= 0 ? __x : -__x; }
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_2)
+ inline __GLIBCXX_TYPE_INT_N_2
+ abs(__GLIBCXX_TYPE_INT_N_2 __x) { return __x >= 0 ? __x : -__x; }
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_3)
+ inline __GLIBCXX_TYPE_INT_N_3
+ abs(__GLIBCXX_TYPE_INT_N_3 __x) { return __x >= 0 ? __x : -__x; }
+#endif
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/include/c_std/cstdlib b/libstdc++-v3/include/c_std/cstdlib
index 7f0d9b20cd1..38c942a3ceb 100644
--- a/libstdc++-v3/include/c_std/cstdlib
+++ b/libstdc++-v3/include/c_std/cstdlib
@@ -169,9 +169,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
abs(long long __x) { return __builtin_llabs (__x); }
#endif
-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
- inline __int128
- abs(__int128 __x) { return __x >= 0 ? __x : -__x; }
+#if defined(__GLIBCXX_TYPE_INT_N_0)
+ inline __GLIBCXX_TYPE_INT_N_0
+ abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_1)
+ inline __GLIBCXX_TYPE_INT_N_1
+ abs(__GLIBCXX_TYPE_INT_N_1 __x) { return __x >= 0 ? __x : -__x; }
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_2)
+ inline __GLIBCXX_TYPE_INT_N_2
+ abs(__GLIBCXX_TYPE_INT_N_2 __x) { return __x >= 0 ? __x : -__x; }
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_3)
+ inline __GLIBCXX_TYPE_INT_N_3
+ abs(__GLIBCXX_TYPE_INT_N_3 __x) { return __x >= 0 ? __x : -__x; }
#endif
inline ldiv_t
diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits
index f39821eb365..d5add09655a 100644
--- a/libstdc++-v3/include/std/limits
+++ b/libstdc++-v3/include/std/limits
@@ -125,21 +125,32 @@
// You should not need to define any macros below this point.
-#define __glibcxx_signed(T) ((T)(-1) < 0)
+#define __glibcxx_signed_b(T,B) ((T)(-1) < 0)
-#define __glibcxx_min(T) \
- (__glibcxx_signed (T) ? -__glibcxx_max (T) - 1 : (T)0)
+#define __glibcxx_min_b(T,B) \
+ (__glibcxx_signed_b (T,B) ? -__glibcxx_max_b (T,B) - 1 : (T)0)
-#define __glibcxx_max(T) \
- (__glibcxx_signed (T) ? \
- (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0)
+#define __glibcxx_max_b(T,B) \
+ (__glibcxx_signed_b (T,B) ? \
+ (((((T)1 << (__glibcxx_digits_b (T,B) - 1)) - 1) << 1) + 1) : ~(T)0)
-#define __glibcxx_digits(T) \
- (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))
+#define __glibcxx_digits_b(T,B) \
+ (B - __glibcxx_signed_b (T,B))
// The fraction 643/2136 approximates log10(2) to 7 significant digits.
+#define __glibcxx_digits10_b(T,B) \
+ (__glibcxx_digits_b (T,B) * 643L / 2136)
+
+#define __glibcxx_signed(T) \
+ __glibcxx_signed_b (T, sizeof(T) * __CHAR_BIT__)
+#define __glibcxx_min(T) \
+ __glibcxx_min_b (T, sizeof(T) * __CHAR_BIT__)
+#define __glibcxx_max(T) \
+ __glibcxx_max_b (T, sizeof(T) * __CHAR_BIT__)
+#define __glibcxx_digits(T) \
+ __glibcxx_digits_b (T, sizeof(T) * __CHAR_BIT__)
#define __glibcxx_digits10(T) \
- (__glibcxx_digits (T) * 643L / 2136)
+ __glibcxx_digits10_b (T, sizeof(T) * __CHAR_BIT__)
#define __glibcxx_max_digits10(T) \
(2 + (T) * 643L / 2136)
@@ -1399,153 +1410,181 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
= round_toward_zero;
};
-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
- /// numeric_limits<__int128> specialization.
- template<>
- struct numeric_limits<__int128>
- {
- static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
-
- static _GLIBCXX_CONSTEXPR __int128
- min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min (__int128); }
-
- static _GLIBCXX_CONSTEXPR __int128
- max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (__int128); }
+#if !defined(__STRICT_ANSI__)
+
+#define __INT_N(TYPE, BITSIZE, EXT, UEXT) \
+ template<> \
+ struct numeric_limits<TYPE> \
+ { \
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \
+ \
+ static _GLIBCXX_CONSTEXPR TYPE \
+ min() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_min_b (TYPE, BITSIZE); } \
+ \
+ static _GLIBCXX_CONSTEXPR TYPE \
+ max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE);; } \
+ \
+ static _GLIBCXX_USE_CONSTEXPR int digits \
+ = BITSIZE - 1; \
+ static _GLIBCXX_USE_CONSTEXPR int digits10 \
+ = (BITSIZE - 1) * 643L / 2136; \
+ \
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = true; \
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2; \
+ \
+ static _GLIBCXX_CONSTEXPR TYPE \
+ epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \
+ \
+ static _GLIBCXX_CONSTEXPR TYPE \
+ round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \
+ \
+ EXT \
+ \
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \
+ \
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \
+ = denorm_absent; \
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \
+ \
+ static _GLIBCXX_CONSTEXPR TYPE \
+ infinity() _GLIBCXX_USE_NOEXCEPT \
+ { return static_cast<TYPE>(0); } \
+ \
+ static _GLIBCXX_CONSTEXPR TYPE \
+ quiet_NaN() _GLIBCXX_USE_NOEXCEPT \
+ { return static_cast<TYPE>(0); } \
+ \
+ static _GLIBCXX_CONSTEXPR TYPE \
+ signaling_NaN() _GLIBCXX_USE_NOEXCEPT \
+ { return static_cast<TYPE>(0); } \
+ \
+ static _GLIBCXX_CONSTEXPR TYPE \
+ denorm_min() _GLIBCXX_USE_NOEXCEPT \
+ { return static_cast<TYPE>(0); } \
+ \
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false; \
+ \
+ static _GLIBCXX_USE_CONSTEXPR bool traps \
+ = __glibcxx_integral_traps; \
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \
+ = round_toward_zero; \
+ }; \
+ \
+ template<> \
+ struct numeric_limits<unsigned TYPE> \
+ { \
+ static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true; \
+ \
+ static _GLIBCXX_CONSTEXPR unsigned TYPE \
+ min() _GLIBCXX_USE_NOEXCEPT { return 0; } \
+ \
+ static _GLIBCXX_CONSTEXPR unsigned TYPE \
+ max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max_b (TYPE, BITSIZE); } \
+ \
+ UEXT \
+ \
+ static _GLIBCXX_USE_CONSTEXPR int digits \
+ = BITSIZE; \
+ static _GLIBCXX_USE_CONSTEXPR int digits10 \
+ = BITSIZE * 643L / 2136; \
+ static _GLIBCXX_USE_CONSTEXPR bool is_signed = false; \
+ static _GLIBCXX_USE_CONSTEXPR bool is_integer = true; \
+ static _GLIBCXX_USE_CONSTEXPR bool is_exact = true; \
+ static _GLIBCXX_USE_CONSTEXPR int radix = 2; \
+ \
+ static _GLIBCXX_CONSTEXPR unsigned TYPE \
+ epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; } \
+ \
+ static _GLIBCXX_CONSTEXPR unsigned TYPE \
+ round_error() _GLIBCXX_USE_NOEXCEPT { return 0; } \
+ \
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0; \
+ static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0; \
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0; \
+ static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0; \
+ \
+ static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false; \
+ static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false; \
+ static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false; \
+ static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm \
+ = denorm_absent; \
+ static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false; \
+ \
+ static _GLIBCXX_CONSTEXPR unsigned TYPE \
+ infinity() _GLIBCXX_USE_NOEXCEPT \
+ { return static_cast<unsigned TYPE>(0); } \
+ \
+ static _GLIBCXX_CONSTEXPR unsigned TYPE \
+ quiet_NaN() _GLIBCXX_USE_NOEXCEPT \
+ { return static_cast<unsigned TYPE>(0); } \
+ \
+ static _GLIBCXX_CONSTEXPR unsigned TYPE \
+ signaling_NaN() _GLIBCXX_USE_NOEXCEPT \
+ { return static_cast<unsigned TYPE>(0); } \
+ \
+ static _GLIBCXX_CONSTEXPR unsigned TYPE \
+ denorm_min() _GLIBCXX_USE_NOEXCEPT \
+ { return static_cast<unsigned TYPE>(0); } \
+ \
+ static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false; \
+ static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true; \
+ static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true; \
+ \
+ static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps; \
+ static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false; \
+ static _GLIBCXX_USE_CONSTEXPR float_round_style round_style \
+ = round_toward_zero; \
+ };
#if __cplusplus >= 201103L
- static constexpr __int128
- lowest() noexcept { return min(); }
-#endif
- static _GLIBCXX_USE_CONSTEXPR int digits
- = __glibcxx_digits (__int128);
- static _GLIBCXX_USE_CONSTEXPR int digits10
- = __glibcxx_digits10 (__int128);
-#if __cplusplus >= 201103L
+#define __INT_N_201103(TYPE) \
+ static constexpr TYPE \
+ lowest() noexcept { return min(); } \
static constexpr int max_digits10 = 0;
-#endif
- static _GLIBCXX_USE_CONSTEXPR bool is_signed = true;
- static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
- static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
- static _GLIBCXX_USE_CONSTEXPR int radix = 2;
-
- static _GLIBCXX_CONSTEXPR __int128
- epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
-
- static _GLIBCXX_CONSTEXPR __int128
- round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
-
- static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
- static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
- static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
- static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
-
- static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
- static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
- static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
- static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
- = denorm_absent;
- static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
-
- static _GLIBCXX_CONSTEXPR __int128
- infinity() _GLIBCXX_USE_NOEXCEPT
- { return static_cast<__int128>(0); }
-
- static _GLIBCXX_CONSTEXPR __int128
- quiet_NaN() _GLIBCXX_USE_NOEXCEPT
- { return static_cast<__int128>(0); }
-
- static _GLIBCXX_CONSTEXPR __int128
- signaling_NaN() _GLIBCXX_USE_NOEXCEPT
- { return static_cast<__int128>(0); }
-
- static _GLIBCXX_CONSTEXPR __int128
- denorm_min() _GLIBCXX_USE_NOEXCEPT
- { return static_cast<__int128>(0); }
-
- static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
- static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
- static _GLIBCXX_USE_CONSTEXPR bool is_modulo = false;
-
- static _GLIBCXX_USE_CONSTEXPR bool traps
- = __glibcxx_integral_traps;
- static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
- static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
- = round_toward_zero;
- };
-
- /// numeric_limits<unsigned __int128> specialization.
- template<>
- struct numeric_limits<unsigned __int128>
- {
- static _GLIBCXX_USE_CONSTEXPR bool is_specialized = true;
-
- static _GLIBCXX_CONSTEXPR unsigned __int128
- min() _GLIBCXX_USE_NOEXCEPT { return 0; }
- static _GLIBCXX_CONSTEXPR unsigned __int128
- max() _GLIBCXX_USE_NOEXCEPT { return __glibcxx_max (unsigned __int128); }
+#define __INT_N_U201103(TYPE) \
+ static constexpr unsigned TYPE \
+ lowest() noexcept { return min(); } \
+ static constexpr int max_digits10 = 0;
-#if __cplusplus >= 201103L
- static constexpr unsigned __int128
- lowest() noexcept { return min(); }
+#else
+#define __INT_N_201103(TYPE)
+#define __INT_N_U201103(TYPE)
#endif
- static _GLIBCXX_USE_CONSTEXPR int digits
- = __glibcxx_digits (unsigned __int128);
- static _GLIBCXX_USE_CONSTEXPR int digits10
- = __glibcxx_digits10 (unsigned __int128);
-#if __cplusplus >= 201103L
- static constexpr int max_digits10 = 0;
+#ifdef __GLIBCXX_TYPE_INT_N_0
+ __INT_N(__GLIBCXX_TYPE_INT_N_0, __GLIBCXX_BITSIZE_INT_N_0,
+ __INT_N_201103 (__GLIBCXX_TYPE_INT_N_0), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_0))
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_1
+ __INT_N (__GLIBCXX_TYPE_INT_N_1, __GLIBCXX_BITSIZE_INT_N_1,
+ __INT_N_201103 (__GLIBCXX_TYPE_INT_N_1), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_1))
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_2
+ __INT_N (__GLIBCXX_TYPE_INT_N_2, __GLIBCXX_BITSIZE_INT_N_2,
+ __INT_N_201103 (__GLIBCXX_TYPE_INT_N_2), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_2))
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_3
+ __INT_N (__GLIBCXX_TYPE_INT_N_3, __GLIBCXX_BITSIZE_INT_N_3,
+ __INT_N_201103 (__GLIBCXX_TYPE_INT_N_3), __INT_N_U201103 (__GLIBCXX_TYPE_INT_N_3))
#endif
- static _GLIBCXX_USE_CONSTEXPR bool is_signed = false;
- static _GLIBCXX_USE_CONSTEXPR bool is_integer = true;
- static _GLIBCXX_USE_CONSTEXPR bool is_exact = true;
- static _GLIBCXX_USE_CONSTEXPR int radix = 2;
-
- static _GLIBCXX_CONSTEXPR unsigned __int128
- epsilon() _GLIBCXX_USE_NOEXCEPT { return 0; }
-
- static _GLIBCXX_CONSTEXPR unsigned __int128
- round_error() _GLIBCXX_USE_NOEXCEPT { return 0; }
-
- static _GLIBCXX_USE_CONSTEXPR int min_exponent = 0;
- static _GLIBCXX_USE_CONSTEXPR int min_exponent10 = 0;
- static _GLIBCXX_USE_CONSTEXPR int max_exponent = 0;
- static _GLIBCXX_USE_CONSTEXPR int max_exponent10 = 0;
-
- static _GLIBCXX_USE_CONSTEXPR bool has_infinity = false;
- static _GLIBCXX_USE_CONSTEXPR bool has_quiet_NaN = false;
- static _GLIBCXX_USE_CONSTEXPR bool has_signaling_NaN = false;
- static _GLIBCXX_USE_CONSTEXPR float_denorm_style has_denorm
- = denorm_absent;
- static _GLIBCXX_USE_CONSTEXPR bool has_denorm_loss = false;
-
- static _GLIBCXX_CONSTEXPR unsigned __int128
- infinity() _GLIBCXX_USE_NOEXCEPT
- { return static_cast<unsigned __int128>(0); }
-
- static _GLIBCXX_CONSTEXPR unsigned __int128
- quiet_NaN() _GLIBCXX_USE_NOEXCEPT
- { return static_cast<unsigned __int128>(0); }
-
- static _GLIBCXX_CONSTEXPR unsigned __int128
- signaling_NaN() _GLIBCXX_USE_NOEXCEPT
- { return static_cast<unsigned __int128>(0); }
-
- static _GLIBCXX_CONSTEXPR unsigned __int128
- denorm_min() _GLIBCXX_USE_NOEXCEPT
- { return static_cast<unsigned __int128>(0); }
- static _GLIBCXX_USE_CONSTEXPR bool is_iec559 = false;
- static _GLIBCXX_USE_CONSTEXPR bool is_bounded = true;
- static _GLIBCXX_USE_CONSTEXPR bool is_modulo = true;
+#undef __INT_N
+#undef __INT_N_201103
+#undef __INT_N_U201103
- static _GLIBCXX_USE_CONSTEXPR bool traps = __glibcxx_integral_traps;
- static _GLIBCXX_USE_CONSTEXPR bool tinyness_before = false;
- static _GLIBCXX_USE_CONSTEXPR float_round_style round_style
- = round_toward_zero;
- };
#endif
/// numeric_limits<float> specialization.
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index d776efeb68d..b92bbf09287 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -242,13 +242,42 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __is_integral_helper<unsigned long long>
: public true_type { };
-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
+ // Conditionalizing on __STRICT_ANSI__ here will break any port that
+ // uses one of these types for size_t.
+#if defined(__GLIBCXX_TYPE_INT_N_0)
template<>
- struct __is_integral_helper<__int128>
+ struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0>
: public true_type { };
template<>
- struct __is_integral_helper<unsigned __int128>
+ struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_0>
+ : public true_type { };
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_1)
+ template<>
+ struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_1>
+ : public true_type { };
+
+ template<>
+ struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_1>
+ : public true_type { };
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_2)
+ template<>
+ struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_2>
+ : public true_type { };
+
+ template<>
+ struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_2>
+ : public true_type { };
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_3)
+ template<>
+ struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_3>
+ : public true_type { };
+
+ template<>
+ struct __is_integral_helper<unsigned __GLIBCXX_TYPE_INT_N_3>
: public true_type { };
#endif
@@ -1661,10 +1690,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
#endif
-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
+#if defined(__GLIBCXX_TYPE_INT_N_0)
+ template<>
+ struct __make_unsigned<__GLIBCXX_TYPE_INT_N_0>
+ { typedef unsigned __GLIBCXX_TYPE_INT_N_0 __type; };
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_1)
+ template<>
+ struct __make_unsigned<__GLIBCXX_TYPE_INT_N_1>
+ { typedef unsigned __GLIBCXX_TYPE_INT_N_1 __type; };
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_2)
template<>
- struct __make_unsigned<__int128>
- { typedef unsigned __int128 __type; };
+ struct __make_unsigned<__GLIBCXX_TYPE_INT_N_2>
+ { typedef unsigned __GLIBCXX_TYPE_INT_N_2 __type; };
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_3)
+ template<>
+ struct __make_unsigned<__GLIBCXX_TYPE_INT_N_3>
+ { typedef unsigned __GLIBCXX_TYPE_INT_N_3 __type; };
#endif
// Select between integral and enum: not possible to be both.
@@ -1758,10 +1802,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
#endif
-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
+#if defined(__GLIBCXX_TYPE_INT_N_0)
+ template<>
+ struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_0>
+ { typedef __GLIBCXX_TYPE_INT_N_0 __type; };
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_1)
+ template<>
+ struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_1>
+ { typedef __GLIBCXX_TYPE_INT_N_1 __type; };
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_2)
+ template<>
+ struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_2>
+ { typedef __GLIBCXX_TYPE_INT_N_2 __type; };
+#endif
+#if defined(__GLIBCXX_TYPE_INT_N_3)
template<>
- struct __make_signed<unsigned __int128>
- { typedef __int128 __type; };
+ struct __make_signed<unsigned __GLIBCXX_TYPE_INT_N_3>
+ { typedef __GLIBCXX_TYPE_INT_N_3 __type; };
#endif
// Select between integral and enum: not possible to be both.
diff --git a/libstdc++-v3/src/c++11/limits.cc b/libstdc++-v3/src/c++11/limits.cc
index 73335e7dc2b..5cb2b0edf0f 100644
--- a/libstdc++-v3/src/c++11/limits.cc
+++ b/libstdc++-v3/src/c++11/limits.cc
@@ -388,54 +388,66 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const bool numeric_limits<unsigned long long>::tinyness_before;
const float_round_style numeric_limits<unsigned long long>::round_style;
-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_INT128)
- const bool numeric_limits<__int128>::is_specialized;
- const int numeric_limits<__int128>::digits;
- const int numeric_limits<__int128>::digits10;
- const int numeric_limits<__int128>::max_digits10;
- const bool numeric_limits<__int128>::is_signed;
- const bool numeric_limits<__int128>::is_integer;
- const bool numeric_limits<__int128>::is_exact;
- const int numeric_limits<__int128>::radix;
- const int numeric_limits<__int128>::min_exponent;
- const int numeric_limits<__int128>::min_exponent10;
- const int numeric_limits<__int128>::max_exponent;
- const int numeric_limits<__int128>::max_exponent10;
- const bool numeric_limits<__int128>::has_infinity;
- const bool numeric_limits<__int128>::has_quiet_NaN;
- const bool numeric_limits<__int128>::has_signaling_NaN;
- const float_denorm_style numeric_limits<__int128>::has_denorm;
- const bool numeric_limits<__int128>::has_denorm_loss;
- const bool numeric_limits<__int128>::is_iec559;
- const bool numeric_limits<__int128>::is_bounded;
- const bool numeric_limits<__int128>::is_modulo;
- const bool numeric_limits<__int128>::traps;
- const bool numeric_limits<__int128>::tinyness_before;
- const float_round_style numeric_limits<__int128>::round_style;
-
- const bool numeric_limits<unsigned __int128>::is_specialized;
- const int numeric_limits<unsigned __int128>::digits;
- const int numeric_limits<unsigned __int128>::digits10;
- const int numeric_limits<unsigned __int128>::max_digits10;
- const bool numeric_limits<unsigned __int128>::is_signed;
- const bool numeric_limits<unsigned __int128>::is_integer;
- const bool numeric_limits<unsigned __int128>::is_exact;
- const int numeric_limits<unsigned __int128>::radix;
- const int numeric_limits<unsigned __int128>::min_exponent;
- const int numeric_limits<unsigned __int128>::min_exponent10;
- const int numeric_limits<unsigned __int128>::max_exponent;
- const int numeric_limits<unsigned __int128>::max_exponent10;
- const bool numeric_limits<unsigned __int128>::has_infinity;
- const bool numeric_limits<unsigned __int128>::has_quiet_NaN;
- const bool numeric_limits<unsigned __int128>::has_signaling_NaN;
- const float_denorm_style numeric_limits<unsigned __int128>::has_denorm;
- const bool numeric_limits<unsigned __int128>::has_denorm_loss;
- const bool numeric_limits<unsigned __int128>::is_iec559;
- const bool numeric_limits<unsigned __int128>::is_bounded;
- const bool numeric_limits<unsigned __int128>::is_modulo;
- const bool numeric_limits<unsigned __int128>::traps;
- const bool numeric_limits<unsigned __int128>::tinyness_before;
- const float_round_style numeric_limits<unsigned __int128>::round_style;
+#define INT_N(__INT_N_TYPE) \
+ const bool numeric_limits<__INT_N_TYPE>::is_specialized; \
+ const int numeric_limits<__INT_N_TYPE>::digits; \
+ const int numeric_limits<__INT_N_TYPE>::digits10; \
+ const int numeric_limits<__INT_N_TYPE>::max_digits10; \
+ const bool numeric_limits<__INT_N_TYPE>::is_signed; \
+ const bool numeric_limits<__INT_N_TYPE>::is_integer; \
+ const bool numeric_limits<__INT_N_TYPE>::is_exact; \
+ const int numeric_limits<__INT_N_TYPE>::radix; \
+ const int numeric_limits<__INT_N_TYPE>::min_exponent; \
+ const int numeric_limits<__INT_N_TYPE>::min_exponent10; \
+ const int numeric_limits<__INT_N_TYPE>::max_exponent; \
+ const int numeric_limits<__INT_N_TYPE>::max_exponent10; \
+ const bool numeric_limits<__INT_N_TYPE>::has_infinity; \
+ const bool numeric_limits<__INT_N_TYPE>::has_quiet_NaN; \
+ const bool numeric_limits<__INT_N_TYPE>::has_signaling_NaN; \
+ const float_denorm_style numeric_limits<__INT_N_TYPE>::has_denorm; \
+ const bool numeric_limits<__INT_N_TYPE>::has_denorm_loss; \
+ const bool numeric_limits<__INT_N_TYPE>::is_iec559; \
+ const bool numeric_limits<__INT_N_TYPE>::is_bounded; \
+ const bool numeric_limits<__INT_N_TYPE>::is_modulo; \
+ const bool numeric_limits<__INT_N_TYPE>::traps; \
+ const bool numeric_limits<__INT_N_TYPE>::tinyness_before; \
+ const float_round_style numeric_limits<__INT_N_TYPE>::round_style; \
+ \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::is_specialized; \
+ const int numeric_limits<unsigned __INT_N_TYPE>::digits; \
+ const int numeric_limits<unsigned __INT_N_TYPE>::digits10; \
+ const int numeric_limits<unsigned __INT_N_TYPE>::max_digits10; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::is_signed; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::is_integer; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::is_exact; \
+ const int numeric_limits<unsigned __INT_N_TYPE>::radix; \
+ const int numeric_limits<unsigned __INT_N_TYPE>::min_exponent; \
+ const int numeric_limits<unsigned __INT_N_TYPE>::min_exponent10; \
+ const int numeric_limits<unsigned __INT_N_TYPE>::max_exponent; \
+ const int numeric_limits<unsigned __INT_N_TYPE>::max_exponent10; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::has_infinity; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::has_quiet_NaN; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::has_signaling_NaN; \
+ const float_denorm_style numeric_limits<unsigned __INT_N_TYPE>::has_denorm; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::has_denorm_loss; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::is_iec559; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::is_bounded; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::is_modulo; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::traps; \
+ const bool numeric_limits<unsigned __INT_N_TYPE>::tinyness_before; \
+ const float_round_style numeric_limits<unsigned __INT_N_TYPE>::round_style;
+
+#ifdef __GLIBCXX_TYPE_INT_N_0
+ INT_N (__GLIBCXX_TYPE_INT_N_0)
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_1
+ INT_N (__GLIBCXX_TYPE_INT_N_1)
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_2
+ INT_N (__GLIBCXX_TYPE_INT_N_2)
+#endif
+#ifdef __GLIBCXX_TYPE_INT_N_3
+ INT_N (__GLIBCXX_TYPE_INT_N_3)
#endif
// float