aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-decl.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2014-10-14 15:44:36 -0400
committerDJ Delorie <dj@gcc.gnu.org>2014-10-14 15:44:36 -0400
commit78a7c3172fe2e6cd959abb8bfc69f6b0dc747d49 (patch)
treee12f293c8d0e0b83e0dc6b0b250a64fb5d4bcd50 /gcc/c/c-decl.c
parentdf3e34938d9b38a0906a8ebf491f8b73bda5346d (diff)
downloadgcc-78a7c3172fe2e6cd959abb8bfc69f6b0dc747d49.zip
gcc-78a7c3172fe2e6cd959abb8bfc69f6b0dc747d49.tar.gz
gcc-78a7c3172fe2e6cd959abb8bfc69f6b0dc747d49.tar.bz2
machmode.h (int_n_data_t): New.
* 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. From-SVN: r216220
Diffstat (limited to 'gcc/c/c-decl.c')
-rw-r--r--gcc/c/c-decl.c69
1 files changed, 41 insertions, 28 deletions
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index e23284a..2900c71 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -9369,10 +9369,11 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
error_at (loc,
("both %<long%> and %<void%> in "
"declaration specifiers"));
- else if (specs->typespec_word == cts_int128)
+ else if (specs->typespec_word == cts_int_n)
error_at (loc,
- ("both %<long%> and %<__int128%> in "
- "declaration specifiers"));
+ ("both %<long%> and %<__int%d%> in "
+ "declaration specifiers"),
+ int_n_data[specs->int_n_idx].bitsize);
else if (specs->typespec_word == cts_bool)
error_at (loc,
("both %<long%> and %<_Bool%> in "
@@ -9417,10 +9418,11 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
error_at (loc,
("both %<short%> and %<void%> in "
"declaration specifiers"));
- else if (specs->typespec_word == cts_int128)
+ else if (specs->typespec_word == cts_int_n)
error_at (loc,
- ("both %<short%> and %<__int128%> in "
- "declaration specifiers"));
+ ("both %<short%> and %<__int%d%> in "
+ "declaration specifiers"),
+ int_n_data[specs->int_n_idx].bitsize);
else if (specs->typespec_word == cts_bool)
error_at (loc,
("both %<short%> and %<_Bool%> in "
@@ -9594,11 +9596,12 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
dupe = specs->saturating_p;
pedwarn (loc, OPT_Wpedantic,
"ISO C does not support saturating types");
- if (specs->typespec_word == cts_int128)
+ if (specs->typespec_word == cts_int_n)
{
error_at (loc,
- ("both %<_Sat%> and %<__int128%> in "
- "declaration specifiers"));
+ ("both %<_Sat%> and %<__int%d%> in "
+ "declaration specifiers"),
+ int_n_data[specs->int_n_idx].bitsize);
}
else if (specs->typespec_word == cts_auto_type)
error_at (loc,
@@ -9662,7 +9665,7 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
else
{
/* "void", "_Bool", "char", "int", "float", "double", "_Decimal32",
- "__int128", "_Decimal64", "_Decimal128", "_Fract", "_Accum" or
+ "__intN", "_Decimal64", "_Decimal128", "_Fract", "_Accum" or
"__auto_type". */
if (specs->typespec_word != cts_none)
{
@@ -9703,31 +9706,41 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs,
specs->locations[cdw_typespec] = loc;
}
return specs;
- case RID_INT128:
- if (int128_integer_type_node == NULL_TREE)
- {
- error_at (loc, "%<__int128%> is not supported for this target");
- return specs;
- }
- if (!in_system_header_at (input_location))
+ case RID_INT_N_0:
+ case RID_INT_N_1:
+ case RID_INT_N_2:
+ case RID_INT_N_3:
+ specs->int_n_idx = i - RID_INT_N_0;
+ if (!in_system_header_at (input_location)
+ /* As a special exception, allow a type that's used
+ for __SIZE_TYPE__. */
+ && int_n_data[specs->int_n_idx].bitsize != POINTER_SIZE)
pedwarn (loc, OPT_Wpedantic,
- "ISO C does not support %<__int128%> type");
+ "ISO C does not support %<__int%d%> types",
+ int_n_data[specs->int_n_idx].bitsize);
if (specs->long_p)
error_at (loc,
- ("both %<__int128%> and %<long%> in "
- "declaration specifiers"));
+ ("both %<__int%d%> and %<long%> in "
+ "declaration specifiers"),
+ int_n_data[specs->int_n_idx].bitsize);
else if (specs->saturating_p)
error_at (loc,
- ("both %<_Sat%> and %<__int128%> in "
- "declaration specifiers"));
+ ("both %<_Sat%> and %<__int%d%> in "
+ "declaration specifiers"),
+ int_n_data[specs->int_n_idx].bitsize);
else if (specs->short_p)
error_at (loc,
- ("both %<__int128%> and %<short%> in "
- "declaration specifiers"));
+ ("both %<__int%d%> and %<short%> in "
+ "declaration specifiers"),
+ int_n_data[specs->int_n_idx].bitsize);
+ else if (! int_n_enabled_p [specs->int_n_idx])
+ error_at (loc,
+ "%<__int%d%> is not supported on this target",
+ int_n_data[specs->int_n_idx].bitsize);
else
{
- specs->typespec_word = cts_int128;
+ specs->typespec_word = cts_int_n;
specs->locations[cdw_typespec] = loc;
}
return specs;
@@ -10295,12 +10308,12 @@ finish_declspecs (struct c_declspecs *specs)
specs->type = build_complex_type (specs->type);
}
break;
- case cts_int128:
+ case cts_int_n:
gcc_assert (!specs->long_p && !specs->short_p && !specs->long_long_p);
gcc_assert (!(specs->signed_p && specs->unsigned_p));
specs->type = (specs->unsigned_p
- ? int128_unsigned_type_node
- : int128_integer_type_node);
+ ? int_n_trees[specs->int_n_idx].unsigned_type
+ : int_n_trees[specs->int_n_idx].signed_type);
if (specs->complex_p)
{
pedwarn (specs->locations[cdw_complex], OPT_Wpedantic,