(Adding libstdc++@ in Cc: so they see the patch at https://gcc.gnu.org/ml/gcc-patches/2014-06/msg01655.html )
On Sat, 21 Jun 2014, DJ Delorie wrote:
New version of https://gcc.gnu.org/ml/gcc-patches/2014-04/msg00723.html This is a big patch, but it includes all the features/changes/support requested since the initial patch. Tested with identical results before/after on x86-64 EXCEPT for g++.dg/ext/int128-1.C, which assumes __int128 is not supported with -std= but as per previous discussion, it now is (because __intN might be used for size_t, which is required). Tested on msp430 with significant improvements but a few regressions (expected). This patch replaces the current int128 support with a generic intN support, which happens to provide int128 as well as up to three additional intN types per target. I will post a separate patch for the msp430 backend demonstrating the use of this new feature for __int20, as well as a third to fix some problems with PSImode in general. The general idea is that genmodes has a new macro INT_N() for <tm>-modes.def, which gives the mode and precision to use for target-specific intN types. These types are always created, but the parser will error with "unsupported" if the target does not support that mode for that compile (i.e. because of command line switches, etc). There's an INT_N(TI,128) in the common sources. If the target defines any types larger than "long long", those types (like int128 before) will be used for type promotion, but types smaller than "long long" will not, to avoid confusing the C type promotion rules. Otherwise, it's up to the source being compiled to specific __intN types as desired.
Nice. A couple quick comments on the parts I understand while maintainers are resting for the week-end.
Index: libstdc++-v3/src/c++11/limits.cc ===================================================================
[...]
+#if !defined(__STRICT_ANSI__)
Since the test on __STRICT_ANSI__ is removed for all other uses, it would seem consistent to me to remove this one as well. Besides, you are already testing __GLIBCXX_USE_INT_N_0, which as far as I understand is protected by !flag_iso (with the exception of size_t).
-#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_USE_INT_N_0) template<> - struct __is_integral_helper<__int128> + struct __is_integral_helper<__GLIBCXX_TYPE_INT_N_0>
Since the check for __STRICT_ANSI__ is removed, do we need to add __extension__ in front of __GLIBCXX_TYPE_INT_N_0 to avoid warning with -Wsystem-headers?
--- gcc/cp/rtti.c (revision 211858) +++ gcc/cp/rtti.c (working copy) @@ -1506,31 +1506,44 @@ emit_support_tinfo_1 (tree bltn) void emit_support_tinfos (void) { /* Dummy static variable so we can put nullptr in the array; it will be set before we actually start to walk the array. */ - static tree *const fundamentals[] = + static tree * fundamentals[] = { &void_type_node, &boolean_type_node, &wchar_type_node, &char16_type_node, &char32_type_node, &char_type_node, &signed_char_type_node, &unsigned_char_type_node, &short_integer_type_node, &short_unsigned_type_node, &integer_type_node, &unsigned_type_node, &long_integer_type_node, &long_unsigned_type_node, &long_long_integer_type_node, &long_long_unsigned_type_node, - &int128_integer_type_node, &int128_unsigned_type_node, &float_type_node, &double_type_node, &long_double_type_node, &dfloat32_type_node, &dfloat64_type_node, &dfloat128_type_node, +#define FUND_INT_N_IDX 22 + // These eight are for intN_t nodes + &nullptr_type_node, &nullptr_type_node, &nullptr_type_node, &nullptr_type_node, + &nullptr_type_node, &nullptr_type_node, &nullptr_type_node, &nullptr_type_node, &nullptr_type_node, 0 }; - int ix; + int ix, i; tree bltn_type, dtor; + ix = FUND_INT_N_IDX; + for (i = 0; i < NUM_INT_N_ENTS; i ++) + if (int_n_enabled_p[i]) + { + fundamentals [ix++] = &int_n_trees[i].signed_type; + fundamentals [ix++] = &int_n_trees[i].unsigned_type; + } + fundamentals [ix++] = &nullptr_type_node; + fundamentals [ix++] = 0; + push_abi_namespace (); bltn_type = xref_tag (class_type, get_identifier ("__fundamental_type_info"), /*tag_scope=*/ts_current, false); pop_abi_namespace (); if (!COMPLETE_TYPE_P (bltn_type))
That seems complicated. You just need to call emit_support_tinfo_1 on each of the types (see how fundamentals is used at the end of the function), no need to put everything in the array. -- Marc Glisse