diff options
author | Jason Merrill <jason@redhat.com> | 2015-11-28 16:39:30 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-11-28 16:39:30 +0000 |
commit | e9a3881624886dc523a500a86bfdac6dc58fd0db (patch) | |
tree | 76cce0073d02e52d1c84ae6e08612e7411a72576 /libiberty | |
parent | d81bf7ddc2ad497037fbfde5d15cfa8d81a9e959 (diff) | |
download | gdb-e9a3881624886dc523a500a86bfdac6dc58fd0db.zip gdb-e9a3881624886dc523a500a86bfdac6dc58fd0db.tar.gz gdb-e9a3881624886dc523a500a86bfdac6dc58fd0db.tar.bz2 |
Implement N4514, C++ Extensions for Transactional Memory.
gcc/
* builtins.def (BUILT_IN_ABORT): Add transaction_pure attribute.
gcc/c-family/
* c-common.c (c_common_reswords): Add C++ TM TS keywords.
(c_common_attribute_table): Add transaction_safe_dynamic.
transaction_safe now affects type identity.
(handle_tm_attribute): Handle transaction_safe_dynamic.
* c-common.h (enum rid): Add RID_ATOMIC_NOEXCEPT,
RID_ATOMIC_CANCEL, RID_SYNCHRONIZED.
(OBJC_IS_CXX_KEYWORD): Add RID_SYNCHRONIZED.
(D_TRANSMEM): New.
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_transactional_memory.
* c-pretty-print.c (pp_c_attributes_display): Don't print
transaction_safe in C++.
gcc/c/
* c-parser.c (c_lex_one_token): Handle @synchronized.
* c-decl.c (match_builtin_function_types): A declaration of a built-in
can change whether the function is transaction_safe.
gcc/cp/
* cp-tree.h (struct cp_declarator): Add tx_qualifier field.
(BCS_NORMAL, BCS_TRANSACTION): New enumerators.
* lex.c (init_reswords): Limit TM kewords to -fgnu-tm.
* parser.c (cp_lexer_get_preprocessor_token): Fix @synchronized.
(make_call_declarator): Take tx_qualifier.
(cp_parser_tx_qualifier_opt): New.
(cp_parser_lambda_declarator_opt): Use it.
(cp_parser_direct_declarator): Likewise.
(cp_parser_statement): Handle atomic_noexcept, atomic_cancel.
(cp_parser_compound_statement): Change in_try parameter to bcs_flags.
(cp_parser_std_attribute): Map optimize_for_synchronized to
transaction_callable.
(cp_parser_transaction): Take the token. Handle atomic_noexcept.
* lambda.c (maybe_add_lambda_conv_op): Handle transaction-safety.
* call.c (enum conversion_kind): Add ck_tsafe.
(standard_conversion): Handle transaction-safety conversion.
(convert_like_real, resolve_address_of_overloaded_function): Likewise.
(check_methods): Diagnose transaction_safe_dynamic on non-virtual
function.
(look_for_tm_attr_overrides): Don't inherit transaction_safe_dynamic.
* cvt.c (tx_safe_fn_type_p, tx_unsafe_fn_variant)
(can_convert_tx_safety): New.
* typeck.c (composite_pointer_type): Handle transaction-safety.
* name-lookup.h (enum scope_kind): Add sk_transaction.
* name-lookup.c (begin_scope): Handle it.
* semantics.c (begin_compound_stmt): Pass it.
* decl.c (check_previous_goto_1): Check it.
(struct named_label_entry): Add in_transaction_scope.
(poplevel_named_label_1): Set it.
(check_goto): Check it.
(duplicate_decls): A specialization can be transaction_safe
independently of its template.
(grokdeclarator): Handle tx-qualifier.
* rtti.c (ptr_initializer): Handle transaction-safe.
* search.c (check_final_overrider): Check transaction_safe_dynamic.
Don't check transaction_safe.
* mangle.c (write_function_type): Mangle transaction_safe here.
(write_CV_qualifiers_for_type): Not here.
(write_type): Preserve transaction_safe when stripping attributes.
* error.c (dump_type_suffix): Print transaction_safe.
libiberty/
* cp-demangle.c (d_cv_qualifiers): Dx means transaction_safe.
(cplus_demangle_type): Let d_cv_qualifiers handle it.
(d_dump, d_make_comp, has_return_type, d_encoding)
(d_count_templates_scopes, d_print_comp_inner)
(d_print_mod_list, d_print_mod, d_print_function_type)
(is_ctor_or_dtor): Handle DEMANGLE_COMPONENT_TRANSACTION_SAFE.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228462 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 9 | ||||
-rw-r--r-- | libiberty/cp-demangle.c | 36 | ||||
-rw-r--r-- | libiberty/testsuite/demangle-expected | 3 |
3 files changed, 43 insertions, 5 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 985e4ae..3cd0374 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -32,6 +32,15 @@ Android hosts. * configure: Regenerate. +2015-09-30 Jason Merrill <jason@redhat.com> + + * cp-demangle.c (d_cv_qualifiers): Dx means transaction_safe. + (cplus_demangle_type): Let d_cv_qualifiers handle it. + (d_dump, d_make_comp, has_return_type, d_encoding) + (d_count_templates_scopes, d_print_comp_inner) + (d_print_mod_list, d_print_mod, d_print_function_type) + (is_ctor_or_dtor): Handle DEMANGLE_COMPONENT_TRANSACTION_SAFE. + 2015-09-30 Nick Clifton <nickc@redhat.com> Import the following patches from the GCC mainline: diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index c587895..ff608a3 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -686,6 +686,9 @@ d_dump (struct demangle_component *dc, int indent) case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS: printf ("rvalue reference this\n"); break; + case DEMANGLE_COMPONENT_TRANSACTION_SAFE: + printf ("transaction_safe this\n"); + break; case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL: printf ("vendor type qualifier\n"); break; @@ -970,6 +973,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, case DEMANGLE_COMPONENT_RESTRICT_THIS: case DEMANGLE_COMPONENT_VOLATILE_THIS: case DEMANGLE_COMPONENT_CONST_THIS: + case DEMANGLE_COMPONENT_TRANSACTION_SAFE: case DEMANGLE_COMPONENT_REFERENCE_THIS: case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS: case DEMANGLE_COMPONENT_ARGLIST: @@ -1212,6 +1216,7 @@ has_return_type (struct demangle_component *dc) case DEMANGLE_COMPONENT_CONST_THIS: case DEMANGLE_COMPONENT_REFERENCE_THIS: case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS: + case DEMANGLE_COMPONENT_TRANSACTION_SAFE: return has_return_type (d_left (dc)); } } @@ -1268,6 +1273,7 @@ d_encoding (struct d_info *di, int top_level) while (dc->type == DEMANGLE_COMPONENT_RESTRICT_THIS || dc->type == DEMANGLE_COMPONENT_VOLATILE_THIS || dc->type == DEMANGLE_COMPONENT_CONST_THIS + || dc->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE || dc->type == DEMANGLE_COMPONENT_REFERENCE_THIS || dc->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS) dc = d_left (dc); @@ -1284,6 +1290,7 @@ d_encoding (struct d_info *di, int top_level) while (dcr->type == DEMANGLE_COMPONENT_RESTRICT_THIS || dcr->type == DEMANGLE_COMPONENT_VOLATILE_THIS || dcr->type == DEMANGLE_COMPONENT_CONST_THIS + || dcr->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE || dcr->type == DEMANGLE_COMPONENT_REFERENCE_THIS || dcr->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS) dcr = d_left (dcr); @@ -2281,7 +2288,8 @@ cplus_demangle_type (struct d_info *di) names. */ peek = d_peek_char (di); - if (peek == 'r' || peek == 'V' || peek == 'K') + if (peek == 'r' || peek == 'V' || peek == 'K' + || (peek == 'D' && d_peek_next_char (di) == 'x')) { struct demangle_component **pret; @@ -2592,7 +2600,7 @@ cplus_demangle_type (struct d_info *di) return ret; } -/* <CV-qualifiers> ::= [r] [V] [K] */ +/* <CV-qualifiers> ::= [r] [V] [K] [Dx] */ static struct demangle_component ** d_cv_qualifiers (struct d_info *di, @@ -2603,7 +2611,8 @@ d_cv_qualifiers (struct d_info *di, pstart = pret; peek = d_peek_char (di); - while (peek == 'r' || peek == 'V' || peek == 'K') + while (peek == 'r' || peek == 'V' || peek == 'K' + || (peek == 'D' && d_peek_next_char (di) == 'x')) { enum demangle_component_type t; @@ -2622,13 +2631,19 @@ d_cv_qualifiers (struct d_info *di, : DEMANGLE_COMPONENT_VOLATILE); di->expansion += sizeof "volatile"; } - else + else if (peek == 'K') { t = (member_fn ? DEMANGLE_COMPONENT_CONST_THIS : DEMANGLE_COMPONENT_CONST); di->expansion += sizeof "const"; } + else + { + t = DEMANGLE_COMPONENT_TRANSACTION_SAFE; + di->expansion += sizeof "transaction_safe"; + d_advance (di, 1); + } *pret = d_make_comp (di, t, NULL, NULL); if (*pret == NULL) @@ -2694,7 +2709,7 @@ d_ref_qualifier (struct d_info *di, struct demangle_component *sub) return ret; } -/* <function-type> ::= F [Y] <bare-function-type> [<ref-qualifier>] E */ +/* <function-type> ::= F [Y] <bare-function-type> [<ref-qualifier>] [T] E */ static struct demangle_component * d_function_type (struct d_info *di) @@ -3899,6 +3914,7 @@ d_count_templates_scopes (int *num_templates, int *num_scopes, case DEMANGLE_COMPONENT_CONST_THIS: case DEMANGLE_COMPONENT_REFERENCE_THIS: case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS: + case DEMANGLE_COMPONENT_TRANSACTION_SAFE: case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL: case DEMANGLE_COMPONENT_POINTER: case DEMANGLE_COMPONENT_COMPLEX: @@ -4420,6 +4436,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options, && typed_name->type != DEMANGLE_COMPONENT_VOLATILE_THIS && typed_name->type != DEMANGLE_COMPONENT_CONST_THIS && typed_name->type != DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS + && typed_name->type != DEMANGLE_COMPONENT_TRANSACTION_SAFE && typed_name->type != DEMANGLE_COMPONENT_REFERENCE_THIS) break; @@ -4461,6 +4478,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options, || local_name->type == DEMANGLE_COMPONENT_VOLATILE_THIS || local_name->type == DEMANGLE_COMPONENT_CONST_THIS || local_name->type == DEMANGLE_COMPONENT_REFERENCE_THIS + || local_name->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE || (local_name->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS)) { @@ -4796,6 +4814,7 @@ d_print_comp_inner (struct d_print_info *dpi, int options, case DEMANGLE_COMPONENT_POINTER: case DEMANGLE_COMPONENT_COMPLEX: case DEMANGLE_COMPONENT_IMAGINARY: + case DEMANGLE_COMPONENT_TRANSACTION_SAFE: modifier: { /* We keep a list of modifiers on the stack. */ @@ -5484,6 +5503,7 @@ d_print_mod_list (struct d_print_info *dpi, int options, || mods->mod->type == DEMANGLE_COMPONENT_VOLATILE_THIS || mods->mod->type == DEMANGLE_COMPONENT_CONST_THIS || mods->mod->type == DEMANGLE_COMPONENT_REFERENCE_THIS + || mods->mod->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE || (mods->mod->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS)))) { @@ -5542,6 +5562,7 @@ d_print_mod_list (struct d_print_info *dpi, int options, || dc->type == DEMANGLE_COMPONENT_VOLATILE_THIS || dc->type == DEMANGLE_COMPONENT_CONST_THIS || dc->type == DEMANGLE_COMPONENT_REFERENCE_THIS + || dc->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE || dc->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS) dc = d_left (dc); @@ -5578,6 +5599,9 @@ d_print_mod (struct d_print_info *dpi, int options, case DEMANGLE_COMPONENT_CONST_THIS: d_append_string (dpi, " const"); return; + case DEMANGLE_COMPONENT_TRANSACTION_SAFE: + d_append_string (dpi, " transaction_safe"); + return; case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL: d_append_char (dpi, ' '); d_print_comp (dpi, options, d_right (mod)); @@ -5668,6 +5692,7 @@ d_print_function_type (struct d_print_info *dpi, int options, case DEMANGLE_COMPONENT_CONST_THIS: case DEMANGLE_COMPONENT_REFERENCE_THIS: case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS: + case DEMANGLE_COMPONENT_TRANSACTION_SAFE: break; default: break; @@ -6200,6 +6225,7 @@ is_ctor_or_dtor (const char *mangled, case DEMANGLE_COMPONENT_CONST_THIS: case DEMANGLE_COMPONENT_REFERENCE_THIS: case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS: + case DEMANGLE_COMPONENT_TRANSACTION_SAFE: default: dc = NULL; break; diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 5200cb3..041b113 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -4395,3 +4395,6 @@ void IndirectExternCall<void ( regparm<3> stdcall*)(int, int), int>(void ( regpa _ZNSt8ios_base7failureB5cxx11C1EPKcRKSt10error_code std::ios_base::failure[abi:cxx11]::failure(char const*, std::error_code const&) std::ios_base::failure[abi:cxx11]::failure +--format=gnu-v3 +_Z1fPDxFvvES0_ +f(void (*)() transaction_safe, void (*)() transaction_safe) |