aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
AgeCommit message (Collapse)AuthorFilesLines
2017-12-07PR c/81544 - attribute noreturn and warn_unused_result on the same function ↵Martin Sebor5-11/+47
accepted PR c/81544 - attribute noreturn and warn_unused_result on the same function accepted PR c/81566 - invalid attribute aligned accepted on functions gcc/ada/ChangeLog: PR c/81544 * gcc-interface/utils.c (gnat_internal_attribute_table): Initialize new member of struct attribute_spec. gcc/c/ChangeLog: PR c/81544 * c-decl.c (c_decl_attributes): Look up existing declaration and pass it to decl_attributes. gcc/c-family/ChangeLog: PR c/81544 PR c/81566 * c-attribs.c (attr_aligned_exclusions): New array. (attr_alloc_exclusions, attr_cold_hot_exclusions): Same. (attr_common_exclusions, attr_const_pure_exclusions): Same. (attr_gnu_inline_exclusions, attr_inline_exclusions): Same. (attr_noreturn_exclusions, attr_returns_twice_exclusions): Same. (attr_warn_unused_result_exclusions): Same. (handle_hot_attribute, handle_cold_attribute): Simplify. (handle_const_attribute): Warn on function returning void. (handle_pure_attribute): Same. (handle_aligned_attribute): Diagnose conflicting attribute specifications. * c-warn.c (diagnose_mismatched_attributes): Simplify. gcc/cp/ChangeLog: PR c/81544 * cp-tree.h (decls_match): Add default argument. * decl.c (decls_match): Avoid calling into the target back end and triggering an error. * decl2.c (cplus_decl_attributes): Look up existing declaration and pass it to decl_attributes. * tree.c (cxx_attribute_table): Initialize new member of struct attribute_spec. gcc/fortran/ChangeLog: PR c/81544 * f95-lang.c (gfc_attribute_table): Initialize new member of struct attribute_spec. gcc/lto/ChangeLog: PR c/81544 * lto-lang.c (lto_attribute_table): Initialize new member of struct attribute_spec. gcc/ChangeLog: PR c/81544 * attribs.c (empty_attribute_table): Initialize new member of struct attribute_spec. (decl_attributes): Add argument. Handle mutually exclusive combinations of attributes. (selftests::test_attribute_exclusions): New function. (selftests::attribute_c_tests): Ditto. * attribs.h (decl_attributes): Add default argument. * selftest.h (attribute_c_tests): Declare. * selftest-run-tests.c (selftest::run_tests): Call attribute_c_tests. * tree-core.h (attribute_spec::exclusions, exclude): New type and member. * doc/extend.texi (Common Function Attributes): Update const and pure. gcc/testsuite/ChangeLog: PR c/81544 * c-c++-common/Wattributes-2.c: New test. * c-c++-common/Wattributes.c: New test. * c-c++-common/attributes-3.c: Adjust. * gcc.dg/Wattributes-6.c: New test. * gcc.dg/Wattributes-7.c: New test. * gcc.dg/attr-noinline.c * gcc.dg/pr44964.c: Same. * gcc.dg/torture/pr42363.c: Same. * gcc.dg/tree-ssa/ssa-ccp-2.c: Same. From-SVN: r255469
2017-12-06re PR c++/80259 (ICE deleting friend function)Jakub Jelinek2-3/+17
PR c++/80259 * decl2.c (grokfield): Diagnose = delete redefinition of a friend. * g++.dg/cpp0x/pr80259.C: New test. From-SVN: r255456
2017-12-06Correct argument to targetm.calls.promote_prototypes.Jason Merrill2-2/+6
* call.c (convert_for_arg_passing): Pass NULL_TREE to targetm.calls.promote_prototypes. (type_passed_as): Likewise. From-SVN: r255455
2017-12-06PR c++/82115 - ICE with variable initialized with its own address.Jason Merrill3-7/+15
* pt.c (value_dependent_expression_p): Add lval parameter. Don't consider DECL_INITIAL if it's true. From-SVN: r255454
2017-12-06C/C++: don't suggest implementation names as spelling fixes (PR c/83236)David Malcolm2-4/+27
gcc/c-family/ChangeLog: PR c/83236 * c-common.c (selftest::c_family_tests): Call selftest::c_spellcheck_cc_tests. * c-common.h (selftest::c_spellcheck_cc_tests): New decl. * c-spellcheck.cc: Include "selftest.h". (name_reserved_for_implementation_p): New function. (should_suggest_as_macro_p): New function. (find_closest_macro_cpp_cb): Move the check for NT_MACRO to should_suggest_as_macro_p and call it. (selftest::test_name_reserved_for_implementation_p): New function. (selftest::c_spellcheck_cc_tests): New function. * c-spellcheck.h (name_reserved_for_implementation_p): New decl. gcc/c/ChangeLog: PR c/83236 * c-decl.c (lookup_name_fuzzy): Don't suggest names that are reserved for use by the implementation. gcc/cp/ChangeLog: PR c/83236 * name-lookup.c (consider_binding_level): Don't suggest names that are reserved for use by the implementation. gcc/testsuite/ChangeLog: PR c/83236 * c-c++-common/spellcheck-reserved.c: New test case. From-SVN: r255453
2017-12-06Move macro-spellchecking code from "gcc" to new files in c-familyDavid Malcolm2-0/+5
The code for spellchecking macros really belongs in c-family, rather than in gcc/spellcheck-tree.c, so this patch moves it there. gcc/ChangeLog: * Makefile.in (C_COMMON_OBJS): Add c-family/c-spellcheck.o. * spellcheck-tree.c (find_closest_macro_cpp_cb): Move to c-family/c-spellcheck.cc. (best_macro_match::best_macro_match): Likewise. * spellcheck-tree.h (struct edit_distance_traits<cpp_hashnode *>): Move to c-family/c-spellcheck.h. (class best_macro_match): Likewise. gcc/c-family/ChangeLog: * c-spellcheck.cc: New file, taken from macro-handling code in spellcheck-tree.c. * c-spellcheck.h: New file, taken from macro-handling code in spellcheck-tree.h. gcc/c/ChangeLog: * c-decl.c: Include "c-family/c-spellcheck.h". gcc/cp/ChangeLog: * name-lookup.c: Include "c-family/c-spellcheck.h". From-SVN: r255452
2017-12-05PR c++/82331 - ICE with variadic partial specialization of autoJason Merrill2-0/+8
* pt.c (unify) [TEMPLATE_PARM_INDEX]: Set processing_template_decl around call to tsubst. From-SVN: r255430
2017-12-05[PR C++/83287] Mark lookup for keepingNathan Sidwell2-0/+12
https://gcc.gnu.org/ml/gcc-patches/2017-12/msg00242.html PR c++/83287 * tree.c (build_min): Check CAST_EXPR arg for OVERLOADs. * g++.dg/lookup/pr83287.C: New. From-SVN: r255429
2017-12-05invoke.texi: Document the options.Martin Liska2-5/+42
gcc/ * doc/invoke.texi: Document the options. * flag-types.h (enum sanitize_code): Add SANITIZE_POINTER_COMPARE and SANITIZE_POINTER_SUBTRACT. * ipa-inline.c (sanitize_attrs_match_for_inline_p): Add handling of SANITIZE_POINTER_COMPARE and SANITIZE_POINTER_SUBTRACT. * opts.c: Define new sanitizer options. * sanitizer.def (BUILT_IN_ASAN_POINTER_COMPARE): Likewise. (BUILT_IN_ASAN_POINTER_SUBTRACT): Likewise. gcc/c/ * c-typeck.c (pointer_diff): Add new argument and instrument pointer subtraction. (build_binary_op): Similar for pointer comparison. gcc/cp/ * typeck.c (pointer_diff): Add new argument and instrument pointer subtraction. (cp_build_binary_op): Create compound expression if doing an instrumentation. gcc/testsuite/ * c-c++-common/asan/pointer-compare-1.c: New test. * c-c++-common/asan/pointer-compare-2.c: New test. * c-c++-common/asan/pointer-subtract-1.c: New test. * c-c++-common/asan/pointer-subtract-2.c: New test. * c-c++-common/asan/pointer-subtract-3.c: New test. * c-c++-common/asan/pointer-subtract-4.c: New test. libsanitizer/ * asan/asan_descriptions.cc: Cherry-pick upstream r319668. * asan/asan_descriptions.h: Likewise. * asan/asan_report.cc: Likewise. * asan/asan_thread.cc: Likewise. * asan/asan_thread.h: Likewise. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r255404
2017-12-05cp-gimplify.c (cp_maybe_instrument_return): Don't add __builtin_unreachable ↵Jakub Jelinek2-0/+17
if -O0 or if -fsanitize=unreachable. * cp-gimplify.c (cp_maybe_instrument_return): Don't add __builtin_unreachable if -O0 or if -fsanitize=unreachable. * g++.dg/missing-return.C: Add -O to dg-options. From-SVN: r255403
2017-12-04PR c++/83273 - constexpr if allows non-constant conditionJason Merrill3-1/+17
* semantics.c (finish_if_stmt_cond): Use require_constant_expression rather than is_constant_expression. * constexpr.c (potential_constant_expression_1) [LAMBDA_EXPR]: Allow in C++17. From-SVN: r255390
2017-12-01Give #include hints for <complex>.Jason Merrill3-1/+19
* name-lookup.c (get_std_name_hint): Add <complex>. * parser.c (cp_parser_diagnose_invalid_type_name): Call suggest_alternative_in_explicit_scope. (cp_parser_namespace_name): Likewise. From-SVN: r255336
2017-12-01PR c++/79228 - extensions hide C++14 complex literal operatorsJason Merrill2-4/+74
libcpp/ * expr.c (interpret_float_suffix): Ignore 'i' in C++14 and up. (interpret_int_suffix): Likewise. gcc/cp/ * parser.c (cp_parser_userdef_numeric_literal): Be helpful about 'i' in C++14 and up. From-SVN: r255335
2017-12-01function.h (struct function): Remove cilk_frame_decl, is_cilk_function and ↵Jakub Jelinek4-14/+10
calls_cilk_spawn fields. * function.h (struct function): Remove cilk_frame_decl, is_cilk_function and calls_cilk_spawn fields. * tree-inline.h (struct copy_body_data): Remove remap_var_for_cilk field. * omp-simd-clone.c (simd_clone_clauses_extract): Don't clear cilk_elemental field. * cgraph.h (struct cgraph_simd_clone): Remove cilk_elemental field. * target.def: Adjust comment. * config/i386/i386.c (ix86_simd_clone_compute_vecsize_and_simdlen): Don't test cilk_elemental. c-family/ * c-attribs.c (c_common_attribute_table): Remove "cilk simd function" attribute. (handle_simd_attribute): Don't check for "cilk simd function" attribute. Reindent, formatting changes. cp/ * parser.c (cp_parser_new): Don't clear cilk_simd_fn_info. (parsing_nsdmi): Adjust comment. (cp_parser_omp_for_loop_init): Likewise. * parser.h (struct cp_omp_declare_simd_data): Adjust comment. (struct cp_parser): Remove cilk_simd_fn_info field. * cp-tree.h (cilk_valid_spawn): Remove. From-SVN: r255300
2017-12-01re PR c/79153 (-Wimplicit-fallthrough missed warning)Jakub Jelinek3-1/+13
PR c/79153 * tree.h (SWITCH_BREAK_LABEL_P): Define. * gimplify.c (collect_fallthrough_labels): Handle GIMPLE_BIND starting with a GIMPLE_SWITCH and ending with GIMPLE_LABEL with SWITCH_BREAK_LABEL_P set on the label. (gimplify_switch_expr): Set SWITCH_BREAK_LABEL_P on the label added for default case if it was missing and not all cases covered. Wrap GIMPLE_SWITCH and the switch_body_seq into a GIMPLE_BIND if switch_body_seq ends with a GIMPLE_LABEL with SWITCH_BREAK_LABEL_P set on the label. * tree-chrec.c (evolution_function_is_univariate_p): Add return true; to avoid -Wimplicit-fallthrough warning. * config/i386/i386.c (ix86_expand_special_args_builtin): Add FALLTHRU comment to avoid -Wimplicit-fallthrough warning. c/ * c-parser.c: Include tree-iterator.h. (c_parser_switch_statement): Emit LABEL_EXPR for the break label into SWITCH_BODY instead of after it and set SWITCH_BREAK_LABEL_P on it. cp/ * cp-gimplify.c (genericize_switch_stmt): Emit LABEL_EXPR for the break label into SWITCH_BODY instead of after it and set SWITCH_BREAK_LABEL_P on it. * parser.c (cp_parser_objc_expression): Add FALLTHRU comment to avoid -Wimplicit-fallthrough warning. fortran/ * match.c (gfc_match): Add FALLTHRU comment to avoid -Wimplicit-fallthrough warning. testsuite/ * c-c++-common/Wimplicit-fallthrough-7.c: Adjust expected warning line. * c-c++-common/Wimplicit-fallthrough-36.c: New test. From-SVN: r255298
2017-11-30PR c++/82219 - bogus -Wignored-qualifiers with templateJason Merrill2-0/+7
* pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Suppress -Wignored-qualifiers. From-SVN: r255279
2017-11-29C++: improve location of static_assert errorsDavid Malcolm2-13/+51
gcc/cp/ChangeLog: * parser.c (cp_parser_unary_expression): Generate a location for "noexcept". (cp_parser_trait_expr): Generate and return a location_t, converting the return type from tree to cp_expr. (cp_parser_static_assert): Pass location of the condition to finish_static_assert, rather than that of the "static_assert" token, where available. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/static_assert3.C: New test case. libstdc++-v3/ChangeLog: * testsuite/20_util/duration/literals/range.cc: Update expected line of a static_assert failure. From-SVN: r255255
2017-11-29re PR c++/82293 (ICE in nonlambda_method_basetype at gcc/cp/lambda.c:886)Paolo Carlini2-2/+8
/cp 2017-11-29 Paolo Carlini <paolo.carlini@oracle.com> PR c++/82293 * lambda.c (nonlambda_method_basetype): Don't use LAMBDA_TYPE_P on a null type. /testsuite 2017-11-29 Paolo Carlini <paolo.carlini@oracle.com> PR c++/82293 * g++.dg/cpp0x/lambda/lambda-ice24.C: New. From-SVN: r255254
2017-11-29PR c++/82760 - memory corruption with aligned new.Jason Merrill2-0/+8
* call.c (build_operator_new_call): Update *args if we add the align_arg. From-SVN: r255253
2017-11-28re PR sanitizer/81275 (-fsanitize=thread produce incorrect -Wreturn-type ↵Jakub Jelinek8-3/+131
warning) PR sanitizer/81275 * cp-tree.h (SWITCH_STMT_ALL_CASES_P): Define. (SWITCH_STMT_NO_BREAK_P): Define. (note_break_stmt, note_iteration_stmt_body_start, note_iteration_stmt_body_end): Declare. * decl.c (struct cp_switch): Add has_default_p, break_stmt_seen_p and in_loop_body_p fields. (push_switch): Clear them. (pop_switch): Set SWITCH_STMT_CANNOT_FALLTHRU_P if has_default_p and !break_stmt_seen_p. Assert in_loop_body_p is false. (note_break_stmt, note_iteration_stmt_body_start, note_iteration_stmt_body_end): New functions. (finish_case_label): Set has_default_p when both low and high are NULL_TREE. * parser.c (cp_parser_iteration_statement): Use note_iteration_stmt_body_start and note_iteration_stmt_body_end around parsing iteration body. * pt.c (tsubst_expr): Likewise. * cp-objcp-common.c (cxx_block_may_fallthru): Return false for SWITCH_STMT which contains no BREAK_STMTs, contains a default: CASE_LABEL_EXPR and where SWITCH_STMT_BODY isn't empty and can't fallthru. * semantics.c (finish_break_stmt): Call note_break_stmt. * cp-gimplify.c (genericize_switch_stmt): Copy SWITCH_STMT_ALL_CASES_P bit to SWITCH_ALL_CASES_P. Assert that if SWITCH_STMT_NO_BREAK_P then the break label is not TREE_USED. * g++.dg/warn/pr81275-1.C: New test. * g++.dg/warn/pr81275-2.C: New test. * g++.dg/warn/pr81275-3.C: New test. * c-c++-common/tsan/pr81275.c: Skip for C++ and -O2. From-SVN: r255218
2017-11-28Remove Cilk Plus support.Julia Koval19-2889/+82
* Makefile.def (target_modules): Remove libcilkrts. * Makefile.in: Ditto. * configure: Ditto. * configure.ac: Ditto. contrib/ * contrib/gcc_update: Ditto. gcc/ * Makefile.in (cilkplus.def, cilk-builtins.def, c-family/cilk.o, c-family/c-cilkplus.o, c-family/array-notation-common.o, cilk-common.o, cilk.h, cilk-common.c): Remove. * builtin-types.def (BT_FN_INT_PTR_PTR_PTR_FTYPE_BT_INT_BT_PTR_BT_PTR_BT_PTR): Remove. * builtins.c (is_builtin_name): Remove cilkplus condition. (BUILT_IN_CILK_DETACH, BUILT_IN_CILK_POP_FRAME): Remove. * builtins.def (DEF_CILK_BUILTIN_STUB, DEF_CILKPLUS_BUILTIN, cilk-builtins.def, cilkplus.def): Remove. * cif-code.def (CILK_SPAWN): Remove. * cilk-builtins.def: Delete. * cilk-common.c: Ditto. * cilk.h: Ditto. * cilkplus.def: Ditto. * config/darwin.h (fcilkplus): Delete. * cppbuiltin.c: Ditto. * doc/extend.texi: Remove cilkplus doc. * doc/generic.texi: Ditto. * doc/invoke.texi: Ditto. * doc/passes.texi: Ditto. * gcc.c (fcilkplus): Remove. * gengtype.c (cilk.h): Remove. * gimple-pretty-print.c (dump_gimple_omp_for): Remove cilkplus support. * gimple.h (GF_OMP_FOR_KIND_CILKFOR, GF_OMP_FOR_KIND_CILKSIMD): Remove. * gimplify.c (gimplify_return_expr, maybe_fold_stmt, gimplify_call_expr, is_gimple_stmt, gimplify_modify_expr, gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses, gimplify_omp_for, gimplify_expr): Remove cilkplus conditions. * ipa-fnsummary.c (ipa_dump_fn_summary, compute_fn_summary, inline_read_section): Ditto. * ipa-inline-analysis.c (cilk.h): Remove. * ira.c (ira_setup_eliminable_regset): Remove cilkplus support. * lto-wrapper.c (merge_and_complain, append_compiler_options, append_linker_options): Remove condition for fcilkplus. * lto/lto-lang.c (cilk.h): Remove. (lto_init): Remove condition for fcilkplus. * omp-expand.c (expand_cilk_for_call): Delete. (expand_omp_taskreg, expand_omp_for_static_chunk, expand_omp_for): Remove cilkplus conditions. (expand_cilk_for): Delete. * omp-general.c (omp_extract_for_data): Remove cilkplus support. * omp-low.c (scan_sharing_clauses, create_omp_child_function, execute_lower_omp, diagnose_sb_0): Ditto. * omp-simd-clone.c (simd_clone_clauses_extract): Ditto. * tree-core.h (OMP_CLAUSE__CILK_FOR_COUNT_): Delete. * tree-nested.c: Ditto. * tree-pretty-print.c (dump_omp_clause): Remove cilkplus support. (dump_generic_node): Ditto. * tree.c (OMP_CLAUSE__CILK_FOR_COUNT_): Delete. * tree.def (cilk_simd, cilk_for, cilk_spawn_stmt, cilk_sync_stmt): Delete. * tree.h (CILK_SPAWN_FN, EXPR_CILK_SPAWN): Delete. gcc/c-family/ * array-notation-common.c: Delete. * c-cilkplus.c: Ditto. * c-common.c (_Cilk_spawn, _Cilk_sync, _Cilk_for): Remove. * c-common.def (ARRAY_NOTATION_REF): Remove. * c-common.h (RID_CILK_SPAWN, build_array_notation_expr, build_array_notation_ref, C_ORT_CILK, c_check_cilk_loop, c_validate_cilk_plus_loop, cilkplus_an_parts, cilk_ignorable_spawn_rhs_op, cilk_recognize_spawn): Remove. * c-gimplify.c (CILK_SPAWN_STMT): Remove. * c-omp.c: Remove CILK_SIMD check. * c-pragma.c: Ditto. * c-pragma.h: Remove CILK related pragmas. * c-pretty-print.c (c_pretty_printer::postfix_expression): Remove ARRAY_NOTATION_REF condition. (c_pretty_printer::expression): Ditto. * c.opt (fcilkplus): Remove. * cilk.c: Delete. gcc/c/ * Make-lang.in (c/c-array-notation.o): Remove. * c-array-notation.c: Delete. * c-decl.c: Remove cilkplus condition. * c-parser.c (c_parser_cilk_simd, c_parser_cilk_for, c_parser_cilk_verify_simd, c_parser_array_notation, c_parser_cilk_clause_vectorlength, c_parser_cilk_grainsize, c_parser_cilk_simd_fn_vector_attrs, c_finish_cilk_simd_fn_tokens): Delete. (c_parser_declaration_or_fndef): Remove cilkplus condition. (c_parser_direct_declarator_inner): Ditto. (CILK_SIMD_FN_CLAUSE_MASK): Delete. (c_parser_attributes, c_parser_compound_statement, c_parser_statement_after_labels, c_parser_if_statement, c_parser_switch_statement, c_parser_while_statement, c_parser_do_statement, c_parser_for_statement, c_parser_unary_expression, c_parser_postfix_expression, c_parser_postfix_expression_after_primary, c_parser_pragma, c_parser_omp_clause_name, c_parser_omp_all_clauses, c_parser_omp_for_loop, c_finish_omp_declare_simd): Remove cilkplus support. * c-typeck.c (build_array_ref, build_function_call_vec, convert_arguments, lvalue_p, build_compound_expr, c_finish_return, c_finish_if_stmt, c_finish_loop, build_binary_op): Remove cilkplus support. gcc/cp/ * Make-lang.in (cp/cp-array-notation.o, cp/cp-cilkplus.o): Delete. * call.c (convert_for_arg_passing, build_cxx_call): Remove cilkplus. * constexpr.c (potential_constant_expression_1): Ditto. * cp-array-notation.c: Delete. * cp-cilkplus.c: Ditto. * cp-cilkplus.h: Ditto. * cp-gimplify.c (cp_gimplify_expr, cp_fold_r, cp_genericize): Remove cilkplus condition. * cp-objcp-common.c (ARRAY_NOTATION_REF): Delete. * cp-tree.h (cilkplus_an_triplet_types_ok_p): Delete. * decl.c (grokfndecl, finish_function): Remove cilkplus condition. * error.c (dump_decl, dump_expr): Remove ARRAY_NOTATION_REF condition. * lambda.c (cp-cilkplus.h): Remove. * parser.c (cp_parser_cilk_simd, cp_parser_cilk_for, cp_parser_cilk_simd_vectorlength): Delete. (cp_debug_parser, cp_parser_ctor_initializer_opt_and_function_body, cp_parser_postfix_expression, cp_parser_postfix_open_square_expression, cp_parser_statement, cp_parser_jump_statement, cp_parser_direct_declarator, cp_parser_late_return_type_opt, cp_parser_gnu_attribute_list, cp_parser_omp_clause_name, cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear, cp_parser_omp_all_clauses, cp_parser_omp_flush, cp_parser_omp_for_cond, cp_parser_omp_for_incr, cp_parser_omp_for_loop_init, cp_parser_omp_for_loop, cp_parser_omp_declare_simd): Remove cilkplus support. (CILK_SIMD_FN_CLAUSE_MASK, cp_parser_late_parsing_cilk_simd_fn_info, cp_parser_cilk_grainsize): Remove. (cp_parser_pragma, c_parse_file): Remove cilkplus support. (cp_parser_cilk_simd_vectorlength, cp_parser_cilk_simd_linear, cp_parser_cilk_simd_clause_name, cp_parser_cilk_simd_all_clauses, cp_parser_cilk_simd, cp_parser_cilk_for): Remove. * parser.h (IN_CILK_SIMD_FOR, IN_CILK_SPAWN): Remove. * pt.c (tsubst_attribute, tsubst_expr, tsubst_copy_and_build): Remove cilkplus support. * semantics.c (finish_goto_stmt, begin_while_stmt, finish_do_body, finish_init_stmt, finish_switch_cond, simplify_aggr_init_expr, finish_omp_clauses, finish_omp_clauses, finish_omp_for): Remove cilkplus support. * tree.c (lvalue_kind): Remove ARRAY_NOTATION_REF conditon. * typeck.c (cp_build_array_ref, cp_build_compound_expr, check_return_expr): Remove cilkplus support. gcc/testsuite/ * c-c++-common/attr-simd-3.c: Delete. * c-c++-common/cilk-plus/AN/an-if.c: Delete. * c-c++-common/cilk-plus/AN/array_test1.c: Delete. * c-c++-common/cilk-plus/AN/array_test2.c: Delete. * c-c++-common/cilk-plus/AN/array_test_ND.c: Delete. * c-c++-common/cilk-plus/AN/builtin_fn_custom.c: Delete. * c-c++-common/cilk-plus/AN/builtin_fn_mutating.c: Delete. * c-c++-common/cilk-plus/AN/builtin_func_double.c: Delete. * c-c++-common/cilk-plus/AN/builtin_func_double2.c: Delete. * c-c++-common/cilk-plus/AN/comma_exp.c: Delete. * c-c++-common/cilk-plus/AN/conditional.c: Delete. * c-c++-common/cilk-plus/AN/decl-ptr-colon.c: Delete. * c-c++-common/cilk-plus/AN/dimensionless-arrays.c: Delete. * c-c++-common/cilk-plus/AN/exec-once.c: Delete. * c-c++-common/cilk-plus/AN/exec-once2.c: Delete. * c-c++-common/cilk-plus/AN/fn_ptr-2.c: Delete. * c-c++-common/cilk-plus/AN/fn_ptr.c: Delete. * c-c++-common/cilk-plus/AN/fp_triplet_values.c: Delete. * c-c++-common/cilk-plus/AN/gather-scatter-errors.c: Delete. * c-c++-common/cilk-plus/AN/gather_scatter.c: Delete. * c-c++-common/cilk-plus/AN/if_test.c: Delete. * c-c++-common/cilk-plus/AN/if_test_errors.c: Delete. * c-c++-common/cilk-plus/AN/misc.c: Delete. * c-c++-common/cilk-plus/AN/n-ptr-test.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors2.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors3.c: Delete. * c-c++-common/cilk-plus/AN/parser_errors4.c: Delete. * c-c++-common/cilk-plus/AN/pr57457-2.c: Delete. * c-c++-common/cilk-plus/AN/pr57457.c: Delete. * c-c++-common/cilk-plus/AN/pr57490.c: Delete. * c-c++-common/cilk-plus/AN/pr57541-2.c: Delete. * c-c++-common/cilk-plus/AN/pr57541.c: Delete. * c-c++-common/cilk-plus/AN/pr57577.c: Delete. * c-c++-common/cilk-plus/AN/pr58942.c: Delete. * c-c++-common/cilk-plus/AN/pr61191.c: Delete. * c-c++-common/cilk-plus/AN/pr61455-2.c: Delete. * c-c++-common/cilk-plus/AN/pr61455.c: Delete. * c-c++-common/cilk-plus/AN/pr61962.c: Delete. * c-c++-common/cilk-plus/AN/pr61963.c: Delete. * c-c++-common/cilk-plus/AN/pr62008.c: Delete. * c-c++-common/cilk-plus/AN/pr63884.c: Delete. * c-c++-common/cilk-plus/AN/rank_mismatch.c: Delete. * c-c++-common/cilk-plus/AN/rank_mismatch2.c: Delete. * c-c++-common/cilk-plus/AN/rank_mismatch3.c: Delete. * c-c++-common/cilk-plus/AN/sec_implicit.c: Delete. * c-c++-common/cilk-plus/AN/sec_implicit2.c: Delete. * c-c++-common/cilk-plus/AN/sec_implicit_ex.c: Delete. * c-c++-common/cilk-plus/AN/sec_reduce_ind_same_value.c: Delete. * c-c++-common/cilk-plus/AN/sec_reduce_max_min_ind.c: Delete. * c-c++-common/cilk-plus/AN/sec_reduce_return.c: Delete. * c-c++-common/cilk-plus/AN/side-effects-1.c: Delete. * c-c++-common/cilk-plus/AN/test_builtin_return.c: Delete. * c-c++-common/cilk-plus/AN/test_sec_limits.c: Delete. * c-c++-common/cilk-plus/AN/tst_lngth.c: Delete. * c-c++-common/cilk-plus/AN/vla.c: Delete. * c-c++-common/cilk-plus/CK/Wparentheses-1.c: Delete. * c-c++-common/cilk-plus/CK/cilk-for-2.c: Delete. * c-c++-common/cilk-plus/CK/cilk-for-3.c: Delete. * c-c++-common/cilk-plus/CK/cilk-fors.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_errors.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_grain.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_grain_errors.c: Delete. * c-c++-common/cilk-plus/CK/cilk_for_ptr_iter.c: Delete. * c-c++-common/cilk-plus/CK/compound_cilk_spawn.c: Delete. * c-c++-common/cilk-plus/CK/concec_cilk_spawn.c: Delete. * c-c++-common/cilk-plus/CK/errors.c: Delete. * c-c++-common/cilk-plus/CK/fib.c: Delete. * c-c++-common/cilk-plus/CK/fib_init_expr_xy.c: Delete. * c-c++-common/cilk-plus/CK/fib_no_return.c: Delete. * c-c++-common/cilk-plus/CK/fib_no_sync.c: Delete. * c-c++-common/cilk-plus/CK/invalid_spawns.c: Delete. * c-c++-common/cilk-plus/CK/invalid_sync.c: Delete.c * c-c++-common/cilk-plus/CK/nested_cilk_for.c: Delete. * c-c++-common/cilk-plus/CK/no_args_error.c: Delete. * c-c++-common/cilk-plus/CK/pr59631.c: Delete. * c-c++-common/cilk-plus/CK/pr60197-2.c: Delete. * c-c++-common/cilk-plus/CK/pr60197.c: Delete. * c-c++-common/cilk-plus/CK/pr60469.c: Delete. * c-c++-common/cilk-plus/CK/pr60586.c: Delete. * c-c++-common/cilk-plus/CK/pr63307.c: Delete. * c-c++-common/cilk-plus/CK/pr69826-1.c: Delete. * c-c++-common/cilk-plus/CK/pr69826-2.c: Delete. * c-c++-common/cilk-plus/CK/pr79428-4.c: Delete. * c-c++-common/cilk-plus/CK/pr79428-7.c: Delete. * c-c++-common/cilk-plus/CK/spawn_in_return.c: Delete. * c-c++-common/cilk-plus/CK/spawnee_inline.c: Delete. * c-c++-common/cilk-plus/CK/spawner_inline.c: Delete. * c-c++-common/cilk-plus/CK/spawning_arg.c: Delete. * c-c++-common/cilk-plus/CK/steal_check.c: Delete. * c-c++-common/cilk-plus/CK/sync_wo_spawn.c: Delete. * c-c++-common/cilk-plus/CK/test__cilk.c: Delete. * c-c++-common/cilk-plus/CK/varargs_test.c: Delete. * c-c++-common/cilk-plus/PS/Wparentheses-1.c: Delete. * c-c++-common/cilk-plus/PS/body.c: Delete. * c-c++-common/cilk-plus/PS/clauses1.c: Delete. * c-c++-common/cilk-plus/PS/clauses2.c: Delete. * c-c++-common/cilk-plus/PS/clauses3.c: Delete. * c-c++-common/cilk-plus/PS/clauses4.c: Delete. * c-c++-common/cilk-plus/PS/for1.c: Delete. * c-c++-common/cilk-plus/PS/for2.c: Delete. * c-c++-common/cilk-plus/PS/for3.c: Delete. * c-c++-common/cilk-plus/PS/pr69363.c: Delete. * c-c++-common/cilk-plus/PS/reduction-1.c: Delete. * c-c++-common/cilk-plus/PS/reduction-2.c: Delete. * c-c++-common/cilk-plus/PS/reduction-3.c: Delete. * c-c++-common/cilk-plus/PS/run-1.c: Delete. * c-c++-common/cilk-plus/PS/safelen.c: Delete. * c-c++-common/cilk-plus/PS/vectorlength-2.c: Delete. * c-c++-common/cilk-plus/PS/vectorlength-3.c: Delete. * c-c++-common/cilk-plus/PS/vectorlength.c: Delete. * c-c++-common/cilk-plus/SE/ef_error.c: Delete. * c-c++-common/cilk-plus/SE/ef_error2.c: Delete. * c-c++-common/cilk-plus/SE/ef_error3.c: Delete. * c-c++-common/cilk-plus/SE/ef_test.c: Delete. * c-c++-common/cilk-plus/SE/ef_test2.c: Delete. * c-c++-common/cilk-plus/SE/vlength_errors.c: Delete. * g++.dg/cilk-plus/AN/array_function.c: Delete. * g++.dg/cilk-plus/AN/array_test1_tplt.c: Delete. * g++.dg/cilk-plus/AN/array_test2_tplt.c: Delete. * g++.dg/cilk-plus/AN/array_test_ND_tplt.c: Delete. * g++.dg/cilk-plus/AN/braced_list.c: Delete. * g++.dg/cilk-plus/AN/builtin_fn_custom_tplt.c: Delete. * g++.dg/cilk-plus/AN/builtin_fn_mutating_tplt.c: Delete. * g++.dg/cilk-plus/AN/fp_triplet_values_tplt.c: Delete. * g++.dg/cilk-plus/AN/postincr_test.c: Delete. * g++.dg/cilk-plus/AN/preincr_test.c: Delete. * g++.dg/cilk-plus/CK/catch_exc.c: Delete. * g++.dg/cilk-plus/CK/cf3.c: Delete. * g++.dg/cilk-plus/CK/cilk-for-tplt.c: Delete. * g++.dg/cilk-plus/CK/const_spawn.c: Delete. * g++.dg/cilk-plus/CK/fib-opr-overload.c: Delete. * g++.dg/cilk-plus/CK/fib-tplt.c: Delete. * g++.dg/cilk-plus/CK/for1.c: Delete. * g++.dg/cilk-plus/CK/lambda_spawns.c: Delete. * g++.dg/cilk-plus/CK/lambda_spawns_tplt.c: Delete. * g++.dg/cilk-plus/CK/pr60586.c: Delete. * g++.dg/cilk-plus/CK/pr66326.c: Delete. * g++.dg/cilk-plus/CK/pr68001.c: Delete. * g++.dg/cilk-plus/CK/pr68997.c: Delete. * g++.dg/cilk-plus/CK/pr69024.c: Delete. * g++.dg/cilk-plus/CK/pr69048.c: Delete. * g++.dg/cilk-plus/CK/pr69267.c: Delete. * g++.dg/cilk-plus/CK/pr80038.c: Delete. * g++.dg/cilk-plus/CK/stl_iter.c: Delete. * g++.dg/cilk-plus/CK/stl_rev_iter.c: Delete. * g++.dg/cilk-plus/CK/stl_test.c: Delete. * g++.dg/cilk-plus/cilk-plus.exp * g++.dg/cilk-plus/ef_test.C: Delete. * g++.dg/cilk-plus/for.C: Delete. * g++.dg/cilk-plus/for2.C: Delete. * g++.dg/cilk-plus/for3.C: Delete. * g++.dg/cilk-plus/for4.C: Delete. * g++.dg/cilk-plus/pr60967.C: Delete. * g++.dg/cilk-plus/pr69028.C: Delete. * g++.dg/cilk-plus/pr70565.C: Delete. * g++.dg/pr57662.C: Delete. * gcc.dg/cilk-plus/cilk-plus.exp * gcc.dg/cilk-plus/for1.c: Delete. * gcc.dg/cilk-plus/for2.c: Delete. * gcc.dg/cilk-plus/jump-openmp.c: Delete. * gcc.dg/cilk-plus/jump.c: Delete. * gcc.dg/cilk-plus/pr69798-1.c: Delete. * gcc.dg/cilk-plus/pr69798-2.c: Delete. * gcc.dg/cilk-plus/pr78306.c: Delete. * gcc.dg/cilk-plus/pr79116.c: Delete. * gcc.dg/graphite/id-28.c: Delete. * lib/cilk-plus-dg.exp: Delete. * lib/target-supports.exp (cilkplus_runtime): Delete. Co-Authored-By: Sebastian Peryt <sebastian.peryt@intel.com> From-SVN: r255195
2017-11-28tree.def (SWITCH_EXPR): Change from 3 operand to 2 operand tree.Jakub Jelinek2-1/+6
* tree.def (SWITCH_EXPR): Change from 3 operand to 2 operand tree. Adjust comment. * tree.h (SWITCH_LABELS): Remove. * gimplify.c (gimplify_switch_expr): Don't test SWITCH_LABELS, assert SWITCH_BODY is non-NULL. * tree-pretty-print.c (dump_generic_node): Remove SWITCH_LABELS handling. * tree.c (block_may_fallthru): Always return true; for SWITCH_EXPR. c/ * c-typeck.c (c_start_case): Build SWITCH_EXPR using build2 instead of build3. cp/ * cp-gimplify.c (genericize_switch_stmt): Build SWITCH_EXPR using build2_loc instead of build3_loc. ada/ * gcc-interface/trans.c (Case_Statement_to_gnu): Build SWITCH_EXPR using build2 instead of build3. jit/ * jit-playback.c (add_switch): Build SWITCH_EXPR using build2 instead of build3. Formatting fixes. Adjust funciton comment. fortran/ * trans-decl.c (gfc_trans_entry_master_switch): Build SWITCH_EXPR using fold_build2_loc instead of fold_build3_loc. * trans-io.c (io_result): Likewise. * trans-stmt.c (gfc_trans_integer_select, gfc_trans_character_select): Likewise. go/ * go-gcc.cc (Gcc_backend::switch_statement): Build SWITCH_EXPR using build2_loc instead of build3_loc. brig/ * brigfrontend/brig-branch-inst-handler.cc (brig_branch_inst_handler::operator): Build SWITCH_EXPR using build2 instead of build3. From-SVN: r255192
2017-11-27PR c++/83058 - ICE on C++ code with negative array index: in ↵Martin Sebor2-56/+71
warn_placement_new_too_small gcc/cp/ChangeLog: PR c++/83058 * init.c (warn_placement_new_too_small): Use offset_int instead of HOST_WIDE_INT. gcc/testsuite/ChangeLog: PR c++/83058 * g++.dg/warn/Wplacement-new-size-5.C: New test. From-SVN: r255182
2017-11-27re PR c++/81888 (Structured bindings stopped working)Jakub Jelinek2-1/+9
PR c++/81888 * parser.c (cp_parser_decomposition_declaration): Reject just BRACE_ENCLOSED_INITIALIZER_P initializers with nelts != 1 rather than all such CONSTRUCTORs, and only if is_direct_init is true. * g++.dg/cpp1z/decomp30.C: Add a test for structured binding with = {} and = { a, a } initializers. * g++.dg/cpp1z/decomp31.C: New test. From-SVN: r255180
2017-11-27pt.c (primary_template_specialization_p): Rename fromJason Merrill4-14/+23
* pt.c (primary_template_specialization_p): Rename from primary_template_instantiation_p. Don't check DECL_TEMPLATE_INSTANTIATION. * call.c, cp-tree.h, decl2.c: Adjust. From-SVN: r255179
2017-11-27re PR c++/81675 (attribute(noreturn) of destructor in :? not honored)Jakub Jelinek2-8/+35
PR c++/81675 * cp-gimplify.c (cp_fold) <case COND_EXPR>: Don't return immediately for VOID_TYPE_P COND_EXPRs, instead fold the operands and if op0 is INTEGER_CST, ensure that both op1 and op2 are non-NULL and fall through into normal folding, otherwise just rebuild x if any op changed. * g++.dg/warn/pr81675.C: New test. From-SVN: r255167
2017-11-26Plugin support on Windows/MinGWBoris Kolpackov2-0/+9
config/ChangeLog: 2017-11-14 Boris Kolpackov <boris@codesynthesis.com> * gcc-plugin.m4: Add support for MinGW. gcc/ChangeLog: 2017-11-14 Boris Kolpackov <boris@codesynthesis.com> * plugin.c (add_new_plugin): Use platform-specific library extensions. (try_init_one_plugin): Alternative implementation for MinGW. * Makefile.in (plugin_implib): New. (gengtype-lex.c): Fix broken AIX workaround. * configure: Regenerate. * doc/plugins.texi: Document support for MinGW. gcc/c/ChangeLog: 2017-11-14 Boris Kolpackov <boris@codesynthesis.com> * Make-lang.in (c.install-plugin): Install backend import library. gcc/cp/ChangeLog: 2017-11-14 Boris Kolpackov <boris@codesynthesis.com> * Make-lang.in (c++.install-plugin): Install backend import library. libcc1/ChangeLog: 2017-11-14 Boris Kolpackov <boris@codesynthesis.com> * configure: Regenerate. From-SVN: r255154
2017-11-23parser.c (cp_parser_omp_declare): Change return type to bool from void, ↵Jakub Jelinek2-7/+14
return true for declare simd. * parser.c (cp_parser_omp_declare): Change return type to bool from void, return true for declare simd. (cp_parser_pragma): Return cp_parser_omp_declare returned value rather than always false. From-SVN: r255117
2017-11-23generic.texi (ANNOTATE_EXPR): Document 3rd operand.Eric Botcazou3-8/+22
* doc/generic.texi (ANNOTATE_EXPR): Document 3rd operand. * cfgloop.h (struct loop): Add unroll field. * function.h (struct function): Add has_unroll bitfield. * gimplify.c (gimple_boolify) <ANNOTATE_EXPR>: Deal with unroll kind. (gimplify_expr) <ANNOTATE_EXPR>: Propagate 3rd operand. * loop-init.c (pass_loop2::gate): Return true if cfun->has_unroll. (pass_rtl_unroll_loops::gate): Likewise. * loop-unroll.c (decide_unrolling): Tweak note message. Skip loops for which loop->unroll==1. (decide_unroll_constant_iterations): Use note for consistency and take loop->unroll into account. Return early if loop->unroll is set. Fix thinko in existing test. (decide_unroll_runtime_iterations): Use note for consistency and take loop->unroll into account. (decide_unroll_stupid): Likewise. * lto-streamer-in.c (input_cfg): Read loop->unroll. * lto-streamer-out.c (output_cfg): Write loop->unroll. * tree-cfg.c (replace_loop_annotate_in_block) <annot_expr_unroll_kind>: New case. (replace_loop_annotate) <annot_expr_unroll_kind>: Likewise. (print_loop): Print loop->unroll if set. * tree-core.h (enum annot_expr_kind): Add annot_expr_unroll_kind. * tree-inline.c (copy_loops): Copy unroll and set cfun->has_unroll. * tree-pretty-print.c (dump_generic_node) <annot_expr_unroll_kind>: New case. * tree-ssa-loop-ivcanon.c (try_unroll_loop_completely): Bail out if loop->unroll is set and smaller than the trip count. Otherwise bypass entirely the heuristics if loop->unroll is set. Remove dead note. Fix off-by-one bug in other note. (try_peel_loop): Bail out if loop->unroll is set. Fix formatting. (tree_unroll_loops_completely_1): Force unrolling if loop->unroll is greater than 1. (tree_unroll_loops_completely): Make static. (pass_complete_unroll::execute): Use correct type for variable. (pass_complete_unrolli::execute): Fix formatting. * tree.def (ANNOTATE_EXPR): Add 3rd operand. ada/ * gcc-interface/trans.c (gnat_gimplify_stmt) <LOOP_STMT>: Pass 3rd operand to ANNOTATE_EXPR and also pass unrolling hints. c/ * c-parser.c (c_parser_while_statement): Pass 3rd operand to ANNOTATE_EXPR. (c_parser_do_statement): Likewise. (c_parser_for_statement): Likewise. cp/ * pt.c (tsubst_expr) <ANNOTATE_EXPR>: Recurse on 3rd operand. * semantics.c (finish_while_stmt_cond): Pass 3rd operand to ANNOTATE_EXPR. (finish_do_stmt): Likewise. (finish_for_cond): Likewise. fortran/ * trans-stmt.c (gfc_trans_forall_loop): Pass 3rd operand to ANNOTATE_EXPR. From-SVN: r255106
2017-11-22re PR c++/82401 (error: qsort comparator non-negative on sorted output: 1 in ↵Jakub Jelinek2-1/+9
insert_late_enum_def_bindings on an invalid code) PR c++/82401 * name-lookup.c (member_name_cmp): Return 0 if a == b. * g++.dg/cpp0x/pr82401.C: New test. From-SVN: r255084
2017-11-22C/C++: fix quoting of "aka" typedef information (PR 62170)David Malcolm2-18/+93
PR 62170 describes a problem with how the quoting in pp_format interacts with the "aka" information for typedefs in %qT for the C family of frontends, and also now for %qH and %qI in the C++ frontend: we print: 'Py_ssize_t* {aka int*}' ^^^^^^^^^^^^^^^^^^^^^^ colorized as "quote" i.e. '[START_COLOR]Py_ssize_t* {aka int*}[END_COLOR]' when we should print: 'Py_ssize_t*' {aka 'int*'} ^^^^^^^^^^^ ^^^^ colorized as "quote" i.e. '[START_COLOR]Py_ssize_t*[END_COLOR]' {aka '[START_COLOR]int*[END_COLOR]'} where the opening and closing quote characters and colorization are added by the 'q' handling within pp_format. This patch fixes the quoting by updating the %T handling in C and C++ and the %H/%I handling in C++ to insert the quoting appropriately. It converts the "quote" param of the pp_format_decoder callback from bool to bool *, allowing for the %T and %H/%I handlers to write false back to it, to avoid printing the closing quote for the cases like the above where the trailing closing quote isn't needed. It introduces pp_begin_quote/pp_end_quote to simplify this. These take a "bool show_color", rather than using "pp_show_color (pp)" since cxx_pp's pp_show_color isn't currently initialized (since cxx_initialize_diagnostics happens before diagnostic_color_init). gcc/c/ChangeLog: PR c++/62170 * c-objc-common.c (c_tree_printer): Convert penultimate param from bool to bool *. Within '%T' handling, if showing an "aka", use "quoted" param to add appropriate quoting. gcc/cp/ChangeLog: PR c++/62170 * error.c (type_to_string): Add leading comment. Add params "postprocessed", "quote", and "show_color", using them to fix quoting of the "aka" for types involving typedefs. (arg_to_string): Update for new params to type_to_string. (cxx_format_postprocessor::handle): Likewise. (cp_printer): Convert penultimate param from bool to bool *. Update call to type_to_string and calls to defer_phase_2_of_type_diff. gcc/fortran/ChangeLog: PR c++/62170 * error.c (gfc_notify_std): Convert "quoted" param from bool to bool *. gcc/ChangeLog: PR c++/62170 * pretty-print.c (pp_format): Move quoting implementation to pp_begin_quote and pp_end_quote. Update pp_format_decoder call to pass address of "quote" local. (pp_begin_quote): New function. (pp_end_quote): New function. * pretty-print.h (printer_fn): Convert penultimate param from bool to bool *. (pp_begin_quote): New decl. (pp_end_quote): New decl. * tree-diagnostic.c (default_tree_printer): Convert penultimate param from bool to bool *. * tree-diagnostic.h (default_tree_printer): Likewise. gcc/testsuite/ChangeLog: PR c++/62170 * g++.dg/diagnostic/aka1.C: Update expected error messages to reflect fixes to quoting. * g++.dg/diagnostic/aka2.C: New test case. * g++.dg/parse/error55.C: Update expected error messages to reflect fixes to quoting. * gcc.dg/diag-aka-1.c: Likewise. * gcc.dg/diag-aka-2.c: New test case. * gcc.dg/pr13804-1.c: Update expected error messages to reflect fixes to quoting. * gcc.dg/pr56980.c: Likewise. * gcc.dg/pr65050.c: Likewise. * gcc.dg/redecl-14.c: Likewise. * gcc.dg/utf16-4.c Likewise. * gcc.target/i386/sse-vect-types.c (__m128d): Likewise. * obj-c++.dg/invalid-type-1.mm: Likewise. * objc.dg/proto-lossage-4.m: Likewise. From-SVN: r255076
2017-11-22re PR c++/60336 (empty struct value is passed differently in C and C++)Marek Polacek3-1/+18
PR c++/60336 PR middle-end/67239 PR target/68355 * c-decl.c (grokdeclarator): Set DECL_PADDING_P on unnamed bit-fields. * class.c (layout_class_type): Set DECL_PADDING_P on padding. * decl.c (cxx_init_decl_processing): Set TRANSLATION_UNIT_WARN_EMPTY_P. (grokdeclarator): Set DECL_PADDING_P on unnamed bit-fields. * lto.c (compare_tree_sccs_1): Compare TYPE_EMPTY_P and DECL_PADDING_P. * calls.c (initialize_argument_information): Call warn_parameter_passing_abi target hook. (store_one_arg): Use 0 for empty record size. Don't push 0 size argument onto stack. (must_pass_in_stack_var_size_or_pad): Return false for empty types. * common.opt: Update -fabi-version description. * config/i386/i386.c (init_cumulative_args): Set cum->warn_empty. (ix86_gimplify_va_arg): Call arg_int_size_in_bytes instead of int_size_in_bytes. (ix86_is_empty_record): New function. (ix86_warn_parameter_passing_abi): New function. (TARGET_EMPTY_RECORD_P): Redefine. (TARGET_WARN_PARAMETER_PASSING_ABI): Redefine. * config/i386/i386.h (CUMULATIVE_ARGS): Add warn_empty. * doc/tm.texi: Regenerated. * doc/tm.texi.in (TARGET_EMPTY_RECORD_P, TARGET_WARN_PARAMETER_PASSING_ABI): Add. * dwarf2out.c (get_ultimate_context): Move to tree.c. * explow.c (hard_function_value): Call arg_int_size_in_bytes instead of int_size_in_bytes. * expr.c (copy_blkmode_to_reg): Likewise. * function.c (aggregate_value_p): Return 0 for empty types. (assign_parm_find_entry_rtl): Call warn_parameter_passing_abi target hook. (locate_and_pad_parm): Call arg size_in_bytes instead size_in_bytes. * lto-streamer-out.c (hash_tree): Hash TYPE_EMPTY_P and DECL_PADDING_P. * stor-layout.c (finalize_type_size): Set TYPE_EMPTY_P. * target.def (empty_record_p, warn_parameter_passing_abi): New target hooks. * targhooks.c (hook_void_CUMULATIVE_ARGS_tree): New hook. (std_gimplify_va_arg_expr): Skip empty records. Call arg_size_in_bytes instead size_in_bytes. * targhooks.h (hook_void_CUMULATIVE_ARGS_tree): Declare. * tree-core.h (tree_type_common): Add empty_flag. (tree_decl_common): Update comments. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Stream DECL_PADDING_P. (unpack_ts_type_common_value_fields): Stream TYPE_EMPTY_P. * tree-streamer-out.c (pack_ts_decl_common_value_fields): Stream DECL_PADDING_P. (pack_ts_type_common_value_fields): Stream TYPE_EMPTY_P. * tree.c (default_is_empty_type): New function. (default_is_empty_record): New function. (arg_int_size_in_bytes): New function. (arg_size_in_bytes): New function. (get_ultimate_context): New function. * tree.h: Define TYPE_EMPTY_P, DECL_PADDING_P and TRANSLATION_UNIT_WARN_EMPTY_P. (default_is_empty_record, arg_int_size_in_bytes, arg_size_in_bytes, get_ultimate_context): Declare. * g++.dg/abi/empty12.C: New test. * g++.dg/abi/empty12.h: New test. * g++.dg/abi/empty12a.c: New test. * g++.dg/abi/empty13.C: New test. * g++.dg/abi/empty13.h: New test. * g++.dg/abi/empty13a.c: New test. * g++.dg/abi/empty14.C: New test. * g++.dg/abi/empty14.h: New test. * g++.dg/abi/empty14a.c: New test. * g++.dg/abi/empty15.C: New test. * g++.dg/abi/empty15.h: New test. * g++.dg/abi/empty15a.c: New test. * g++.dg/abi/empty16.C: New test. * g++.dg/abi/empty16.h: New test. * g++.dg/abi/empty16a.c: New test. * g++.dg/abi/empty17.C: New test. * g++.dg/abi/empty17.h: New test. * g++.dg/abi/empty17a.c: New test. * g++.dg/abi/empty18.C: New test. * g++.dg/abi/empty18.h: New test. * g++.dg/abi/empty18a.c: New test. * g++.dg/abi/empty19.C: New test. * g++.dg/abi/empty19.h: New test. * g++.dg/abi/empty19a.c: New test. * g++.dg/abi/empty20.C: New test. * g++.dg/abi/empty21.C: New test. * g++.dg/abi/empty22.C: New test. * g++.dg/abi/empty22.h: New test. * g++.dg/abi/empty22a.c: New test. * g++.dg/abi/empty23.C: New test. * g++.dg/abi/empty24.C: New test. * g++.dg/abi/empty25.C: New test. * g++.dg/abi/empty25.h: New test. * g++.dg/abi/empty25a.c: New test. * g++.dg/abi/empty26.C: New test. * g++.dg/abi/empty26.h: New test. * g++.dg/abi/empty26a.c: New test. * g++.dg/abi/empty27.C: New test. * g++.dg/abi/empty28.C: New test. * g++.dg/abi/pr60336-1.C: New test. * g++.dg/abi/pr60336-10.C: New test. * g++.dg/abi/pr60336-11.C: New test. * g++.dg/abi/pr60336-12.C: New test. * g++.dg/abi/pr60336-2.C: New test. * g++.dg/abi/pr60336-3.C: New test. * g++.dg/abi/pr60336-4.C: New test. * g++.dg/abi/pr60336-5.C: New test. * g++.dg/abi/pr60336-6.C: New test. * g++.dg/abi/pr60336-7.C: New test. * g++.dg/abi/pr60336-8.C: New test. * g++.dg/abi/pr60336-9.C: New test. * g++.dg/abi/pr68355.C: New test. * g++.dg/lto/pr60336_0.C: New test. Co-Authored-By: H.J. Lu <hongjiu.lu@intel.com> Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r255066
2017-11-21Add quotes for constexpr keyword.Martin Liska7-30/+54
2017-11-21 Martin Liska <mliska@suse.cz> * class.c (finalize_literal_type_property): Add quotes for constexpr keyword. (explain_non_literal_class): Likewise. * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise. (is_valid_constexpr_fn): Likewise. (check_constexpr_ctor_body): Likewise. (register_constexpr_fundef): Likewise. (explain_invalid_constexpr_fn): Likewise. (cxx_eval_builtin_function_call): Likewise. (cxx_eval_call_expression): Likewise. (cxx_eval_loop_expr): Likewise. (potential_constant_expression_1): Likewise. * decl.c (check_previous_goto_1): Likewise. (check_goto): Likewise. (grokfndecl): Likewise. (grokdeclarator): Likewise. * error.c (maybe_print_constexpr_context): Likewise. * method.c (process_subob_fn): Likewise. (defaulted_late_check): Likewise. * parser.c (cp_parser_compound_statement): Likewise. 2017-11-21 Martin Liska <mliska@suse.cz> * g++.dg/cpp0x/constexpr-48089.C: Add quotes for constexpr keyword; add dg-message for 'in .constexpr. expansion of '. * g++.dg/cpp0x/constexpr-50060.C: Likewise. * g++.dg/cpp0x/constexpr-60049.C: Likewise. * g++.dg/cpp0x/constexpr-70323.C: Likewise. * g++.dg/cpp0x/constexpr-70323a.C: Likewise. * g++.dg/cpp0x/constexpr-cast.C: Likewise. * g++.dg/cpp0x/constexpr-diag3.C: Likewise. * g++.dg/cpp0x/constexpr-ex1.C: Likewise. * g++.dg/cpp0x/constexpr-generated1.C: Likewise. * g++.dg/cpp0x/constexpr-ice16.C: Likewise. * g++.dg/cpp0x/constexpr-ice5.C: Likewise. * g++.dg/cpp0x/constexpr-incomplete2.C: Likewise. * g++.dg/cpp0x/constexpr-neg1.C: Likewise. * g++.dg/cpp0x/constexpr-recursion.C: Likewise. * g++.dg/cpp0x/constexpr-shift1.C: Likewise. * g++.dg/cpp1y/constexpr-70265-1.C: Likewise. * g++.dg/cpp1y/constexpr-70265-2.C: Likewise. * g++.dg/cpp1y/constexpr-79655.C: Likewise. * g++.dg/cpp1y/constexpr-new.C: Likewise. * g++.dg/cpp1y/constexpr-return2.C: Likewise. * g++.dg/cpp1y/constexpr-shift1.C: Likewise. * g++.dg/cpp1y/constexpr-throw.C: Likewise. * g++.dg/cpp1z/constexpr-lambda6.C: Likewise. * g++.dg/ext/constexpr-vla1.C: Likewise. * g++.dg/ext/constexpr-vla2.C: Likewise. * g++.dg/ext/constexpr-vla3.C: Likewise. * g++.dg/cpp0x/static_assert10.C: Likewise. * g++.dg/cpp1y/pr63996.C: Likewise. * g++.dg/cpp1y/pr68180.C: Likewise. * g++.dg/cpp1y/pr77830.C: Likewise. * g++.dg/ubsan/pr63956.C: Likewise. From-SVN: r255025
2017-11-21New POINTER_DIFF_EXPRMarc Glisse5-12/+44
2017-11-21 Marc Glisse <marc.glisse@inria.fr> gcc/c/ * c-fold.c (c_fully_fold_internal): Handle POINTER_DIFF_EXPR. * c-typeck.c (pointer_diff): Use POINTER_DIFF_EXPR. gcc/c-family/ * c-pretty-print.c (pp_c_additive_expression, c_pretty_printer::expression): Handle POINTER_DIFF_EXPR. gcc/cp/ * constexpr.c (cxx_eval_constant_expression, potential_constant_expression_1): Handle POINTER_DIFF_EXPR. * cp-gimplify.c (cp_fold): Likewise. * error.c (dump_expr): Likewise. * typeck.c (pointer_diff): Use POINTER_DIFF_EXPR. gcc/ * doc/generic.texi: Document POINTER_DIFF_EXPR, update POINTER_PLUS_EXPR. * cfgexpand.c (expand_debug_expr): Handle POINTER_DIFF_EXPR. * expr.c (expand_expr_real_2): Likewise. * fold-const.c (const_binop, fold_addr_of_array_ref_difference, fold_binary_loc): Likewise. * match.pd (X-X, P+(Q-P), &D-P, (P+N)-P, P-(P+N), (P+M)-(P+N), P-Q==0, -(A-B), X-Z<Y-Z, (X-Z)-(Y-Z), Z-X<Z-Y, (Z-X)-(Z-Y), (A-B)+(C-A)): New transformations for POINTER_DIFF_EXPR, based on MINUS_EXPR transformations. * optabs-tree.c (optab_for_tree_code): Handle POINTER_DIFF_EXPR. * tree-cfg.c (verify_expr, verify_gimple_assign_binary): Likewise. * tree-inline.c (estimate_operator_cost): Likewise. * tree-pretty-print.c (dump_generic_node, op_code_prio, op_symbol_code): Likewise. * tree-vect-stmts.c (vectorizable_operation): Likewise. * vr-values.c (extract_range_from_binary_expr): Likewise. * varasm.c (initializer_constant_valid_p_1): Likewise. * tree.def: New tree code POINTER_DIFF_EXPR. From-SVN: r255021
2017-11-21P0428R2 - familiar template syntax for generic lambdasJakub Jelinek2-2/+9
P0428R2 - familiar template syntax for generic lambdas * parser.c (cp_parser_lambda_declarator_opt): Don't pedwarn for cxx2a and above, reword pedwarn for C++14/C++17. * g++.dg/cpp1y/lambda-generic-x.C: Adjust warnings and limit to c++17_down target. * g++.dg/cpp1y/lambda-generic-dep.C: Likewise. * g++.dg/cpp1y/lambda-generic-77914.C: Adjust error and limit to c++17_down target. * g++.dg/cpp2a/lambda-generic1.C: New test. * g++.dg/cpp2a/lambda-generic2.C: New test. * g++.dg/cpp2a/lambda-generic3.C: New test. * g++.dg/cpp2a/lambda-generic4.C: New test. * g++.dg/cpp2a/lambda-generic5.C: New test. From-SVN: r254991
2017-11-21C/C++: more stdlib header hints (PR c/81404)David Malcolm2-0/+18
This patch extends the C frontend's "knowledge" of the C stdlib within get_c_name_hint to cover some more macros and functions, covering a case reported in PR c/81404 ("INT_MAX"), so that rather than printing: t.c:5:12: error: 'INT_MAX' undeclared here (not in a function); did you mean '__INT_MAX__'? int test = INT_MAX; ^~~~~~~ __INT_MAX__ we instead print: t.c:5:12: error: 'INT_MAX' undeclared here (not in a function) int test = INT_MAX; ^~~~~~~ t.c:5:12: note: 'INT_MAX' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'? t.c:1:1: +#include <limits.h> t.c:5:12: int test = INT_MAX; ^~~~~~~ It also adds generalizes some of the code for this (and for the "std::" namespace hints in the C++ frontend), moving it to a new c-family/known-headers.cc and .h, and introducing a class known_headers. This currently just works by scanning a hardcoded array of known name/header associations, but perhaps in the future could be turned into some kind of symbol database so that the compiler could record API uses and use that to offer suggestions e.g. foo.cc: error: 'myapi::foo' was not declared in this scope foo.cc: note: 'myapi::foo" was declared in header 'myapi/private.h' (included via 'myapi/public.h') when compiling 'bar.cc'; did you forget to '#include "myapi/public.h"'? or somesuch. In any case, moving this to a class gives an easier way to locate the hardcoded knowledge about the stdlib. The patch also adds similar code to the C++ frontend covering unqualified names in the standard library, so that rather than just e.g.: t.cc:19:13: error: 'NULL' was not declared in this scope void *ptr = NULL; ^~~~ we can emit: t.cc:19:13: error: 'NULL' was not declared in this scope void *ptr = NULL; ^~~~ t.cc:19:13: note: 'NULL' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'? t.cc:1:1: +#include <cstddef> t.cc:19:13: void *ptr = NULL; ^~~~ (Also XFAIL for PR c++/80567 added for the C++ testcase; this is a separate pre-existing bug exposed by the testcase for PR 81404). gcc/ChangeLog: PR c/81404 * Makefile.in (C_COMMON_OBJS): Add c-family/known-headers.o. gcc/c-family/ChangeLog: PR c/81404 * known-headers.cc: New file, based on material from c/c-decl.c. (suggest_missing_header): Copied as-is. (get_stdlib_header_for_name): New, based on get_c_name_hint but heavily edited to add C++ support. Add some knowledge about <limits.h>, <stdint.h>, and <wchar.h>. * known-headers.h: Likewise. gcc/c/ChangeLog: PR c/81404 * c-decl.c: Include "c-family/known-headers.h". (get_c_name_hint): Rename to get_stdlib_header_for_name and move to known-headers.cc. (class suggest_missing_header): Move to known-header.h. (lookup_name_fuzzy): Call get_c_stdlib_header_for_name rather than get_c_name_hint. gcc/cp/ChangeLog: PR c/81404 * name-lookup.c: Include "c-family/known-headers.h" (lookup_name_fuzzy): Call get_cp_stdlib_header_for_name and potentially return a new suggest_missing_header hint. gcc/testsuite/ChangeLog: PR c/81404 * g++.dg/spellcheck-stdlib.C: New. * gcc.dg/spellcheck-stdlib.c (test_INT_MAX): New. From-SVN: r254980
2017-11-21C++: provide macro used-before-defined hint (PR c++/72786)David Malcolm2-2/+55
This patch uses the name_hint/deferred_diagnostic to provide a message in the C++ frontend if a macro is used before it is defined e.g.: test.c:6:24: error: expected ';' at end of member declaration virtual void clone() const OVERRIDE { } ^~~~~ ; test.c:6:30: error: 'OVERRIDE' does not name a type virtual void clone() const OVERRIDE { } ^~~~~~~~ test.c:6:30: note: the macro 'OVERRIDE' had not yet been defined test.c:15:0: note: it was later defined here #define OVERRIDE override It's possible to do it from the C++ frontend as tokenization happens up-front (and hence the macro already exists when the above is parsed); I attempted to do it from the C frontend, but because the C frontend only tokenizes on-demand during parsing, the macro isn't known about until later. gcc/cp/ChangeLog: PR c++/72786 * name-lookup.c (class macro_use_before_def): New class. (lookup_name_fuzzy): Detect macro that were used before being defined, and report them as such. gcc/ChangeLog: PR c++/72786 * spellcheck.h (best_match::blithely_get_best_candidate): New accessor. gcc/testsuite/ChangeLog: PR c++/72786 * g++.dg/spellcheck-macro-ordering-2.C: New test case. * g++.dg/spellcheck-macro-ordering.C: Add dg-message directives for macro used-before-defined. libcpp/ChangeLog: PR c++/72786 * include/cpplib.h (cpp_macro_definition_location): New decl. * macro.c (cpp_macro_definition): New function. From-SVN: r254978
2017-11-20Avoid duplicate visibility warning.Jason Merrill2-1/+7
* decl2.c (constrain_class_visibility): Don't warn about artificial fields. From-SVN: r254973
2017-11-20P0329R4: Designated InitializationJakub Jelinek5-46/+216
P0329R4: Designated Initialization * parser.c (cp_parser_initializer_clause): List in comment grammar designated-initializer-list. (cp_parser_initializer_list): Allow .identifier = without pedwarn for C++2A, parse .identifier { ... }. Improve location_t argument to pedwarn. Add pedwarn for [cst] = designators. Diagnose ... in designated initializer list. Diagnose mixing designated and non-designated initializer clauses for C++2A. Diagnose duplicated identifiers in designators. * name-lookup.h (search_anon_aggr): New declaration. * name-lookup.c (fields_linear_search): Use search_anon_aggr. (search_anon_aggr): New function. * typeck2.c (process_init_constructor_record): Allow designator to skip over some non-static data members. Handle anonymous aggregates. Add diagnostics for designator order not matching member declaration order. * g++.dg/ext/desig2.C: Adjust comment, no sorry about designator refering to second member. (b): New variable and associated expected diagnostic. * g++.dg/ext/desig4.C: For C++2A expect diagnostics. * g++.dg/ext/desig5.C: Add dg-do dg-compile and empty dg-options. * g++.dg/ext/desig8.C: Likewise. * g++.dg/ext/desig9.C: New test. * g++.dg/ext/pr27019.C: Don't expect any diagnostics. * g++.dg/init/error2.C: Adjust expected diagnostics. * g++.dg/cpp0x/desig1.C: Add dg-options with -pedantic, expect warning on C99 designators. * g++.dg/cpp2a/desig1.C: New test. * g++.dg/cpp2a/desig2.C: New test. * g++.dg/cpp2a/desig3.C: New test. * g++.dg/cpp2a/desig4.C: New test. * g++.dg/cpp2a/desig5.C: New test. * g++.dg/cpp2a/desig6.C: New test. From-SVN: r254964
2017-11-20c-family: add name_hint/deferred_diagnosticDavid Malcolm3-11/+31
In various places we use lookup_name_fuzzy to provide a hint, and can report messages of the form: error: unknown foo named 'bar' or: error: unknown foo named 'bar'; did you mean 'SUGGESTION? This patch provides a way for lookup_name_fuzzy to provide both the suggestion above, and (optionally) additional hints that can be printed e.g. note: did you forget to include <SOME_HEADER.h>? This patch provides the mechanism and ports existing users of lookup_name_fuzzy to the new return type. There are no uses of such hints in this patch, but followup patches provide various front-end specific uses of this. gcc/c-family/ChangeLog: * c-common.h (enum lookup_name_fuzzy_kind): Move to name-hint.h. (lookup_name_fuzzy): Likewise. Convert return type from const char * to name_hint. Add location_t param. * name-hint.h: New header. gcc/c/ChangeLog: * c-decl.c: Define INCLUDE_UNIQUE_PTR before including system.h. Include "c-family/name-hint.h" (implicit_decl_warning): Convert "hint" from const char * to name_hint. Pass location to lookup_name_fuzzy. Suppress any deferred diagnostic if the warning was not printed. (undeclared_variable): Likewise for "guessed_id". (lookup_name_fuzzy): Convert return type from const char * to name_hint. Add location_t param. * c-parser.c: Define INCLUDE_UNIQUE_PTR before including system.h. Include "c-family/name-hint.h" (c_parser_declaration_or_fndef): Convert "hint" from const char * to name_hint. Pass location to lookup_name_fuzzy. (c_parser_parameter_declaration): Likewise. gcc/cp/ChangeLog: * name-lookup.c: Define INCLUDE_UNIQUE_PTR before including system.h. Include "c-family/name-hint.h" (suggest_alternatives_for): Convert "fuzzy_name" from const char * to name_hint, and rename to "hint". Pass location to lookup_name_fuzzy. (lookup_name_fuzzy): Convert return type from const char * to name_hint. Add location_t param. * parser.c: Define INCLUDE_UNIQUE_PTR before including system.h. Include "c-family/name-hint.h" (cp_parser_diagnose_invalid_type_name): Convert "suggestion" from const char * to name_hint, and rename to "hint". Pass location to lookup_name_fuzzy. From-SVN: r254963
2017-11-20[PR c++/82878] pass-by-invisiref in lambdaNathan Sidwell4-10/+18
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01115.html PR c++/82878 PR c++/78495 * call.c (build_call_a): Don't set CALL_FROM_THUNK_P for inherited ctor. * cp-gimplify.c (cp_genericize_r): Restore THUNK dereference inhibibition check removed in previous c++/78495 change. PR c++/82878 * g++.dg/cpp0x/pr82878.C: New. * g++.dg/cpp1z/inh-ctor38.C: Check moves too. From-SVN: r254958
2017-11-20re PR c++/82781 (Vector extension operators return wrong result in constexpr)Jakub Jelinek2-2/+50
PR c++/82781 * constexpr.c (cxx_eval_vector_conditional_expression): New function. (cxx_eval_constant_expression) <case VEC_COND_EXPR>: Use it instead of cxx_eval_conditional_expression. * g++.dg/ext/constexpr-pr82781.C: New test. From-SVN: r254952
2017-11-19re PR c/66618 (Failure to diagnose non-constant initializer for static ↵Jakub Jelinek2-4/+9
object with -O1) PR c/66618 PR c/69960 c-family/ * c-common.h (c_fully_fold): Add LVAL argument defaulted to false. c/ * c-parser.c (c_parser_omp_atomic): Pass true as LVAL to c_fully_fold where needed. * c-typeck.c (build_unary_op, build_modify_expr, build_asm_expr, handle_omp_array_sections): Likewise. (digest_init): Don't call decl_constant_value_for_optimization. * c-tree.h (decl_constant_value_for_optimization): Removed. * c-fold.c (c_fold_array_ref): New function. (c_fully_fold_internal): Add LVAL argument, propagate it through recursive calls. For VAR_P call decl_constant_value and unshare if not LVAL and either optimizing or IN_INIT. Remove decl_constant_value_for_optimization calls. If IN_INIT and not LVAL, fold ARRAY_REF with STRING_CST and INTEGER_CST operands. (c_fully_fold): Add LVAL argument, pass it through to c_fully_fold_internal. (decl_constant_value_for_optimization): Removed. cp/ * cp-gimplify.c (c_fully_fold): Add LVAL argument, call cp_fold_maybe_rvalue instead of cp_fold_rvalue and pass it !LVAL. testsuite/ * gcc.dg/pr69960.c: New test. * gcc.dg/pr66618.c: New test. * gcc.dg/pr66618-2.c: New test. From-SVN: r254930
2017-11-16PR c++/79092 - non-type args of different types are differentJason Merrill5-17/+91
* tree.c (cp_tree_equal): Check the type of constants. * pt.c (unify) [TEMPLATE_PARM_INDEX]: Handle UNIFY_ALLOW_INTEGER when comparing to previously deduced argument. (maybe_convert_nontype_argument): New. (convert_nontype_argument): Call it. (tsubst_copy_and_build): Handle partial instantiation of IMPLICIT_CONV_EXPR. (unify): Ignore type when deducing from array bound. (dependent_type_p_r): Handle DEFERRED_NOEXCEPT. (value_dependent_expression_p): Any type-dependent expression is value-dependent. Handle IMPLICIT_CONV_EXPR. * cp-tree.h (IMPLICIT_CONV_EXPR_NONTYPE_ARG): New. * mangle.c (write_template_arg): Strip IMPLICIT_CONV_EXPR. From-SVN: r254843
2017-11-16[PATCH] New lang hookNathan Sidwell4-3/+46
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01340.html PR c++/82836 PR c++/82737 * tree.h (COPY_DECL_RTL): Rename parms for clarity. (SET_DECL_ASSEMBLER_NAME): Forward to overwrite_decl_assembler_name. (COPY_DECL_ASSEMBLER_NAME): Rename parms for clarity. (overwrite_decl_assembler_name): Declare. * tree.c (overwrite_decl_assembler_name): New. * langhooks-def.h (lhd_overwrite_decl_assembler_name): Declare. (LANG_HOOKS_OVERWRITE_DECL_ASSEMBLER_NAME): Provide default. (LANG_HOOKS_INITIALIZER): Add it. * langhooks.h (struct lang_hooks): Add overwrite_decl_assembler_name. * langhooks.c (lhd_set_decl_assembler_name): Use SET_DECL_ASSEMBLER_NAME. (lhd_overwrite_decl_assembler_name): Default implementation. PR c++/82836 PR c++/82737 * cp-objcp-common.h (LANG_HOOKS_OVERWRITE_DECL_ASSEMBLER_NAME): Override. * cp-tree.h (overwrite_mangling): Declare. * decl2.c (struct mangled_decl_hash): Entries are deletable. (overwrite_mangling): New. PR c++/82836 PR c++/82737 * g++.dg/pr82836.C: New. From-SVN: r254823
2017-11-16[PR c++/81060] ICE with invalid initialzer via lambdaNathan Sidwell3-7/+13
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01323.html PR c++/81060 * decl.c (xref_tag_1): Push lambda into current scope. * name-lookup.c (do_pushtag): Don't deal with ts_lambda here. PR c++81060 * g++.dg/cpp0x/lambda/lambda-template13.C: Avoid undefined template using local type error. * g++.dg/cpp0x/pr81060.C: New. From-SVN: r254817
2017-11-15[PR c++/81574] lambda capture of function referenceNathan Sidwell2-1/+8
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg01200.html PR c++/81574 * lambda.c (lambda_capture_field_type): Function references are always catured by reference. PR c++/81574 * g++.dg/cpp1y/pr81574.C: New. From-SVN: r254768
2017-11-15Fix fallout of -fsanitize=vptr.Martin Liska2-2/+6
2017-11-15 Martin Liska <mliska@suse.cz> * decl.c (begin_destructor_body): Use cp_build_fold_indirect_ref instead of cp_build_indirect_ref. From-SVN: r254765
2017-11-15Zero vptr in dtor for -fsanitize=vptr.Martin Liska2-1/+26
2017-11-15 Martin Liska <mliska@suse.cz> * decl.c (begin_destructor_body): In case of VPTR sanitization (with disabled recovery), zero vptr in order to catch virtual calls after lifetime of an object. 2017-11-15 Martin Liska <mliska@suse.cz> * g++.dg/ubsan/vptr-12.C: New test. From-SVN: r254754
2017-11-14Support GTY((cache)) on hash_map.Jason Merrill6-48/+35
gcc/ * hash-traits.h (ggc_remove): Add ggc_maybe_mx member function. (ggc_cache_remove): Override it instead of ggc_mx. * hash-table.h (gt_ggc_mx): Call it instead of ggc_mx. (gt_cleare_cache): Call ggc_mx instead of gt_ggc_mx. * hash-map-traits.h (simple_hashmap_traits): Add maybe_mx member. (simple_cache_map_traits): Override maybe_mx. * hash-map.h (hash_entry): Add ggc_maybe_mx and keep_cache_entry. (hash_map): Friend gt_cleare_cache. (gt_cleare_cache): New. * tree.h (tree_cache_traits): New hash_map traits class. (tree_cache_map): New typedef. gcc/cp/ * decl.c (decomp_type_table): Use tree_cache_map. * init.c (nsdmi_inst): Likewise. * pt.c (defarg_ints): Likewise. * cp-objcp-common.c (cp_get_debug_type): Likewise. From-SVN: r254731