aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
AgeCommit message (Collapse)AuthorFilesLines
2017-10-11[PATCH] DECL_ASSEMBLER_NAME and friendsNathan Sidwell1-4/+4
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00582.html * tree.h (DECL_ASSEMBLER_NAME_RAW): New. (SET_DECL_ASSEMBLER_NAME): Use it. (DECL_ASSEMBLER_NAME_SET_P): Likewise. (COPY_DECL_ASSEMBLER_NAME): Likewise. * tree.c (decl_assembler_name): Use DECL_ASSEMBLER_NAME_RAW. lto/ * lto.c (mentions_vars_p_decl_with_vis): Use DECL_ASSEMBLER_NAME_RAW. (lto_fixup_prevailing_decls): Likewise. cp * decl2.c (struct mangled_decl_hash): Use DECL_ASSEMBLER_NAME_RAW. (record_mangling): Likewise. From-SVN: r253647
2017-10-10[C++ PATCH] Hash mangling aliasNathan Sidwell1-12/+40
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00618.html * decl2.c (struct mangled_decl_hash): New hash traits. (mangled_decls): Make hash_table<mangled_decl_hash>. (generate_mangling_alias, record_mangling): Adjust. From-SVN: r253608
2017-10-06re PR c++/47791 (finish function is using literal value instead of a ↵Paolo Carlini1-5/+5
#defined one) 2017-10-06 Paolo Carlini <paolo.carlini@oracle> PR c++/47791 * decl.c (finish_function): Take a bool intead of an int; adjust. * cp-tree.h (finish_function): Adjust declaration. * decl2.c (generate_tls_wrapper, finish_objects, finish_static_storage_duration_function): Adjust calls. * lambda.c (maybe_add_lambda_conv_op, finish_lambda_function): Likewise. * method.c (synthesize_method): Likewise. * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise. * pt.c (instantiate_decl): Likewise. * parser.c (cp_parser_function_definition_after_declarator, cp_parser_late_parsing_for_member, cp_parser_omp_declare_reduction): Likewise. (cp_parser_ctor_initializer_opt, cp_parser_ctor_initializer_opt_and_function_body, cp_parser_function_try_block, cp_parser_function_definition_after_declarator, cp_parser_function_transaction): Return void; adjust declarations. From-SVN: r253497
2017-10-05[C++ PATCH] Kill IDENTIFIER_GLOBAL_VALUENathan Sidwell1-8/+8
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00239.html Kill IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE * cp-tree.h (IDENTIFIER_GLOBAL_VALUE, SET_IDENTIFIER_GLOBAL_VALUE): Delete. * name-lookup.h (set_global_binding): Remove NAME parm. (get_global_binding): New inline fn. * name-lookup.c (set_global_binding): Remove NAME parm. Adjust. (identifier_global_value): Move to ... * cp-objcp-common.c (identifier_global_value): ... here. * class.c (build_ctor_vtbl_group, build_vtbl_initializer): Adjust. * decl.c (record_builtin_type, expand_static_init, grokdeclarator): Adjust. * decl2.c (get_guard, get_local_tls_init_fn, get_tls_init_fn, get_tls_wrapper_fn, maybe_warn_sized_delete): Adjust. * except.c (declare_library_fn, build_throw): Adjust. * init.c (throw_bad_array_length): Adjust. * rtti.c (throw_bad_cast, throw_bad_typeid, get_tinfo_decl): Adjust. From-SVN: r253444
2017-10-05Re: [C++ PATCH] Move mangling alias out of ::Nathan Sidwell1-4/+2
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00230.html * decl2.c (record_mangling): Fix spello and formatting from previous patch. From-SVN: r253440
2017-10-04[C++ PATCH] Move mangling alias out of ::Nathan Sidwell1-9/+66
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00199.html gcc/cp/ Move mangling aliases out of global namespace. * cp-tree.h (record_mangling): New. (maybe_remove_implicit_alias): Delete. * decl2.c (mangled_decls): New hash map. (generate_mangling_alias): Reimplement using mangled_decls. (record_mangling): New. * mangle.c (decl_implicit_alias_p, maybe_remove_implicit_alias): Delete. (mangle_decl): Use record_mangling. * name-lookup.c (supplement_binding_1): Remove maybe_remove_implicit_alias check. * call.c (convert_arg_to_ellipsis): Correct comment about passing by reference. gcc/testsuite/ * g++.dg/abi/mangle41.C: Adjust diagnostics. libcc1/ * libcp1plugin.cc (supplement_binding): Don't use maybe_remove_implicit_alias. From-SVN: r253421
2017-09-29P0683R1 - default member initializers for bit-fieldsJakub Jelinek1-4/+10
P0683R1 - default member initializers for bit-fields cp/ * cp-tree.h (grokbitfield): Add INIT parameter. * parser.c (cp_parser_constant_expression): Add STRICT_P argument, if true, parse a conditional-expression rather than assignment-expression. (cp_parser_member_declaration): For C++11 and later pass true as STRICT_P to cp_parser_constant_expression. Parse C++2A bitfield NSDMIs. Adjust grokbitfield caller. Handle DECL_INITIAL also for DECL_C_BIT_FIELDs. (cp_parser_objc_class_ivars): Adjust grokbitfield caller. * class.c (check_field_decl): Recurse even for DECL_C_BIT_FIELDs. (check_field_decls): Call check_field_decl even for DECL_C_BIT_FIELDs. * decl2.c (grokbitfield): Add INIT parameter, pass it to cp_finish_decl. * pt.c (tsubst_decl): Handle DECL_INITIAL for all FIELD_DECLs, not just non-bitfields. testsuite/ * g++.dg/ext/bitfield6.C: New test. * g++.dg/cpp2a/bitfield1.C: New test. * g++.dg/cpp2a/bitfield2.C: New test. * g++.dg/cpp2a/bitfield3.C: New test. From-SVN: r253302
2017-09-29c-attribs.c (handle_packed_attribute): Test DECL_C_BIT_FIELD rather than ↵Jakub Jelinek1-1/+4
DECL_INITIAL. c-family/ * c-attribs.c (handle_packed_attribute): Test DECL_C_BIT_FIELD rather than DECL_INITIAL. (common_handle_aligned_attribute): Likewise. c/ * c-decl.c (grokfield): Use SET_DECL_C_BIT_FIELD here if width is non-NULL. (finish_struct): Test DECL_C_BIT_FIELD instead of DECL_INITIAL, don't SET_DECL_C_BIT_FIELD here. cp/ * class.c (check_bitfield_decl): Retrieve and clear width from DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL. (check_field_decls): Test DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL. (remove_zero_width_bit_fields): Adjust comment. * decl2.c (grokbitfield): Stash width into DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL. * pt.c (tsubst_decl): For DECL_C_BIT_FIELD, tsubst_expr DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL for width. objc/ * objc-act.c (check_ivars, gen_declaration): For OBJCPLUS look at DECL_BIT_FIELD_REPRESENTATIVE rather than DECL_INITIAL. From-SVN: r253301
2017-09-28PR c++/56973, DR 696 - capture constant variables only as needed.Jason Merrill1-0/+5
* expr.c (mark_use): Split out from mark_rvalue_use and mark_lvalue_use. Handle lambda capture of constant variables. (mark_lvalue_use_nonread): New. * semantics.c (process_outer_var_ref): Don't capture a constant variable until forced. * pt.c (processing_nonlambda_template): New. * call.c (build_this): Check it. * decl2.c (grok_array_decl): Call mark_rvalue_use and mark_lvalue_use_nonread. * init.c (constant_value_1): Don't call mark_rvalue_use. * typeck.c (build_static_cast): Handle lambda capture. From-SVN: r253266
2017-09-15re PR c++/64644 ("warning: anonymous union with no members" should be an ↵Manuel López-Ibáñez1-1/+1
error with -pedantic-errors) /cp 2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org> Paolo Carlini <paolo.carlini@oracle.com> PR c++/64644 * decl2.c (finish_anon_union): Complain about "anonymous union with no members" with a pedwarn. /testsuite 2017-09-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org> Paolo Carlini <paolo.carlini@oracle.com> PR c++/64644 * g++.dg/other/anon-union4.C: New. * g++.old-deja/g++.law/union4.C: Adjust. * g++.old-deja/g++.other/anon1.C: Likewise. Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com> From-SVN: r252835
2017-09-06class.c (warn_hidden): Don't barf on non-functions.Nathan Sidwell1-5/+9
* class.c (warn_hidden): Don't barf on non-functions. * decl2.c (check_classfn): Likewise. Check template match earlier. From-SVN: r251795
2017-09-06name-lookup.h (lookup_fnfields_slot_nolazy, [...]): Rename to ...Nathan Sidwell1-2/+2
* name-lookup.h (lookup_fnfields_slot_nolazy, lookup_fnfields_slot): Rename to ... (get_class_binding_direct, get_class_binding): ... here. * name-lookup.c (lookup_fnfields_slot_nolazy, lookup_fnfields_slot): Rename to ... (get_class_binding_direct, get_class_binding): ... here. * cp-tree.h (CLASSTYPE_CONSTRUCTORS, CLASSTYPE_DESTRUCTOR): Adjust. * call.c (build_user_type_conversion_1): Adjust. (has_trivial_copy_assign_p): Adjust. (has_trivial_copy_p): Adjust. * class.c (get_basefndecls) Adjust. (vbase_has_user_provided_move_assign) Adjust. (classtype_has_move_assign_or_move_ctor_p): Adjust. (type_build_ctor_call, type_build_dtor_call): Adjust. * decl.c (register_dtor_fn): Adjust. * decl2.c (check_classfn): Adjust. * pt.c (retrieve_specialization): Adjust. (check_explicit_specialization): Adjust. (do_class_deduction): Adjust. * search.c (lookup_field_r): Adjust. (look_for_overrides_here, lookup_conversions_r): Adjust. * semantics.c (classtype_has_nothrow_assign_or_copy_p): Adjust. * tree.c (type_has_nontrivial_copy_init): Adjust. * method.c (lazily_declare_fn): Adjust comment. From-SVN: r251780
2017-08-25Conversion operators have a special nameNathan Sidwell1-1/+1
Conversion operators have a special name * cp-tree.h (CPTI_CONV_OP_MARKER, CPTI_CONV_OP_IDENTIFIER): New. (conv_op_marker, conv_op_identifier): New. (CLASSTYPE_FIRST_CONVERSION_SLOT): Delete. * decl.c (initialize_predefined_identifiers): Add conv_op_identifier. (cxx_init_decl_processing): Create conv_op_marker. * decl2.c (check_classfn): Lookup conv-ops by name. * class.c (add_method): Use conv_op_identifier & conv_op_marker. (resort_type_method_vec): Don't skip conv-ops. (finish_struct_methods, warn_hidden): Likewise. * name-lookup.h (lookup_all_conversions): Delete. * name-lookup.c (lookup_conversion_operator): Replace with ... (extract_conversion_operator): ... this. (lookup_fnfields_slot_nolazy): Find conv-ops by name. (lookup_all_conversions): Delete. * pt.c (check_explicit_specialization): Find conv-ops by name. * search.c (lookup_conversions_r): Likewise. From-SVN: r251348
2017-08-18Add warn_if_not_aligned attributeH.J. Lu1-0/+7
Add warn_if_not_aligned attribute as well as command line options: -Wif-not-aligned and -Wpacked-not-aligned. __attribute__((warn_if_not_aligned(N))) causes compiler to issue a warning if the field in a struct or union is not aligned to N: typedef unsigned long long __u64 __attribute__((aligned(4),warn_if_not_aligned(8))); struct foo { int i1; int i2; __u64 x; }; __u64 is aligned to 4 bytes. But inside struct foo, __u64 should be aligned at 8 bytes. It is used to define struct foo in such a way that struct foo has the same layout and x has the same alignment when __u64 is aligned at either 4 or 8 bytes. Since struct foo is normally aligned to 4 bytes, a warning will be issued: warning: alignment 4 of 'struct foo' is less than 8 Align struct foo to 8 bytes: struct foo { int i1; int i2; __u64 x; } __attribute__((aligned(8))); silences the warning. It also warns the field with misaligned offset: struct foo { int i1; int i2; int i3; __u64 x; } __attribute__((aligned(8))); warning: 'x' offset 12 in 'struct foo' isn't aligned to 8 This warning is controlled by -Wif-not-aligned and is enabled by default. When -Wpacked-not-aligned is used, the same warning is also issued for the field with explicitly specified alignment in a packed struct or union: struct __attribute__ ((aligned (8))) S8 { char a[8]; }; struct __attribute__ ((packed)) S { struct S8 s8; }; warning: alignment 1 of 'struct S' is less than 8 This warning is disabled by default and enabled by -Wall. gcc/ PR c/53037 * print-tree.c (print_node): Support DECL_WARN_IF_NOT_ALIGN and TYPE_WARN_IF_NOT_ALIGN. * stor-layout.c (do_type_align): Merge DECL_WARN_IF_NOT_ALIGN. (handle_warn_if_not_align): New. (place_union_field): Call handle_warn_if_not_align. (place_field): Call handle_warn_if_not_align. Copy TYPE_WARN_IF_NOT_ALIGN. (finish_builtin_struct): Copy TYPE_WARN_IF_NOT_ALIGN. (layout_type): Likewise. * tree-core.h (tree_type_common): Add warn_if_not_align. Set spare to 18. (tree_decl_common): Add warn_if_not_align. * tree.c (build_range_type_1): Copy TYPE_WARN_IF_NOT_ALIGN. * tree.h (TYPE_WARN_IF_NOT_ALIGN): New. (SET_TYPE_WARN_IF_NOT_ALIGN): Likewise. (DECL_WARN_IF_NOT_ALIGN): Likewise. (SET_DECL_WARN_IF_NOT_ALIGN): Likewise. * doc/extend.texi: Document warn_if_not_aligned attribute. * doc/invoke.texi: Document -Wif-not-aligned and -Wpacked-not-aligned. gcc/c-family/ PR c/53037 * c-attribs.c (handle_warn_if_not_aligned_attribute): New. (c_common_attribute_table): Add warn_if_not_aligned. (handle_aligned_attribute): Renamed to ... (common_handle_aligned_attribute): Remove argument, name, and add argument, warn_if_not_aligned. Handle warn_if_not_aligned. (handle_aligned_attribute): New. * c.opt: Add -Wif-not-aligned and -Wpacked-not-aligned. gcc/c/ PR c/53037 * c-decl.c (merge_decls): Also merge DECL_WARN_IF_NOT_ALIGN. (check_bitfield_type_and_width): Don't allow bit-field with warn_if_not_aligned type. gcc/cp/ PR c/53037 * decl.c (duplicate_decls): Also merge DECL_WARN_IF_NOT_ALIGN. * decl2.c (grokbitfield): Don't allow bit-field with warn_if_not_aligned type. gcc/testsuite/ PR c/53037 * c-c++-common/pr53037-5.c: New test. * g++.dg/pr53037-1.C: Likewise. * g++.dg/pr53037-2.C: Likewise. * g++.dg/pr53037-3.C: Likewise. * g++.dg/pr53037-4.C: Likewise. * gcc.dg/pr53037-1.c: Likewise. * gcc.dg/pr53037-2.c: Likewise. * gcc.dg/pr53037-3.c: Likewise. * gcc.dg/pr53037-4.c: Likewise. From-SVN: r251180
2017-08-11Introduce TARGET_SUPPORTS_ALIASESMartin Liska1-14/+11
2017-08-11 Martin Liska <mliska@suse.cz> * c-opts.c (c_common_post_options): Replace ASM_OUTPUT_DEF with TARGET_SUPPORTS_ALIASES. 2017-08-11 Martin Liska <mliska@suse.cz> * asan.c (asan_protect_global): Replace ASM_OUTPUT_DEF with TARGET_SUPPORTS_ALIASES. * cgraph.c (cgraph_node::create_same_body_alias): Likewise. * ipa-visibility.c (can_replace_by_local_alias): Likewise. (optimize_weakref): Likewise. * symtab.c (symtab_node::noninterposable_alias): Likewise. * varpool.c (varpool_node::create_extra_name_alias): Likewise. * defaults.h: Introduce TARGET_SUPPORTS_ALIASES. 2017-08-11 Martin Liska <mliska@suse.cz> * decl2.c (get_tls_init_fn): Replace ASM_OUTPUT_DEF with TARGET_SUPPORTS_ALIASES. (handle_tls_init): Likewise. (note_mangling_alias): Likewise. Remove ATTRIBUTE_UNUSED for both arguments. * optimize.c (can_alias_cdtor): Likewise. From-SVN: r251048
2017-08-09PR c++/81359 - Unparsed NSDMI error from SFINAE context.Jason Merrill1-2/+3
* init.c (get_nsdmi): Add complain parm. * typeck2.c (digest_nsdmi_init): Add complain parm. (process_init_constructor_record): Pass complain to get_nsdmi. * pt.c (maybe_instantiate_noexcept): Add complain parm, return bool. * method.c (get_defaulted_eh_spec): Add complain parm. Pass it into synthesized_method_walk. (synthesized_method_walk): Adjust. (walk_field_subobs): Pass complain to get_nsdmi. (defaulted_late_check): Skip other checks if deleted. * decl2.c (mark_used): Pass complain to maybe_instantiate_noexcept. * call.c (build_aggr_conv): Pass complain to get_nsdmi. * parser.c (defarg_location): New. * error.c (location_of): Use it. From-SVN: r250994
2017-07-21Remove TYPE_METHODS.Nathan Sidwell1-19/+10
gcc/ Remove TYPE_METHODS. * tree.h (TYPE_METHODS): Delete. * dwarf2out.c (gen_member_die): Member fns are on TYPE_FIELDS. * dbxout.c (dbxout_type_fields): Ignore FUNCTION_DECLs. (dbxout_type_methods): Scan TYPE_FIELDS. (dbxout_type): Don't check TYPE_METHODS here. * function.c (use_register_for_decl): Always ignore register for class types when not optimizing. * ipa-devirt.c (odr_types_equivalent_p): Delete TYPE_METHODS scan. * tree.c (free_lang_data_in_type): Stitch out member functions and templates from TYPE_FIELDS. (build_distinct_type_copy, verify_type_variant, verify_type): Member fns are on TYPE_FIELDS. * tree-dump.c (dequeue_and_dump): No TYPE_METHODS. * tree-pretty-print.c (dump_generic_node): Likewise. gcc/cp/ Remove TYPE_METHODS. * class.c (maybe_warn_about_overly_private_class, finish_struct_methods, one_inheriting_sig, count_fields, add_fields_to_record_type, check_field_decls, check_methods, clone_function_decl, set_method_tm_attributes, finalize_literal_type_property, check_bases_and_members, create_vtable_ptr, determine_key_method, unreverse_member_declarations, finish_struct, add_vcall_offset_vtbl_entries_1): Member fns are on TYPE_FIELDS. * decl.c (fixup_anonymous_aggr): Likewise. * decl2.c (reset_type_linkage_2): Likewise. * method.c (after_nsdmi_defaulted_late_checks, lazily_declare_fn): Likewise. * optimize.c (maybe_thunk_body, maybe_clone_body): Likewise. * pt.c (instantiate_class_template_1, tsubst_expr, do_type_instantiation, instantiate_pending_templates): Likewise. * search.c (lookup_field_1): Likewise. * semantics.c (finish_member_declaration, finish_omp_declare_simd_methods): Likewise. gcc/c-family/ Remove TYPE_METHODS. * c-ada-spec.c (is_tagged_type, has_nontrivial_methods, dump_ada_template, print_ada_methods, print_ada_declaration): Member fns are on TYPE_FIELDS. gcc/objc/ Remove TYPE_METHODS. * objc-runtime-shared-support.c (build_ivar_list_initializer): Don't presume first item is a FIELD_DECL. gcc/testsuite/ * g++.dg/ext/anon-struct6.C: Adjust diag. * g++.old-deja/g++.other/anon4.C: Adjust diag. libcc1/ Remove TYPE_METHODS. * libcp1plugin.cc (plugin_build_decl): Member fns are on TYPE_FIELDS. From-SVN: r250413
2017-07-12cp-tree.h (DECL_CONSTRUCTOR_P, [...]): Look at identifier flags.Nathan Sidwell1-1/+1
* cp-tree.h (DECL_CONSTRUCTOR_P, DECL_MAYBE_IN_CHARGE_CONSTRUCTOR, DECL_DESTRUCTOR_P, DECL_MAYBE_IN_CHARGE_DESTRCTOR): Look at identifier flags. * decl.c (grokfndecl): Set DECL_CXX_CONSTRUCTOR and DECL_CXX_DESTRUCTOR explicitly. * decl2.c (grokclassfn): Likewise. * friend.c (do_friend): Likewise. * method.c (make_thunk, make_alias_for, implicitly_declare_fn): Likewise. From-SVN: r250158
2017-07-11* decl2.c (reset_type_linkage_2): Dont't change ctor name.Nathan Sidwell1-7/+0
From-SVN: r250130
2017-06-30cp-tree.h (lookup_fnfields_1, [...]): Don't declare.Nathan Sidwell1-102/+75
* cp-tree.h (lookup_fnfields_1, class_method_index_for_fn): Don't declare. (lookup_all_conversions): Declare. * class.c (get_basefndecls): Use lookup_fnfields_slot. * decl.c (register_dtor_fn): Use lookup_fnfields_slot. * decl2.c (check_class_fn): Use lookup_fnfields_slot. Rework diagnostics. * pt.c (retrieve_specialization): Use lookup_fnfields_slot. (check_explicit_specialization): Use lookup_fnfields_slot_nolazy, lookup_all_conversions. * search.c (lookup_fnfields_1): Make static. (lookup_all_conversions): New. (class_method_index_for_fn): Delete. * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use lookup_fnfields_slot. * g++.dg/concepts/memfun-err.C: Adjust diagnostics. * g++.dg/cpp0x/decltype9.C: Likewise. * g++.dg/cpp0x/forw_enum9.C: Likewise. * g++.dg/lookup/decl1.C: Likewise. * g++.dg/lookup/extern-c-redecl.C: Likewise. * g++.dg/other/pr28432.C: Likewise. * g++.dg/parse/crash12.C: Likewise. * g++.dg/parse/enum3.C: Likewise. * g++.dg/parse/operator6.C: Likewise. * g++.dg/template/crash69.C: Likewise. * g++.dg/template/error27.C: Likewise. * g++.dg/template/error28.C: Likewise. * g++.dg/template/memfriend6.C: Likewise. * g++.old-deja/g++.mike/err1.C: Likewise. * g++.old-deja/g++.mike/p811.C: Likewise. * g++.old-deja/g++.other/crash25.C: Likewise. * g++.old-deja/g++.other/dtor4.C: Likewise. * g++.old-deja/g++.pt/t37.C: Likewise. From-SVN: r249843
2017-06-29Whitespace cleanups.Nathan Sidwell1-2/+3
* call.c (name_as_c_string): Move CONST_CAST to return. (build_new_method_call_1): Remove unneeded bracing. * class.c (include_empty_classes): Unbreak line. * constraint.cc (tsubst_check_constraint): Add space. * cp-tree.h (lang_decl_ns): Add comment. (PTRMEM_CST_MEMBER): Break line. * decl.c (grokfndecl): Add blank lines. Unbreak some others. (grokdeclarator): Remove lines, move declaration to first use. * decl2.c (decl_needed_p): Fix indentation. (c_parse_final_cleanups): Remove blank line. * method.c (implicitly_declare_fn): Move declaration to first use. * search.c (current_scope): Add blank lines. From-SVN: r249786
2017-06-19PR c++/81073 - constexpr and static var in statement-expression.Jason Merrill1-3/+12
* typeck2.c (store_init_value): Always call require_potential_constant_expression. * pt.c (convert_nontype_argument): Likewise. * constexpr.c (potential_constant_expression_1): Adjust message. Use decl_maybe_constant_var_p instead of decl_constant_var_p. * decl2.c (decl_maybe_constant_var_p): Consider initializer. From-SVN: r249382
2017-06-18PR c++/60063 - -Wunused-local-typedefs and templates.Jason Merrill1-2/+3
* decl2.c (is_late_template_attribute): Return false for "used". From-SVN: r249347
2017-06-16PR c++/80831 - ICE with -fsyntax-only.Jason Merrill1-5/+5
* decl2.c (c_parse_final_cleanups): Use cgraph_node::get_create. From-SVN: r249318
2017-06-16cp-tree.h (build_this_parm, [...]): Add FN parm.Nathan Sidwell1-11/+11
gcc/cp/ * cp-tree.h (build_this_parm, cp_build_parm_decl) build_artificial_parm): Add FN parm. * decl.c (start_cleanup_fn): Adjust. (build_this_parm): Add FN parm, pass it through. (grokfndecl): Adjust parm building. * decl2.c (cp_build_parm_decl): Add FN parm, set context. (build_artificial_parm): Add FN parm, pass through. (maybe_retrofit_in_chrg): Adjust parm building. (start_static_storage_duration_function): Likwise. * lambda.c (maybe_aadd_lambda_conv_op): Likewise. * method.c (implicitly_declare_fn): Likewise. * parser.c (inject_this_parameter): Likewise. libcc1/ * libcp1plugin.cc (plugin_build_decl): Adjust parm building. (--This line, and those below, will be ignored-- M gcc/cp/parser.c M gcc/cp/ChangeLog M gcc/cp/decl.c M gcc/cp/lambda.c M gcc/cp/cp-tree.h M gcc/cp/method.c M gcc/cp/decl2.c M libcc1/libcp1plugin.cc M libcc1/ChangeLog From-SVN: r249268
2017-06-16Make keyed_classes a vector.Nathan Sidwell1-28/+9
* cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete. (keyed_classes): Declare as vector. * decl.c (keyed_classes): Define. (cxx_init_decl_processing): Allocate it. (record_key_method_defined): Use vec_safe_push. * class.c (finish_struct_1): Likewise. * pt.c (instantiate_class_template_1): Likewise. * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes. From-SVN: r249263
2017-06-13Implement no_sanitize function attributeMartin Liska1-1/+1
2017-06-13 Martin Liska <mliska@suse.cz> PR sanitize/78204 * c-c++-common/ubsan/attrib-2.c (float_cast2): Enhance the test by adding no_sanitize attribute. * gcc.dg/asan/use-after-scope-4.c: Likewise. 2017-06-13 Martin Liska <mliska@suse.cz> PR sanitize/78204 * c-attribs.c (add_no_sanitize_value): New function. (handle_no_sanitize_attribute): Likewise. (handle_no_sanitize_address_attribute): Use the function. (handle_no_sanitize_thread_attribute): New function. (handle_no_address_safety_analysis_attribute): Use add_no_sanitize_value. (handle_no_sanitize_undefined_attribute): Likewise. * c-common.h: Declare new functions. * c-ubsan.c (ubsan_instrument_division): Use sanitize_flags_p. (ubsan_instrument_shift): Likewise. (ubsan_instrument_bounds): Likewise. (ubsan_maybe_instrument_array_ref): Likewise. (ubsan_maybe_instrument_reference_or_call): Likewise. 2017-06-13 Martin Liska <mliska@suse.cz> PR sanitize/78204 * asan.c (asan_sanitize_stack_p): Use sanitize_flags_p. (gate_asan): Likewise. * asan.h (asan_no_sanitize_address_p): Remove the function. (sanitize_flags_p): New function. * builtins.def: Fix coding style. * common.opt: Use renamed enum value. * convert.c (convert_to_integer_1): Use sanitize_flags_p. * doc/extend.texi: Document no_sanitize attribute. * flag-types.h (enum sanitize_code): Rename SANITIZE_NONDEFAULT to SANITIZE_UNDEFINED_NONDEFAULT. * gcc.c (sanitize_spec_function): Use the renamed enum value. * gimple-fold.c (optimize_atomic_compare_exchange_p): Use sanitize_flags_p. * gimplify.c (gimplify_function_tree): Likewise. * ipa-inline.c (sanitize_attrs_match_for_inline_p): Likewise. * opts.c (parse_no_sanitize_attribute): New function. (common_handle_option): Use renamed enum value. * opts.h (parse_no_sanitize_attribute): Declare. * tree.c (sanitize_flags_p): New function. * tree.h: Declared here. * tsan.c: Use sanitize_flags_p. * ubsan.c (ubsan_expand_null_ifn): Likewise. (instrument_mem_ref): Likewise. (instrument_bool_enum_load): Likewise. (do_ubsan_in_current_function): Remove the function. (pass_ubsan::execute): Use sanitize_flags_p. * ubsan.h: Remove do_ubsan_in_current_function * tree-cfg.c (print_no_sanitize_attr_value): New function. (dump_function_to_file): Use it here. 2017-06-13 Martin Liska <mliska@suse.cz> PR sanitize/78204 * class.c (build_base_path): Use sanitize_flags_p. * cp-gimplify.c (cp_genericize_r): Likewise. (cp_genericize_tree): Likewise. (cp_genericize): Likewise. * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise. * decl.c (compute_array_index_type): Likewise. (start_preparsed_function): Likewise. * decl2.c (one_static_initialization_or_destruction): Likewise. * init.c (finish_length_check): Likewise. * lambda.c (maybe_add_lambda_conv_op): Likewise. * typeck.c (cp_build_binary_op): Likewise. (build_static_cast_1): Likewise. 2017-06-13 Martin Liska <mliska@suse.cz> PR sanitize/78204 * c-convert.c (convert): Use sanitize_flags_p. * c-decl.c (grokdeclarator): Likewise. * c-typeck.c (convert_for_assignment): Likewise. (c_finish_return): Likewise. (build_binary_op): Likewise. From-SVN: r249158
2017-06-11tree.h (id_equal): New.Jason Merrill1-1/+1
* tree.h (id_equal): New. * dwarf2out.c, hsa-gen.c, ipa-devirt.c, omp-expand.c, omp-simd-clone.c, read-rtl-function.c, tree-chkp.c, tree.c: Use it instead of strcmp of IDENTIFIER_POINTER. c-family/ * c-ada-spec.c, c-pragma.c: Use it. cp/ * cp-tree.h, decl2.c, mangle.c, parser.c, pt.c, semantics.c: Use it. From-SVN: r249103
2017-06-02name-lookup.h (cp_binding_level): Lose namespaces field.Nathan Sidwell1-22/+14
* name-lookup.h (cp_binding_level): Lose namespaces field. * name-lookup.c (add_decl_to_level): Chain namespaces on the names list. (suggest_alternatives_for): Adjust for namespace list. Do breadth-first search. * decl2.c (collect_source_refs): Namespaces are on the regulr list. (collect_ada_namespace): Likewise. * g++.dg/pr45330.C: Adjust. Check breadth-firstness. From-SVN: r248821
2017-05-29PR c++/80891 (#3)Nathan Sidwell1-1/+1
PR c++/80891 (#3) * cp-tree.h (build_min_nt_call_vec): Declare. * decl.c (build_offset_ref_call_from_tree): Call it. * parser.c (cp_parser_postfix_expression): Likewise. * pt.c (tsubst_copy_and_build): Likewise. * semantics.c (finish_call_expr): Likewise. * tree.c (build_min_nt_loc): Keep unresolved lookups. (build_min): Likewise. (build_min_non_dep): Likewise. (build_min_non_dep_call_vec): Likewise. (build_min_nt_call_vec): New. PR c++/80891 (#3) * g++.dg/lookup/pr80891-3.C: New. From-SVN: r248571
2017-05-26cp-tree.h (struct lang_decl_decomp): New type.Jakub Jelinek1-0/+3
* cp-tree.h (struct lang_decl_decomp): New type. (struct lang_decl): Add u.decomp. (LANG_DECL_DECOMP_CHECK): Define. (DECL_DECOMPOSITION_P): Note it is set also on the vars for user identifiers. (DECL_DECOMP_BASE): Define. (retrofit_lang_decl): Add extra int = 0 argument. * lex.c (retrofit_lang_decl): Add SEL argument, if non-zero use it to influence the selector choices and for selector 0 to non-zero transition copy old content. (cxx_dup_lang_specific_decl): Handle DECL_DECOMPOSITION_P. * decl.c (poplevel): For DECL_DECOMPOSITION_P, check !DECL_DECOMP_BASE instead of !DECL_VALUE_EXPR. Adjust warning wording if decl is a structured binding. (cp_finish_decomp): Pass 4 as the new argument to retrofit_lang_decl. Set DECL_DECOMP_BASE. Ignore DECL_READ_P sets from initialization of individual variables for tuple structured bindings. (grokdeclarator): Pass 4 as the new argument to retrofit_lang_decl. Clear DECL_DECOMP_BASE. * decl2.c (mark_used): Mark DECL_DECOMP_BASE TREE_USED as well. * pt.c (tsubst_decomp_names): Assert DECL_DECOMP_BASE matches what is expected. * expr.c (mark_exp_read): Recurse on DECL_DECOMP_BASE instead of DECL_VALUE_EXPR. * g++.dg/cpp1z/decomp29.C (p): New variable. (main): Add further tests. From-SVN: r248483
2017-05-23PR c++/80396 - built-in for make_integer_sequence.Jason Merrill1-0/+7
* pt.c (builtin_pack_fn_p, builtin_pack_call_p) (expand_integer_pack, expand_builtin_pack_call): New. (find_parameter_packs_r): Check builtin_pack_call_p. (check_for_bare_parameter_packs): Handle it. (tsubst_pack_expansion): Call expand_builtin_pack_call. (declare_integer_pack): New. (init_template_processing): Call it. * decl2.c (mark_used): Check builtin_pack_fn_p. From-SVN: r248384
2017-05-22invoke.texi (fdump-translation-unit): Delete documentation.Nathan Sidwell1-4/+5
gcc/ * doc/invoke.texi (fdump-translation-unit): Delete documentation. (fdump-lang): Document 'raw' option. * dumpfile.h (TDI_tu): Delete. * dumpfile.c (dump_files): Remove translation-unit. (FIRST_AUTO_NUMBERED_DUMP): Decrement. gcc/cp/ * cp-objcp-common.c (cp_register_dumps): Register raw dumper. * cp-tree.h (raw_dump_id): Declare. * decl2.c (raw_dump_id): Define. (dump_tu): Use raw_dump_id. gcc/c/ * c-decl.c (c_parse_final_cleanups): Drop TDI_tu handling. From-SVN: r248333
2017-05-17Introduce dump_flags_t type and use it instead of int type.Martin Liska1-1/+1
2017-05-17 Martin Liska <mliska@suse.cz> * class.c (dump_class_hierarchy): Introduce dump_flags_t type and use it instead of int type. (dump_vtable): Likewise. (dump_vtt): Likewise. * decl2.c (dump_tu): Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-common.h: Introduce dump_flags_t type and use it instead of int type. * c-gimplify.c (c_genericize): Likewise. * c-opts.c: Likewise. 2017-05-17 Martin Liska <mliska@suse.cz> * c-decl.c (c_parse_final_cleanups): Introduce dump_flags_t type and use it instead of int type. 2017-05-17 Martin Liska <mliska@suse.cz> * cfg.c: Introduce dump_flags_t type and use it instead of int type. * cfg.h: Likewise. * cfghooks.c: Likewise. * cfghooks.h (struct cfg_hooks): Likewise. * cfgrtl.c: Likewise. * cfgrtl.h: Likewise. * cgraph.c (cgraph_node::get_body): Likewise. * coretypes.h: Likewise. * domwalk.c: Likewise. * domwalk.h: Likewise. * dumpfile.c (struct dump_option_value_info): Likewise. (dump_enable_all): Likewise. (dump_switch_p_1): Likewise. (opt_info_switch_p): Likewise. * dumpfile.h (enum tree_dump_index): Likewise. (struct dump_file_info): Likewise. * genemit.c: Likewise. * generic-match-head.c: Likewise. * gengtype.c (open_base_files): Likewise. * gimple-pretty-print.c: Likewise. * gimple-pretty-print.h: Likewise. * graph.c (print_graph_cfg): Likewise. * graphite-scop-detection.c (dot_all_sese): Likewise. * ipa-devirt.c (build_type_inheritance_graph): Likewise. * loop-unroll.c (report_unroll): Likewise. * passes.c (pass_manager::register_one_dump_file): Likewise. * print-tree.c: Likewise. * statistics.c: Likewise. * tree-cfg.c: Likewise. * tree-cfg.h: Likewise. * tree-dfa.c: Likewise. * tree-dfa.h: Likewise. * tree-dump.c (dump_function): Likewise. * tree-dump.h (struct dump_info): Likewise. * tree-pretty-print.c: Likewise. * tree-pretty-print.h: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Likewise. * tree-vect-loop.c: Likewise. * tree-vect-slp.c: Likewise. From-SVN: r248140
2017-05-16call.c (build_user_type_conversion_1): Use OVL_FIRST.Nathan Sidwell1-40/+32
* call.c (build_user_type_conversion_1): Use OVL_FIRST. (print_error_for_call_faulure): Use OVL_NAME. (build_op_call_1): Use ovl_iterator. (add_candidates): Use OVL_FIRST & lkp_iterator. (build_op_delete_call): Use MAYBE_BASELINK_FUNCTIONS & lkp_iterator. * class.c (deduce_noexcept_on_destructors): Use ovl_iterator. (type_has_user_nondefault_constructor) in_class_defaulted_default_constructor, type_has_user_provided_constructor, type_has_user_provided_or_explicit_constructor, type_has_non_user_provided_default_constructor, vbase_has_user_provided_move_assign, type_has_move_constructor, type_has_move_assign, type_has_user_declared_move_constructor, type_has_user_declared_move_assign, type_build_ctor_call, type_build_dtor_call, type_requires_array_cookie, explain_non_literal_class): Likewise. (finish_struct): Use lkp_iterator. (resolve_address_of_overloaded_function): Use OVL_NAME, lkp_iterator. (note_name_declared_in_class): Use OVL_NAME. * cxx-pretty-print.c (pp_cxx_unqualified_id): Use OVL_FIRST. (pp_cxx_qualified_id, cxx_pretty_printer::id_expression) cxx_pretty_printer::expression): Likewise. * decl2.c (check_classfn): Use ovl_iterator. * pt.c (retrieve_specialization): Use ovl_iterator. * tree.c (cp_tree_equal): Use lkp_iterator. (type_has_nontrivial_copy_init): Use ovl_iterator. ((--This line, and those below, will be ignored-- M cp/ChangeLog M cp/call.c M cp/class.c M cp/pt.c M cp/decl2.c M cp/tree.c M cp/cxx-pretty-print.c From-SVN: r248120
2017-05-16cp-tree.h (class ovl_iterator, [...]): New OVERLOAD iterators.Nathan Sidwell1-3/+3
* cp-tree.h (class ovl_iterator, class lkp_iterator): New OVERLOAD iterators. (MAYBE_BASELINK_FUNCTIONS): New. * constraint.cc (resolve_constraint_check): Use lkp_iterator. * decl2.c (maybe_warn_sized_delete): Use ovl_iterator. * lambda.c (maybe_generic_this_capture): Use lkp_iterator. * method.c (inherited_ctor_binfo): Use ovl_iterator. (binfo_inherited_from): Likewise. * parser.c (lookup_literal_operator): Use lkp_iterator. * pt.c (iterative_hash_template_arg): Use lkp_iterator. (print_candidates_1): Likewise. (determine_specialization): Likewise. (resolve_overloaded_unification): Likewise. (resolve_nondeduced_context): Likewise. (type_dependent_expression_p): Likewise. (dependent_template_p): Likewise. * ptree.c (cxx_print_xnode): Likewise. * semantics.c (omp_reduction_lookup): Use lkp_iterator. (classtype_has_nothrow_assign_or_copy_p): Use ovl_iterator. * typeck.c (check_template_keyword): Use lkp_iterator. From-SVN: r248112
2017-05-16cp-tree.h (OVL_FIRST, OVL_NAME): New.Nathan Sidwell1-1/+1
* cp-tree.h (OVL_FIRST, OVL_NAME): New. (ovl_first): New. * constexpr.c (function_concept_check): Use OVL_FIRST. * cvt.c (build_expr_type_conversion): Likewise. * decl.c (poplevel, grokdeclarator): Use OVL_NAME. * decl2.c (mark_used): Use OVL_FIRST. * error.c (dump_decl): Use OVL_FIRST, OVL_NAME. (dump_expr, location_of): Use OVL_FIRST. * friend.c (do_friend): Use OVL_NAME. * init.c (build_offset_ref): Use OVL_FIRST. * mangle.c (write_member_name): Likewise. (write_expression): Use OVL_NAME. * method.c (strip_inheriting_ctors): Use OVL_FIRST. * name-lookup.c (pushdecl_class_level): Use OVL_NAME. * pt.c (check_explicit_specialization): Use OVL_FIRST. (check_template_shadow): Likewise. (tsubst_template_args): Use OVL_NAME. (tsubst_baselink): Use OVL_FIRST. * semantics.c (perform_koenig_lookup): Use OVL_NAME. * tree.c (get_first_fn): Use OVL_FIRST. * typeck.c (finish_class_member_access_expr): Use OVL_NAME. (cp_build_addr_expr_1): Use OVL_FIRST. From-SVN: r248108
2017-05-11Revert pushdecl_top_level_and_finish name change.Nathan Sidwell1-2/+2
* name-lookup.h (pushdecl_top_level_and_finish): Resurrect old name. * name-lookup.c (pushdecl_top_level_and_finish): Likewise. * decl.c (cp_make_fname_decl): Adjust. * decl2.c (get_guard, handle_tls_init): Adjust. * rtti.c (get_tinfo_decl, tinfo_base_init): Adjust. From-SVN: r247915
2017-05-11cp-tree.h (pushdecl, [...]): Move declarations to ...Nathan Sidwell1-2/+2
* cp-tree.h (pushdecl, pushdecl_maybe_friend, pushtag) pushtag_top_level_maybe_friend, pushdecl_top_level_and_finish): Move declarations to ... * name-lookup.h: ... here. Group pushdecl variants. (pushdecl_top_level_and_finish): Rename to ... (pushdecl_top_level_with_init): ... here. * decl.c (cp_make_fname_decl): Use pushdecl_top_level_with_init. * decl2.c (get_guard, handle_tls_init): Likewise. * rtti.c (get_tinfo_decl, tinfo_base_init): Likewise. * lambda.c (maybe_add_lambda_conv_op): Use namespace_bindings_p. * method.c (implicitly_declare_fn): Likewise. * searchc (node_debug_info_needed): Likewise. * name-lookup.c (pushdecl_top_level_and_finish): Rename to ... (pushdecl_top_level_with_init): ... here. (pop_everything): Use namespace_bindings_p. (--This line, and those below, will be ignored-- M cp/ChangeLog M cp/method.c M cp/cp-tree.h M cp/decl.c M cp/lambda.c M cp/rtti.c M cp/name-lookup.c M cp/decl2.c M cp/name-lookup.h M cp/search.c From-SVN: r247902
2017-05-05Kill per-namespace static_decls.Nathan Sidwell1-3/+1
* cp-tree.h (static_decls): Declare. (wrapup_globals_for_namespace) diagnose_inline_vars_for_namespace): Replace with ... (wrapup_namespace_globals): ... this. * decl.c (static_decls): Define. (wrapup_globals_for_namespace) diagnose_inline_vars_for_namespace): Replace with ... (wrapup_namespace_globals): ... this. (cxx_init_decl_processing): Initialize static_decls. * decl2.c (c_parse_final_cleanups): Adjust. * name-lookup.h (cp_binding_level): Remove static_decls member. * name-lookup.c (add_decl_to_level): Adjust. (begin_scope): Adjust. ((--This line, and those below, will be ignored-- M cp/cp-tree.h M cp/name-lookup.c M cp/name-lookup.h M cp/ChangeLog M cp/decl2.c M cp/decl.c From-SVN: r247633
2017-04-03Fix numerous typos in commentsJonathan Wakely1-2/+2
gcc: * alias.c (base_alias_check): Fix typo in comment. * cgraph.h (class ipa_polymorphic_call_context): Likewise. * cgraphunit.c (symbol_table::compile): Likewise. * collect2.c (maybe_run_lto_and_relink): Likewise. * config/arm/arm.c (arm_thumb1_mi_thunk): Likewise. * config/avr/avr-arch.h (avr_arch_info_t): Likewise. * config/avr/avr.c (avr_map_op_t): Likewise. * config/cr16/cr16.h (DATA_ALIGNMENT): Likewise. * config/epiphany/epiphany.c (TARGET_ARG_PARTIAL_BYTES): Likewise. * config/epiphany/epiphany.md (movcc): Likewise. * config/i386/i386.c (legitimize_pe_coff_extern_decl): Likewise. * config/m68k/m68k.c (struct _sched_ib, m68k_sched_variable_issue): Likewise. * config/mips/mips.c (mips_save_restore_reg): Likewise. * config/rx/rx.c (rx_is_restricted_memory_address): Likewise. * config/s390/s390.c (Z10_EARLYLOAD_DISTANCE): Likewise. * config/sh/sh.c (sh_rtx_costs): Likewise. * fold-const.c (fold_truth_andor): Likewise. * genautomata.c (collapse_flag): Likewise. * gengtype.h (struct type::u::s): Likewise. * gensupport.c (has_subst_attribute, add_mnemonic_string): Likewise. * input.c (FORMAT_AMOUNT): Likewise. * ipa-cp.c (class ipcp_lattice, agg_replacements_to_vector) (known_aggs_to_agg_replacement_list): Likewise. * ipa-inline-analysis.c: Likewise. * ipa-inline.h (estimate_edge_time, estimate_edge_hints): Likewise. * ipa-polymorphic-call.c (ipa_polymorphic_call_context::restrict_to_inner_class): Likewise. * loop-unroll.c (analyze_insn_to_expand_var): Likewise. * lra.c (lra_optional_reload_pseudos, lra_subreg_reload_pseudos): Likewise. * modulo-sched.c (apply_reg_moves): Likewise. * omp-expand.c (build_omp_regions_1): Likewise. * trans-mem.c (struct tm_wrapper_hasher): Likewise. * tree-ssa-loop-ivopts.c (may_eliminate_iv): Likewise. * tree-ssa-loop-niter.c (maybe_lower_iteration_bound): Likewise. * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise. * value-prof.c: Likewise. * var-tracking.c (val_reset): Likewise. gcc/ada: * doc/gnat_ugn/gnat_and_program_execution.rst: Fix typo. * g-socket.adb (To_Host_Entry): Fix typo in comment. * gnat_ugn.texi: Fix typo. * raise.c (_gnat_builtin_longjmp): Fix capitalization in comment. * s-stposu.adb (Allocate_Any_Controlled): Fix typo in comment. * sem_ch3.adb (Build_Derived_Record_Type): Likewise. * sem_util.adb (Mark_Coextensions): Likewise. * sem_util.ads (Available_Full_View_Of_Component): Likewise. gcc/c: * c-array-notation.c: Fix typo in comment. gcc/c-family: * c-warn.c (do_warn_double_promotion): Fix typo in comment. gcc/cp: * class.c (update_vtable_entry_for_fn): Fix typo in comment. * decl2.c (one_static_initialization_or_destruction): Likewise. * name-lookup.c (store_bindings): Likewise. * parser.c (make_call_declarator): Likewise. * pt.c (check_explicit_specialization): Likewise. gcc/testsuite: * g++.old-deja/g++.benjamin/scope02.C: Fix typo in comment. * gcc.dg/20031012-1.c: Likewise. * gcc.dg/ipa/ipcp-1.c: Likewise. * gcc.dg/torture/matrix-3.c: Likewise. * gcc.target/powerpc/ppc-spe.c: Likewise. * gcc.target/rx/zero-width-bitfield.c: Likewise. libcpp: * include/line-map.h (LINEMAPS_MACRO_MAPS): Fix typo in comment. * lex.c (search_line_fast): Likewise. * pch.h (cpp_valid_state): Likewise. libdecnumber: * decCommon.c (decFloatFromPackedChecked): Fix typo in comment. * decNumber.c (decNumberPower, decMultiplyOp): Likewise. libgcc: * config/c6x/pr-support.c (__gnu_unwind_execute): Fix typo in comment. libitm: * libitm_i.h (sutrct gtm_thread): Fix typo in comment. From-SVN: r246664
2017-02-21re PR c++/79654 (ICE on invalid c++ code in register_dtor_fn in cp/decl.c:7877)Jakub Jelinek1-1/+1
PR c++/79654 * decl.c (cp_finish_decomp): Don't set decl's type to error_mark_node on error. * pt.c (tsubst_decomp_names): Return error_mark_node if the first decl after the decomposition artificial decl has error_mark_node. * decl2.c (prune_vars_needing_no_initialization): Use error_operand_p instead of just == error_mark_node comparison. * g++.dg/cpp1z/decomp26.C: New test. Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com> From-SVN: r245639
2017-02-13PR c++/79296 - ICE mangling localized template instantiationNathan Sidwell1-20/+21
PR c++/79296 - ICE mangling localized template instantiation * decl2.c (determine_visibility): Use template fn context for local class instantiations. PR c++/79296 * g++.dg/cpp0x/pr79296.C: New. From-SVN: r245398
2017-02-11PR c++/77790 - ICE with auto function in C++11 modeJason Merrill1-12/+5
* decl.c (undeduced_auto_decl): Remove C++14 limitation. (require_deduced_type): Add complain parm, return bool. * cp-tree.h: Adjust. * decl2.c (mark_used): Use require_deduced_type. From-SVN: r245358
2017-02-02re PR c++/69637 (ICE on an invalid bit-field with template name for width)Paolo Carlini1-2/+5
/cp 2017-02-02 Paolo Carlini <paolo.carlini@oracle.com> PR c++/69637 * decl2.c (grokbitfield): In case of error don't set-up DECL_INITIAL to the width. /testsuite 2017-02-02 Paolo Carlini <paolo.carlini@oracle.com> PR c++/69637 * g++.dg/cpp0x/pr69637-1.C: New. * g++.dg/cpp0x/pr69637-2.C: Likewise. From-SVN: r245117
2017-01-31Introduce C++ support in libcc1Alexandre Oliva1-1/+1
Extend libcc1's with an API for C++ support. Extend libcc1's C API to distinguish between integral types with the same width, as in C++. Likewise for float types. Export small bits of functionality from the C++ front-end for use in libcc1. Add support for the C++ front-end to look up names and addresses using a libcc1-registered binding oracle. Add support for global friends. for gcc/cp/ChangeLog Introduce C++ support in libcc1. * cp-tree.h (struct lang_identifier): Add oracle_looked_up. (ansi_opname): Rename to... (cp_operator_id): ... this. Adjust all callers. (ansi_assopname): Rename to... (cp_assignment_operator_id): ... this. Adjust all callers. (cp_literal_operator_id): Declare. (set_global_friend): Declare. (is_global_friend): Declare. (enum cp_oracle_request): New type. (cp_binding_oracle_function): New type. (cp_binding_oracle): Declare. (cp_finish_injected_record_type): Declare. * friend.c (global_friend): New var. (set_global_friend): New fn. (is_global_friend): New fn. (is_friend): Call is_global_friend. * name-lookup.c (cp_binding_oracle): New var. (query_oracle): New fn. (qualified_lookup_using_namespace): Call query_oracle. (lookup_name_real_1): Likewise. * parser.c (cp_literal_operator_id): Drop static. * search.c (friend_accessible_p): Call is_global_friend. * semantics.c (is_this_parameter): Accept a variable if the binding oracle is enabled. for include/ChangeLog Introduce C++ support in libcc1. * gcc-c-fe.def (int_type_v0): Rename from... (int_type): ... this. Introduce new version. (float_type_v0): Rename from... (float_type): ... this. Introduce new version. (char_type): New. * gcc-c-interface.h (gcc_c_api_version): Add GCC_C_FE_VERSION_1. (gcc_type_array): Move... * gcc-interface.h: ... here. * gcc-cp-fe.def: New. * gcc-cp-interface.h: New. for libcc1/ChangeLog Introduce C++ support. * Makefile.am (AM_CPPFLAGS): Move some -I flags to... (CPPFLAGS_FOR_C_FAMILY, CPPFLAGS_FOR_C, CPPFLAGS_FOR_CXX): ... new macros. (plugin_LTLIBRARIES): Add libcp1plugin.la. (BUILT_SOURCES, MOSTLYCLEANFILES): Add... (cp-compiler-name.h): ... this. New. (c-compiler-name.h): Rename all over from... (compiler-name.h): ... this. Create it atomically. (marshall_c_source, marshall_cxx_source): New macros. (libcc1plugin_la_SOURCES): Rename plugin.cc to libcc1plugin.cc. Add marshall_c_source expansion. (libcc1plugin.lo_CPPFLAGS): New macro. (libcp1plugin_la_LDFLAGS): Likewise. (libcp1plugin_la_SOURCES): Likewise. (libcp1plugin.lo_CPPFLAGS): Likewise. (libcp1plugin_la_LIBADD): Likewise. (libcp1plugin_la_DEPENDENCIES): Likewise. (libcp1plugin_la_LINK): Likewise. (libcc1_la_SOURCES): Added marshall_c_source and marshall_cxx_source expansions. * Makefile.in: Rebuild. * compiler-name.h: Rename all over to... * c-compiler-name.h: ... this. Define C_COMPILER_NAME instead of COMPILER_NAME. * plugin.cc: Rename all over to... * libcc1plugin.cc: ... this. Include marshall-c.hh. (address_rewriter): Drop cleaning up of VLA sizes. (plugin_build_decl): Mark decls as external. (plugin_tagbind): Propagate name to all variants. (build_anonymous_node): New. (plugin_build_record_type): Use it instead of make_node. (plugin_build_union_type): Likewise. (plugin_build_enum_type): Likewise. (plugin_finish_record_or_union): Update all type variants. (safe_lookup_builtin_type): New. (plugin_int_check): Factor out of, and add checks to, ... (plugin_int_type): ... this. Rename to... (plugin_int_type_v0): ... this. (plugin_int_type): New interface, new implementation. (plugin_char_type): New. (plugin_float_type_v0): Rename from... (plugin_float_type): ... this. New interface, new implementation. (plugin_init): Bump handshake version. * libcc1.cc: Include marshall-c.hh. Drop gcc-interface.h. (call_binding_oracle): Rename to... (c_call_binding_oracle): ... this, into anonymous namespace. (call_symbol_address): Rename to... (c_call_symbol_address): ... this, likewise. (GCC_METHOD#): Move methods into cc1plugin::c:: namespace. (libcc1::compiler::find): Refer to C_COMPILER_NAME. (fork_exec): Bump to GCC_C_FE_VERSION_1. (libcc1_compile): Prefix callbacks with c_. (gcc_c_fe_context): Accept GCC_C_FE_VERSION_1. * libcc1.sym: Export gcc_cp_fe_context. * libcp1.cc: New, mostly copied and adjusted from libcc1.cc. * libcp1plugin.cc: New, initially copied from libcc1plugin.cc. * libcp1plugin.sym: New. * marshall-c.hh: New. Move C-specific types from... * marshall.cc: ... this. (cc1_plugin::marshall_array_start): New. (cc1_plugin::marshall_array_elmts): New. (cc1_plugin::marshall for gcc_type_array): Use the above. (cc1_plugin::unmarshall_array_start): New. (cc1_plugin::unmarshall_array_elmts): New. (cc1_plugin::unmarshall for gcc_type_array): Use the above. * marshall.hh: Declare the new array building blocks. Drop C-specific unmarshall declarations. * marshall-cp.hh: New. * names.cc (GCC_METHOD#): Add LANG:: to method names. (LANG): Define while including gcc-c-fe.def and gcc-cp-fe.def. * names.hh: Include gcc-c-fe.def and gcc-cp-fe.def in the corresponding namespaces. * rpc.hh: Don't include marshall.hh. [GCC_CP_INTERFACE_H] (argument_wrapper): Specialize for gcc_vbase_array, gcc_cp_template_args, gcc_cp_function_args. From-SVN: r245051
2017-01-26PR c++/79176 - lambda ICE with -flto -OsJason Merrill1-0/+8
* decl2.c (vague_linkage_p): Handle decloned 'tors. * tree.c (decl_linkage): Likewise. From-SVN: r244935
2017-01-11re PR c++/72813 (atomic header cannot be compiled into translation unit with ↵Jakub Jelinek1-0/+2
-fkeep-inline-functions) PR c++/72813 * gcc.c (default_compilers): Don't add -o %g.s for -S -save-temps of c-header. * c-decl.c (pop_file_scope): Set flag_syntax_only to 1 after writing PCH file. * decl2.c (c_parse_final_cleanups): Set flag_syntax_only to 1 after writing PCH file. From-SVN: r244328
2017-01-08PR c++/78948 - instantiation from discarded statementJason Merrill1-1/+1
PR c++/78948 - instantiation from discarded statement * parser.h (struct cp_parser): Remove in_discarded_stmt field. * cp-tree.h (in_discarded_stmt): Declare it. (struct saved_scope): Add discarded_stmt bitfield. (in_discarded_stmt): New macro. * decl2.c (mark_used): Check it. * parser.c (cp_parser_selection_statement): Adjust. (cp_parser_jump_statement): Adjust. From-SVN: r244206
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994