aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
AgeCommit message (Collapse)AuthorFilesLines
2016-11-15ChangeLog: Fix ChangeLog entry.Uros Bizjak1-1/+12
* gcc/ChangeLog: Fix ChangeLog entry. * gcc/c/ChangeLog: Ditto. * gcc/c-family/ChangeLog: Ditto. * gcc/cp/ChangeLog: Ditto. From-SVN: r242429
2016-11-14c-cppbuiltin.c (c_cpp_builtins): Define __cpp_structured_bindings.Jakub Jelinek2-24/+29
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_structured_bindings. * g++.dg/cpp1z/feat-cxx1z.C: Test __cpp_structured_bindings macro. From-SVN: r242395
2016-11-14Make-lang.in (C_AND_OBJC_OBJS): Add gimple-parser.o.Prasad Ghangal4-0/+19
2016-11-14 Prasad Ghangal <prasad.ghangal@gmail.com> Richard Biener <rguenther@suse.de> c/ * Make-lang.in (C_AND_OBJC_OBJS): Add gimple-parser.o. * config-lang.in (gtfiles): Add c/c-parser.h. * c-tree.h (enum c_declspec_word): Add cdw_gimple. (struct c_declspecs): Add gimple_pass member and gimple_p flag. * c-parser.c (enum c_id_kind, struct c_token, c_parser_next_token_is, c_parser_next_token_is_not, c_parser_next_token_is_keyword, enum c_lookahead_kind, enum c_dtr_syn, enum c_parser_prec): Split out to ... * c-parser.h: ... new header. * c-parser.c: Include c-parser.h and gimple-parser.h. (c_parser_peek_token, c_parser_peek_2nd_token, c_token_starts_typename, c_parser_next_token_starts_declspecs, c_parser_next_tokens_start_declaration, c_parser_consume_token, c_parser_error, c_parser_require, c_parser_skip_until_found, c_parser_declspecs, c_parser_declarator, c_parser_peek_nth_token, c_parser_type_name): Export. (c_parser_tokens_buf): New function. (c_parser_error): Likewise. (c_parser_set_error): Likewise. (c_parser_declspecs): Handle RID_GIMPLE. (c_parser_declaration_or_fndef): Parse __GIMPLE marked body via c_parser_parse_gimple_body. * c-parser.h (c_parser_peek_token, c_parser_peek_2nd_token, c_token_starts_typename, c_parser_next_token_starts_declspecs, c_parser_next_tokens_start_declaration, c_parser_consume_token, c_parser_error, c_parser_require, c_parser_skip_until_found, c_parser_declspecs, c_parser_declarator, c_parser_peek_nth_token, c_parser_type_name): Declare. (struct c_parser): Declare forward. (c_parser_tokens_buf): Declare. (c_parser_error): Likewise. (c_parser_set_error): Likewise. * gimple-parser.c: New file. * gimple-parser.h: Likewise. obj-c/ * config-lang.in (gtfiles): Add c/c-parser.h. c-family/ * c-common.h (c_common_resword): Add RID_GIMPLE, RID_PHI types. * c-common.h (enum rid): Add RID_GIMPLE, RID_PHI. * c.opt (fgimple): New option. * doc/invoke.texi (fgimple): Document. * dumpfile.h (TDF_GIMPLE): Add. * dumpfile.c (dump_options): Add gimple. * gimple-pretty-print.c (dump_gimple_switch): Adjust dump for TDF_GIMPLE. (dump_gimple_label): Likewise. (dump_gimple_phi): Likewise. (dump_gimple_bb_header): Likewise. (dump_phi_nodes): Likewise. (pp_cfg_jump): Likewise. Pass in dump flags. (dump_implicit_edges): Adjust. * passes.c (pass_init_dump_file): Do not dump function header for TDF_GIMPLE. * tree-cfg.c (dump_function_to_file): Dump function return type and __GIMPLE keyword for TDF_GIMPLE. Change guard for dumping GIMPLE stmts. * tree-pretty-print.c (dump_decl_name): Adjust dump for TDF_GIMPLE. (dump_generic_node): Likewise. * function.h (struct function): Add pass_startwith member. * passes.c (execute_one_pass): Implement startwith. * tree-ssanames.c (make_ssa_name_fn): New argument, check for version and assign proper version for parsed ssa names. * tree-ssanames.h (make_ssa_name_fn): Add new argument to the function. * internal-fn.c (expand_PHI): New function. * internal-fn.h (expand_PHI): Declared here. * internal-fn.def: New defination for PHI. * tree-cfg.c (lower_phi_internal_fn): New function. (build_gimple_cfg): Call it. (verify_gimple_call): Condition for passing label as arg in internal function PHI. * tree-into-ssa.c (rewrite_add_phi_arguments): Handle already present PHIs with arguments. testsuite/ * gcc.dg/gimplefe-1.c: New testcase. * gcc.dg/gimplefe-2.c: Likewise. * gcc.dg/gimplefe-3.c: Likewise. * gcc.dg/gimplefe-4.c: Likewise. * gcc.dg/gimplefe-5.c: Likewise. * gcc.dg/gimplefe-6.c: Likewise. * gcc.dg/gimplefe-7.c: Likewise. * gcc.dg/gimplefe-8.c: Likewise. * gcc.dg/gimplefe-9.c: Likewise. * gcc.dg/gimplefe-10.c: Likewise. * gcc.dg/gimplefe-11.c: Likewise. * gcc.dg/gimplefe-12.c: Likewise. * gcc.dg/gimplefe-13.c: Likewise. * gcc.dg/gimplefe-14.c: Likewise. * gcc.dg/gimplefe-15.c: Likewise. * gcc.dg/gimplefe-16.c: Likewise. * gcc.dg/gimplefe-17.c: Likewise. * gcc.dg/gimplefe-18.c: Likewise. Co-Authored-By: Richard Biener <rguenther@suse.de> From-SVN: r242387
2016-11-13re PR tree-optimization/35503 (Warning about restricted pointers?)Prathamesh Kulkarni4-0/+65
2016-11-13 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> PR c/35503 * doc/invoke.texi: Document Wrestrict. * pretty-print.c (pp_format): Add case for "Z" specifier. (test_pp_format): Test "Z" specifier. c-family/ * c-common.h (warn_for_restrict): Declare. * c-warn.c: Include gcc-rich-location.h. (warn_for_restrict): New function. * c-format.c (gcc_tdiag_char_table): Add entry for "Z" specifier. (gcc_cdiag_char_table): Likewise. (gcc_cxxdiag_char_table): Likewise. * c.opt (Wrestrict): New option. c/ * c-parser.c (c_parser_postfix_expression_after_primary): Call warn_for_restrict. cp/ * parser.c (cp_parser_postfix_pexpression): Call warn_for_restrict. testsuite/ * c-c++-common/pr35503-1.c: New test. * c-c++-common/pr35503-2.c: Likewise. * c-c++-common/pr35503-3.c: Likewise. * gcc.dg/format/gcc_diag-1.c: Add tests for "Z" specifier. From-SVN: r242366
2016-11-13c-ada-spec.c (print_ada_declaration): For typedef declarations...Eric Botcazou2-2/+8
* c-ada-spec.c (print_ada_declaration): For typedef declarations, look for nested types only if the type is a record or union and dump SLOC. From-SVN: r242356
2016-11-09Implement P0127R2, Declaring non-type parameters with auto.Jason Merrill2-0/+5
gcc/cp/ * cp-tree.h (enum auto_deduction_context): Add adc_unify. * decl.c (grokdeclarator): Allow 'auto' in C++17 template non-type parameter types. * pt.c (do_auto_deduction): Add outer_targs parameter. (convert_template_argument): Call do_auto_deduction. If adc_unify, don't give up on dependent init. (unify): Likewise. In C++17, walk into the type of a TEMPLATE_PARM_INDEX. (for_each_template_parm): Add any_fn parameter. (struct pair_fn_data): Likewise. (for_each_template_parm_r): Call it for any tree. In C++17, walk into the type of a TEMPLATE_PARM_INDEX. (zero_r, array_deduction_r, try_array_deduction): New. (type_unification_real): Call try_array_deduction. (get_partial_spec_bindings): Likewise. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_template_auto. From-SVN: r242017
2016-11-09flag-types.h (enum sanitize_code): Add SANITIZE_SHIFT_BASE and ↵Jakub Jelinek2-5/+44
SANITIZE_SHIFT_EXPONENT... * flag-types.h (enum sanitize_code): Add SANITIZE_SHIFT_BASE and SANITIZE_SHIFT_EXPONENT, change SANITIZE_SHIFT to bitwise or of them, renumber other enumerators. * opts.c (sanitizer_opts): Add shift-base and shift-exponent. * doc/invoke.texi: Document -fsanitize=shift-base and -fsanitize-shift-exponent, document -fsanitize=shift as having those 2 suboptions. c-family/ * c-ubsan.c (ubsan_instrument_shift): Handle split -fsanitize=shift-base and -fsanitize=shift-exponent. testsuite/ * gcc.dg/ubsan/c99-shift-3.c: New test. * gcc.dg/ubsan/c99-shift-4.c: New test. * gcc.dg/ubsan/c99-shift-5.c: New test. * gcc.dg/ubsan/c99-shift-6.c: New test. From-SVN: r242005
2016-11-07Implement P0012R1, Make exception specifications part of the type system.Jason Merrill3-0/+13
gcc/cp/ * cp-tree.h (enum tsubst_flags): Add tf_fndecl_type. (flag_noexcept_type, ce_type): New. * call.c (build_conv): Add ck_fnptr. (enum conversion_kind): Change ck_tsafe to ck_fnptr. (convert_like_real): Likewise. (standard_conversion): Likewise. Allow function pointer conversions for pointers to member functions. (reference_compatible_p): Allow function pointer conversions. (direct_reference_binding): Likewise. (reference_binding): Reference-compatible is no longer a subset of reference-related. (is_subseq): Also strip ck_lvalue after next_conversion. * class.c (instantiate_type): Check fnptr_conv_p. (resolve_address_of_overloaded_function): Likewise. * cvt.c (can_convert_tx_safety): Now static. (noexcept_conv_p, fnptr_conv_p, strip_fnptr_conv): New. * decl.c (flag_noexcept_type): Define. (cxx_init_decl_processing): Set it. (bad_specifiers): Check it. (grokdeclarator) [cdk_function]: Add exception-spec to type here. * lambda.c (maybe_add_lambda_conv_op): Add exception-spec to returned pointer. * mangle.c (struct globals): Add need_cxx1z_warning. (mangle_decl): Check it. (write_exception_spec): New. (write_function_type): Call it. (canonicalize_for_substitution): Handle exception spec. (write_type): Likewise. (write_encoding): Set processing_template_decl across mangling of partially-instantiated type. * pt.c (determine_specialization): Pass tf_fndecl_type. (tsubst_decl, fn_type_unification): Likewise. (tsubst): Strip tf_fndecl_type, pass it to tsubst_exception_specification. (convert_nontype_argument_function): Handle function pointer conversion. (convert_nontype_argument): Likewise. (unify, for_each_template_parm_r): Walk into noexcept-specifier. * rtti.c (ptr_initializer): Encode noexcept. * tree.c (canonical_eh_spec): New. (build_exception_variant): Use it. * typeck.c (composite_pointer_type): Handle fnptr conversion. (comp_except_specs): Compare canonical EH specs. (structural_comptypes): Call it. gcc/c-family/ * c.opt (Wc++1z-compat): New. * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_noexcept_function_type. libstdc++-v3/ * include/bits/c++config (_GLIBCXX_NOEXCEPT_PARM) (_GLIBCXX_NOEXCEPT_QUAL): New. * include/std/type_traits (is_function): Use them. * libsubc++/new (launder): Likewise. * libsupc++/cxxabi.h (__pbase_type_info::__masks): Add __noexcept_mask. * libsupc++/pbase_type_info.cc (__do_catch): Handle function pointer conversion. libiberty/ * cp-demangle.c (is_fnqual_component_type): New. (d_encoding, d_print_comp_inner, d_print_mod_list): Use it. (FNQUAL_COMPONENT_CASE): New. (d_make_comp, has_return_type, d_print_comp_inner) (d_print_function_type): Use it. (next_is_type_qual): New. (d_cv_qualifiers, d_print_mod): Handle noexcept and throw-spec. include/ * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_NOEXCEPT, DEMANGLE_COMPONENT_THROW_SPEC. From-SVN: r241944
2016-11-07Introduce -fsanitize-address-use-after-scopeMartin Liska2-1/+13
* c-warn.c (warn_for_unused_label): Save all labels used in goto or in &label. * asan.c (enum asan_check_flags): Move the enum to header file. (asan_init_shadow_ptr_types): Make type creation more generic. (shadow_mem_size): New function. (asan_emit_stack_protection): Use newly added ASAN_SHADOW_GRANULARITY. Rewritten stack unpoisoning code. (build_shadow_mem_access): Add new argument return_address. (instrument_derefs): Instrument local variables if use after scope sanitization is enabled. (asan_store_shadow_bytes): New function. (asan_expand_mark_ifn): Likewise. (asan_sanitize_stack_p): Moved from asan_sanitize_stack_p. * asan.h (enum asan_mark_flags): Moved here from asan.c (asan_protect_stack_decl): Protect all declaration that need to live in memory. (asan_sanitize_use_after_scope): New function. (asan_no_sanitize_address_p): Likewise. * cfgexpand.c (partition_stack_vars): Consider asan_sanitize_use_after_scope in condition. (expand_stack_vars): Likewise. * common.opt (-fsanitize-address-use-after-scope): New option. * doc/invoke.texi (use-after-scope-direct-emission-threshold): Explain the parameter. * flag-types.h (enum sanitize_code): Define SANITIZE_USE_AFTER_SCOPE. * gimplify.c (build_asan_poison_call_expr): New function. (asan_poison_variable): Likewise. (gimplify_bind_expr): Generate poisoning/unpoisoning for local variables that have address taken. (gimplify_decl_expr): Likewise. (gimplify_target_expr): Likewise for C++ temporaries. (sort_by_decl_uid): New function. (gimplify_expr): Unpoison all variables for a label we can jump from outside of a scope. (gimplify_switch_expr): Unpoison variables defined in the switch context. (gimplify_function_tree): Clear asan_poisoned_variables. (asan_poison_variables): New function. (warn_switch_unreachable_r): Handle IFN_ASAN_MARK. * internal-fn.c (expand_ASAN_MARK): New function. * internal-fn.def (ASAN_MARK): Declare. * opts.c (finish_options): Handle -fstack-reuse if -fsanitize-address-use-after-scope is enabled. (common_handle_option): Enable address sanitization if -fsanitize-address-use-after-scope is enabled. * params.def (PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD): New parameter. * params.h: Likewise. * sancov.c (pass_sanopt::execute): Handle IFN_ASAN_MARK. * sanitizer.def: Define __asan_poison_stack_memory and __asan_unpoison_stack_memory functions. * asan.c (asan_mark_poison_p): New function. (transform_statements): Handle asan_mark_poison_p calls. * gimple.c (nonfreeing_call_p): Handle IFN_ASAN_MARK. From-SVN: r241896
2016-11-03* c-cppbuiltin.c (c_cpp_builtins): Correct __cpp_inheriting_constructors.Jason Merrill2-1/+6
From-SVN: r241830
2016-11-01c-cppbuiltin.c (c_cpp_builtins): Update __cpp_inheriting_constructors.Jason Merrill2-1/+7
* c-cppbuiltin.c (c_cpp_builtins): Update __cpp_inheriting_constructors. From-SVN: r241766
2016-11-01Implement P0136R1, Rewording inheriting constructors.Jason Merrill3-0/+15
gcc/c-family/ * c.opt (-fnew-inheriting-ctors): New. * c-opts.c: Default to on for ABI 11+. gcc/cp/ * call.c (enum rejection_reason_code): Add rr_inherited_ctor. (inherited_ctor_rejection): New. (add_function_candidate): Reject inherited ctors for copying. (enforce_access): Use strip_inheriting_ctors. (print_z_candidate): Likewise. Handle rr_inherited_ctor. (convert_like_real): Avoid copying inheriting ctor parameters. (build_over_call): Likewise. A base ctor inheriting from vbase has no parms. Sorry about varargs. (joust): A local constructor beats inherited with the same convs. * class.c (add_method): Handle hiding inheriting ctors. (one_inherited_ctor): Handle new semantics. (add_implicitly_declared_members): Pass using_decl down. (build_clone): A base ctor inheriting from vbase has no parms. * cp-tree.h (DECL_INHERITED_CTOR): Store this instead of the base. (SET_DECL_INHERITED_CTOR): Likewise. (DECL_INHERITED_CTOR_BASE): Adjust. * constexpr.c: Adjust. * error.c (dump_function_decl): Decorate inheriting ctors. * init.c (emit_mem_initializers): Suppress access control in inheriting ctor. * mangle.c (write_special_name_constructor): Handle new inheriting ctor mangling. * method.c (strip_inheriting_ctors, inherited_ctor_binfo) (ctor_omit_inherited_parms, binfo_inherited_from): New. (synthesized_method_walk): Use binfo_inherited_from. Suppress access control in inheriting ctor. (deduce_inheriting_ctor): Deleted if ambiguous ctor inheritance. (maybe_explain_implicit_delete): Explain ambigous ctor inheritance. (add_one_base_init, do_build_copy_constructor): Adjust. (locate_fn_flags, explain_implicit_non_constexpr): Adjust. (implicitly_declare_fn): Adjust. (get_inherited_ctor): Remove. * name-lookup.c (do_class_using_decl): Check for indirect ctor inheritance. * optimize.c (cdtor_comdat_group): Adjust for new mangling. (maybe_clone_body): Handle omitted parms in base clone. (maybe_thunk_body): Don't thunk if base clone omits parms. * pt.c (tsubst_decl): Adjust. (instantiate_template_1): Suppress access control in inheriting ctor. (fn_type_unification): Do deduction with inherited ctor. * tree.c (special_function_p): Adjust. gcc/ * tree-inline.c (copy_tree_body_r): Only copy the taken branch of a COND_EXPR with constant condition. libiberty/ * cp-demangle.c (d_ctor_dtor_name): Handle inheriting constructor. From-SVN: r241765
2016-10-31re PR c++/77948 (Option processing of -std=c++11 -std=gnu++11 doesn't reset ↵Jakub Jelinek3-16/+18
ext_numeric_literals) PR c++/77948 * c.opt (fext-numeric-literals): Add Var and Init. * c-opts.c (c_common_handle_option): Don't clear cpp_opts->ext_numeric_literals for -std=c++{11,14,1z}. (c_common_post_options): Clear it here if not set explicitly. * g++.dg/cpp0x/pr77948-1.C: New test. * g++.dg/cpp0x/pr77948-2.C: New test. * g++.dg/cpp0x/pr77948-3.C: New test. * g++.dg/cpp0x/pr77948-4.C: New test. * g++.dg/cpp0x/pr77948-5.C: New test. * g++.dg/cpp0x/pr77948-6.C: New test. From-SVN: r241707
2016-10-28re PR debug/77773 (Segfault when compiling __simd64_float16_t using ↵Aldy Hernandez2-5/+14
arm-none-eabi-g++ with debug information) PR debug/77773 * c-pretty-print.c (simple_type_specifier): Do not dereference `t' if NULL. From-SVN: r241653
2016-10-25internal-fn.def (LAUNDER): New internal function.Jakub Jelinek3-2/+8
* internal-fn.def (LAUNDER): New internal function. * internal-fn.c (expand_LAUNDER): New function. c-family/ * c-common.h (enum rid): Add RID_BUILTIN_LAUNDER. * c-common.c (c_common_reswords): Add __builtin_launder. cp/ * cp-tree.h (finish_builtin_launder): Declare. * parser.c (cp_parser_postfix_expression): Handle RID_BUILTIN_LAUNDER. * semantics.c (finish_builtin_launder): New function. * pt.c (tsubst_copy_and_build): Handle instantiation of IFN_LAUNDER. * constexpr.c (cxx_eval_internal_function): Handle IFN_LAUNDER. (potential_constant_expression_1): Likewise. testsuite/ * g++.dg/cpp1z/launder1.C: New test. * g++.dg/cpp1z/launder2.C: New test. From-SVN: r241506
2016-10-24c-common.c (c_common_truthvalue_conversion): Warn for multiplications in ↵Bernd Edlinger2-1/+12
boolean context. 2016-10-24 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-common.c (c_common_truthvalue_conversion): Warn for multiplications in boolean context. Fix the quoting of '<<' and '<' in the shift warning. gcc: 2016-10-24 Bernd Edlinger <bernd.edlinger@hotmail.de> * doc/invoke.text (Wint-in-bool-context): Update documentation. * value-prof.c (stringop_block_profile): Fix a warning. testsuite: 2016-10-24 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-c++-common/Wint-in-bool-context-3.c: New test. From-SVN: r241490
2016-10-20c-common.c (c_common_truthvalue_conversion): Fix the comment.Bernd Edlinger2-1/+5
2016-10-20 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-common.c (c_common_truthvalue_conversion): Fix the comment. From-SVN: r241377
2016-10-20* c-cppbuiltin.c (c_cpp_builtins): Update __cpp_concepts value.Jason Merrill2-3/+5
From-SVN: r241376
2016-10-19c-common.c (c_common_truthvalue_conversion): Warn only for signed integer ↵Bernd Edlinger2-3/+15
shift ops in boolean context. 2016-10-19 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-common.c (c_common_truthvalue_conversion): Warn only for signed integer shift ops in boolean context. testsuite: 2016-10-19 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-c++-common/Wint-in-bool-context-2.c: New test. From-SVN: r241354
2016-10-18Makefile.in (OBJS): Add gimple-ssa-warn-alloca.o.Aldy Hernandez3-0/+32
* Makefile.in (OBJS): Add gimple-ssa-warn-alloca.o. * passes.def: Add two instances of pass_walloca. * tree-pass.h (make_pass_walloca): New. * gimple-ssa-warn-walloca.c: New file. * doc/invoke.texi: Document -Walloca, -Walloca-larger-than=, and -Wvla-larger-than= options. From-SVN: r241318
2016-10-17c-warn.c (find_array_ref_with_const_idx_r): Remove parameter names.Marek Polacek2-9/+11
* c-warn.c (find_array_ref_with_const_idx_r): Remove parameter names. Return immediately when finding a match. (warn_tautological_cmp): Remove a boolean variable that is no longer needed. From-SVN: r241278
2016-10-17Makefile.in (C_COMMON_OBJS): Add c-family/c-attribs.o.Marek Polacek4-3121/+3180
* Makefile.in (C_COMMON_OBJS): Add c-family/c-attribs.o. * c-attribs.c: New file. * c-common.c: Move attributes handling to c-attribs.c. (get_nonnull_operand): No longer static. * c-common.h: Move the declarations from c-attribs.c to its own section. From-SVN: r241238
2016-10-14c-cppbuiltin.c (c_cpp_builtins): Define __cpp_aggregate_bases and ↵Jason Merrill2-0/+7
__cpp_deduction_guides. * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_aggregate_bases and __cpp_deduction_guides. From-SVN: r241188
2016-10-13Implement P0386R2 - C++17 inline variablesJason Merrill2-0/+5
2016-10-11 Jakub Jelinek <jakub@redhat.com> * dwarf2out.c (gen_member_die): Handle inline static data member definitions. c-family/ * c-cppbuiltin.c (c_cpp_builtins): Add __cpp_inline_variables. cp/ * cp-tree.h (struct lang_type): Shrink language field to 1 bit from 4. Add var_declared_inline_p field. Mention 2 spare bits. (DECL_VAR_DECLARED_INLINE_P): Define. (SET_DECL_VAR_DECLARED_INLINE_P): Define. (DECL_INLINE_VAR_P): Define. (diagnose_inline_vars_for_namespace): Declare. * decl.c (diagnose_inline_vars_for_namespace): New function. (duplicate_decls): For static data members copy DECL_DECLARED_CONSTEXPR_P. (redeclaration_error_message): Handle C++17 redundant redeclaration of constexpr static data member outside of class. (maybe_commonize_var): Handle inline variables. (check_initializer): Ignore inline variables for diagnostics. Adjust diagnostic wording for C++17. (make_rtl_for_nonlocal_decl): Allow in-class definition of inline static data members. (bad_specifiers): Don't diagnose inline on variables here. (grokvardecl): Add inlinep argument, non-static const inline variables are TREE_PUBLIC. (check_static_variable_definition): Return early also for inline variables. (grokdeclarator): Handle inline variables and inline static data members. * typeck2.c (store_init_value): Don't diagnose non-constant initializers for non-constexpr inline static data members. * decl2.c (vague_linkage_p): Return true for inline variables. (c_parse_final_cleanups): In-class declaration of inline static data members is a definition. Call diagnose_inline_vars_for_namespace through walk_namespaces. * pt.c (instantiate_decl): Set pattern_defined for in-class definitions of inline static data members. From-SVN: r241137
2016-10-13Move MEMMODEL_* from coretypes.h to memmodel.hThomas Preud'homme5-0/+11
2016-10-13 Thomas Preud'homme <thomas.preudhomme@arm.com> gcc/ * coretypes.h: Move MEMMODEL_* macros and enum memmodel definition into ... * memmodel.h: This file. * alias.c, asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, caller-save.c, calls.c, ccmp.c, cfgbuild.c, cfgcleanup.c, cfgexpand.c, cfgloopanal.c, cfgrtl.c, cilk-common.c, combine.c, combine-stack-adj.c, common/config/aarch64/aarch64-common.c, common/config/arm/arm-common.c, common/config/bfin/bfin-common.c, common/config/c6x/c6x-common.c, common/config/i386/i386-common.c, common/config/ia64/ia64-common.c, common/config/nvptx/nvptx-common.c, compare-elim.c, config/aarch64/aarch64-builtins.c, config/aarch64/aarch64-c.c, config/aarch64/cortex-a57-fma-steering.c, config/arc/arc.c, config/arc/arc-c.c, config/arm/arm-builtins.c, config/arm/arm-c.c, config/avr/avr.c, config/avr/avr-c.c, config/avr/avr-log.c, config/bfin/bfin.c, config/c6x/c6x.c, config/cr16/cr16.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/epiphany/epiphany.c, config/epiphany/mode-switch-use.c, config/epiphany/resolve-sw-modes.c, config/fr30/fr30.c, config/frv/frv.c, config/ft32/ft32.c, config/h8300/h8300.c, config/i386/i386-c.c, config/i386/winnt.c, config/iq2000/iq2000.c, config/lm32/lm32.c, config/m32c/m32c.c, config/m32r/m32r.c, config/m68k/m68k.c, config/mcore/mcore.c, config/microblaze/microblaze.c, config/mmix/mmix.c, config/mn10300/mn10300.c, config/moxie/moxie.c, config/msp430/msp430.c, config/nds32/nds32-cost.c, config/nds32/nds32-intrinsic.c, config/nds32/nds32-md-auxiliary.c, config/nds32/nds32-memory-manipulation.c, config/nds32/nds32-predicates.c, config/nds32/nds32.c, config/nios2/nios2.c, config/nvptx/nvptx.c, config/pa/pa.c, config/pdp11/pdp11.c, config/rl78/rl78.c, config/rs6000/rs6000-c.c, config/rx/rx.c, config/s390/s390-c.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh-c.c, config/sh/sh-mem.cc, config/sh/sh_treg_combine.cc, config/sol2.c, config/spu/spu.c, config/stormy16/stormy16.c, config/tilegx/tilegx.c, config/tilepro/tilepro.c, config/v850/v850.c, config/vax/vax.c, config/visium/visium.c, config/vms/vms-c.c, config/xtensa/xtensa.c, coverage.c, cppbuiltin.c, cprop.c, cse.c, cselib.c, dbxout.c, dce.c, df-core.c, df-problems.c, df-scan.c, dojump.c, dse.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c, except.c, explow.c, expmed.c, expr.c, final.c, fold-const.c, function.c, fwprop.c, gcse.c, ggc-page.c, haifa-sched.c, hsa-brig.c, hsa-gen.c, hw-doloop.c, ifcvt.c, init-regs.c, internal-fn.c, ira-build.c, ira-color.c, ira-conflicts.c, ira-costs.c, ira-emit.c, ira-lives.c, ira.c, jump.c, loop-doloop.c, loop-invariant.c, loop-iv.c, loop-unroll.c, lower-subreg.c, lra.c, lra-assigns.c, lra-coalesce.c, lra-constraints.c, lra-eliminations.c, lra-lives.c, lra-remat.c, lra-spills.c, mode-switching.c, modulo-sched.c, omp-low.c, passes.c, postreload-gcse.c, postreload.c, predict.c, print-rtl-function.c, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c, reload.c, reload1.c, reorg.c, resource.c, rtl-chkp.c, rtl-tests.c, rtlanal.c, rtlhooks.c, sched-deps.c, sched-rgn.c, sdbout.c, sel-sched-ir.c, sel-sched.c, shrink-wrap.c, simplify-rtx.c, stack-ptr-mod.c, stmt.c, stor-layout.c, target-globals.c, targhooks.c, toplev.c, tree-nested.c, tree-outof-ssa.c, tree-profile.c, tree-ssa-coalesce.c, tree-ssa-ifcombine.c, tree-ssa-loop-ivopts.c, tree-ssa-loop.c, tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-vect-data-refs.c, ubsan.c, valtrack.c, var-tracking.c, varasm.c: Include memmodel.h. * genattrtab.c (write_header): Include memmodel.h in generated file. * genautomata.c (main): Likewise. * gengtype.c (open_base_files): Likewise. * genopinit.c (main): Likewise. * genconditions.c (write_header): Include memmodel.h earlier in generated file. * genemit.c (main): Likewise. * genoutput.c (output_prologue): Likewise. * genpeep.c (main): Likewise. * genpreds.c (write_insn_preds_c): Likewise. * genrecog.c (write_header): Likewise. * Makefile.in (PLUGIN_HEADERS): Include memmodel.h gcc/ada/ * gcc-interface/utils2.c: Include memmodel.h. gcc/c-family/ * c-cppbuiltin.c: Include memmodel.h. * c-opts.c: Likewise. * c-pragma.c: Likewise. * c-warn.c: Likewise. gcc/c/ * c-typeck.c: Include memmodel.h. gcc/cp/ * decl2.c: Include memmodel.h. * rtti.c: Likewise. gcc/fortran/ * trans-intrinsic.c: Include memmodel.h. gcc/go/ * go-backend.c: Include memmodel.h. libgcc/ * libgcov-profiler.c: Replace MEMMODEL_* macros by their __ATOMIC_* equivalent. * config/tilepro/atomic.c: Likewise and stop casting model to enum memmodel. From-SVN: r241121
2016-10-12gcc/Jakub Jelinek3-0/+20
* common.opt (Wimplicit-fallthrough) Turn into alias to -Wimplicit-fallthrough=3. Remove EnabledBy. (Wimplicit-fallthrough=): New option. * gimplify.c (warn_implicit_fallthrough_r): Use OPT_Wimplicit_fallthrough_ instead of OPT_Wimplicit_fallthrough. * doc/invoke.texi (-Wimplicit-fallthrough): Document as alias to -Wimplicit-fallthrough=3. (-Wimplicit-fallthrough=): Document. gcc/c-family/ * c.opt (Wextra): Add as C/C++/ObjC/ObjC++ option. (Wimplicit-fallthrough=): Enable for these languages by -Wextra. * c-opts.c (sanitize_cpp_opts): Initialize cpp_opts->cpp_warn_implicit_fallthrough. gcc/testsuite/ * c-c++-common/Wimplicit-fallthrough-25.c: New test. * c-c++-common/Wimplicit-fallthrough-26.c: New test. * c-c++-common/Wimplicit-fallthrough-27.c: New test. * c-c++-common/Wimplicit-fallthrough-28.c: New test. * c-c++-common/Wimplicit-fallthrough-29.c: New test. * c-c++-common/Wimplicit-fallthrough-30.c: New test. * c-c++-common/Wimplicit-fallthrough-31.c: New test. * c-c++-common/Wimplicit-fallthrough-32.c: New test. * c-c++-common/Wimplicit-fallthrough-33.c: New test. libcpp/ * include/cpplib.h (struct cpp_options): Add cpp_warn_implicit_fallthrough. * init.c (cpp_create_reader): Initialize it to 0. * lex.c (fallthrough_comment_p): Handle different cpp_warn_implicit_fallthrough levels. Whitespace fixes. From-SVN: r241013
2016-10-11c-common.c (warning_candidate_p): Change the return type to bool and return ↵Marek Polacek2-12/+19
true/false instead of 1/0. * c-common.c (warning_candidate_p): Change the return type to bool and return true/false instead of 1/0. (vector_mode_valid_p): Likewise. From-SVN: r240974
2016-10-11Makefile.in (C_COMMON_OBJS): Add c-family/c-warn.o.Marek Polacek4-2191/+2269
* Makefile.in (C_COMMON_OBJS): Add c-family/c-warn.o. * c-common.c (fold_for_warn): No longer static. (bool_promoted_to_int_p): Likewise. (c_common_get_narrower): Likewise. (constant_expression_warning): Move to c-warn.c. (constant_expression_error): Likewise. (overflow_warning): Likewise. (warn_logical_operator): Likewise. (find_array_ref_with_const_idx_r): Likewise. (warn_tautological_cmp): Likewise. (expr_has_boolean_operands_p): Likewise. (warn_logical_not_parentheses): Likewise. (warn_if_unused_value): Likewise. (strict_aliasing_warning): Likewise. (sizeof_pointer_memaccess_warning): Likewise. (check_main_parameter_types): Likewise. (conversion_warning): Likewise. (warnings_for_convert_and_check): Likewise. (match_case_to_enum_1): Likewise. (match_case_to_enum): Likewise. (c_do_switch_warnings): Likewise. (warn_for_omitted_condop): Likewise. (readonly_error): Likewise. (lvalue_error): Likewise. (invalid_indirection_error): Likewise. (warn_array_subscript_with_type_char): Likewise. (warn_about_parentheses): Likewise. (warn_for_unused_label): Likewise. (warn_for_div_by_zero): Likewise. (warn_for_memset): Likewise. (warn_for_sign_compare): Likewise. (do_warn_double_promotion): Likewise. (do_warn_unused_parameter): Likewise. (record_locally_defined_typedef): Likewise. (maybe_record_typedef_use): Likewise. (maybe_warn_unused_local_typedefs): Likewise. (maybe_warn_bool_compare): Likewise. (maybe_warn_shift_overflow): Likewise. (warn_duplicated_cond_add_or_warn): Likewise. (diagnose_mismatched_attributes): Likewise. * c-common.h: Move the declarations from c-warn.c to its own section. * c-warn.c: New file. From-SVN: r240963
2016-10-08Delay folding of bool conversion into COND_EXPR.Jason Merrill2-15/+7
gcc/c-family/ * c-common.c (c_common_truthvalue_conversion): Don't distribute into COND_EXPR in C++. gcc/cp/ * cp-gimplify.c (cp_fold): Distribute cp_truthvalue_conversion into COND_EXPR. From-SVN: r240893
2016-10-08c-lex.c (c_lex_with_flags): For CPP_COMMENT token with PREV_FALLTHROUGH...Jakub Jelinek2-3/+21
* c-lex.c (c_lex_with_flags) <case CPP_COMMENT>: For CPP_COMMENT token with PREV_FALLTHROUGH, skip all following CPP_PADDING and CPP_COMMENT tokens and set add_flags to PREV_FALLTHROUGH afterwards. * doc/invoke.texi (-Wimplicit-fallthrough): Document the accepted FALLTHRU comment styles. * lex.c (fallthrough_comment_p): Fix off-by-one size comparison errors, cleanup. (_cpp_lex_direct): Allow arbitrary comments in between fallthrough_comment_p comment and following token. * c-c++-common/Wimplicit-fallthrough-23.c: New test. * c-c++-common/Wimplicit-fallthrough-24.c: New test. From-SVN: r240884
2016-10-07Implement LWG2296 helper intrinsic c-family/Jakub Jelinek3-0/+8
Implement LWG2296 helper intrinsic c-family/ * c-common.h (enum rid): Add RID_ADDRESSOF. * c-common.c (c_common_reswords): Add __builtin_addressof. cp/ * parser.c (cp_parser_postfix_expression): Handle RID_ADDRESSOF. * cp-objcp-common.c (cp_common_init_ts): Handle ADDRESSOF_EXPR. * constexpr.c (potential_constant_expression_1): Likewise. * error.c (dump_expr): Likewise. * typeck.c (cp_build_addressof): New function. * cp-tree.h (cp_build_addressof): Declare. * cxx-pretty-print.h (pp_cxx_addressof_expression): Declare. * cp-tree.def (ADDRESSOF_EXPR): New tree code. * cxx-pretty-print.c (cxx_pretty_printer::primary_expression): Handle ADDRESSOF_EXPR. Add __builtin_addressof and __has_unique_object_representations into syntax in function comment. (pp_cxx_addressof_expression): New function. * pt.c (tsubst_copy_and_build): Handle ADDRESSOF_EXPR. testsuite/ * g++.dg/cpp0x/addressof1.C: New test. * g++.dg/cpp0x/addressof2.C: New test. From-SVN: r240873
2016-10-07re PR c++/77700 (suspicios code in cp/parser.c)Bernd Edlinger2-0/+11
2016-10-07 Bernd Edlinger <bernd.edlinger@hotmail.de> PR c++/77700 * c-common.c (c_common_truthvalue_conversion): Warn also for suspicious enum values in boolean context. cp: 2016-10-07 Bernd Edlinger <bernd.edlinger@hotmail.de> PR c++/77700 * parser.c (cp_parser_base_specifier): Fix a warning. testsuite: 2016-10-07 Bernd Edlinger <bernd.edlinger@hotmail.de> PR c++/77700 * c-c++-common/Wint-in-bool-context.c: Update test. From-SVN: r240867
2016-10-06Implement P0258R2 - helper for C++17 std::has_unique_object_representations ↵Jakub Jelinek3-1/+12
trait c-family/ Implement P0258R2 - helper for C++17 std::has_unique_object_representations trait c-family/ * c-common.h (enum rid): Add RID_HAS_UNIQUE_OBJ_REPRESENTATIONS. * c-common.c (c_common_reswords): Add __has_unique_object_representations. cp/ * cp-tree.h (enum cp_trait_kind): Add CPTK_HAS_UNIQUE_OBJ_REPRESENTATIONS. (struct lang_type_class): Add unique_obj_representations and unique_obj_representations_set bitfields. (CLASSTYPE_UNIQUE_OBJ_REPRESENTATIONS, CLASSTYPE_UNIQUE_OBJ_REPRESENTATIONS_SET): Define. (type_has_unique_obj_representations): Declare. * parser.c (cp_parser_primary_expression): Handle RID_HAS_UNIQUE_OBJ_REPRESENTATIONS. (cp_parser_trait_expr): Likewise. Formatting fix. * semantics.c (trait_expr_value, finish_trait_expr): Handle CPTK_HAS_UNIQUE_OBJ_REPRESENTATIONS. * tree.c (type_has_unique_obj_representations): New function. (record_has_unique_obj_representations): New function. * cxx-pretty-print.c (pp_cxx_trait_expression): Handle CPTK_HAS_UNIQUE_OBJ_REPRESENTATIONS. testsuite/ * g++.dg/cpp1z/has-unique-obj-representations1.C: New test. * g++.dg/cpp1z/has-unique-obj-representations2.C: New test. From-SVN: r240843
2016-10-05re PR sanitizer/66343 ("Error: .Lubsan_type3 already defined" with UBSan and ↵Jakub Jelinek2-3/+6
precompiled headers) PR sanitizer/66343 * ubsan.c (ubsan_create_data): Call initialize_sanitizer_builtins here. (ubsan_instrument_float_cast): And not here. * c-ubsan.c (ubsan_instrument_return): Don't call initialize_sanitizer_builtins here. * gcc.dg/pch/pr66343-3.c: New test. * gcc.dg/pch/pr66343-3.hs: New file. From-SVN: r240804
2016-10-05c-common.c (c_common_truthvalue_conversion): Warn also for suspicious ↵Bernd Edlinger2-0/+14
conditional expression in boolean context when... 2016-10-05 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-common.c (c_common_truthvalue_conversion): Warn also for suspicious conditional expression in boolean context when only one arm is non-boolean. testsuite: 2016-10-05 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-c++-common/Wint-in-bool-context.c: Update test. From-SVN: r240799
2016-10-05re PR sanitizer/77823 (ICE: in ubsan_encode_value, at ubsan.c:137 with ↵Jakub Jelinek2-2/+8
-fsanitize=undefined and vector types) PR sanitizer/77823 * c-ubsan.c (ubsan_instrument_shift): Return NULL_TREE if type0 is not integral. * c-c++-common/ubsan/shift-9.c: New test. From-SVN: r240796
2016-10-05* c-common.c (c_common_reswords): Update comment for C++11.Jakub Jelinek2-2/+6
From-SVN: r240792
2016-10-04PR c++/77852 - class deduction from list-initJason Merrill3-0/+18
* pt.c (do_class_deduction): Handle list-initialization. (do_auto_deduction): Call it sooner. (build_deduction_guide): Use tsubst_arg_types. (rewrite_template_parm): Don't copy_type. From-SVN: r240765
2016-10-04defaults.h (JCR_SECTION_NAME, [...]): Remove.Jakub Jelinek2-4/+5
gcc/ * defaults.h (JCR_SECTION_NAME, TARGET_USE_JCR_SECTION): Remove. * system.h (JCR_SECTION_NAME, TARGET_USE_JCR_SECTION): Poison. * doc/tm.texi.in (TARGET_USE_JCR_SECTION): Remove. * doc/tm.texi: Regenerated. * config/i386/mingw32.h (TARGET_USE_JCR_SECTION): Remove. * config/i386/cygming.h (TARGET_USE_JCR_SECTION): Remove. * config/darwin.h (JCR_SECTION_NAME): Remove. * config/pa/pa64-hpux.h (JCR_SECTION_NAME): Remove. * config/rs6000/aix71.h (TARGET_USE_JCR_SECTION): Remove. * config/rs6000/aix51.h (TARGET_USE_JCR_SECTION): Remove. * config/rs6000/aix52.h (TARGET_USE_JCR_SECTION): Remove. * config/rs6000/aix53.h (TARGET_USE_JCR_SECTION): Remove. * config/rs6000/aix61.h (TARGET_USE_JCR_SECTION): Remove. gcc/c-family/ * c-cppbuiltin.c (c_cpp_builtins): Don't define __LIBGCC_JCR_SECTION_NAME__. libgcc/ * config/i386/cygming-crtbegin.c (_Jv_RegisterClasses): Remove. (__JCR_LIST__): Remove. (__gcc_register_frame): Don't attempt to _Jv_RegisterClasses. * config/i386/cygming-crtend.c (__JCR_END__): Remove. * config/ia64/crtbegin.S (__JCR_LIST__): Remove. * config/ia64/crtend.S (__JCR_END__): Remove. * crtstuff.c: Remove __LIBGCC_JCR_SECTION_NAME__ from preprocessor conditionals. (__JCR_LIST__, __JCR_END__): Remove. (frame_dummy): Don't attempt to _Jv_RegisterClasses. (__do_global_ctors_1): Likewise. From-SVN: r240739
2016-10-03invoke.texi: Update -Wint-in-bool-context.Bernd Edlinger2-0/+16
2016-10-03 Bernd Edlinger <bernd.edlinger@hotmail.de> * doc/invoke.texi: Update -Wint-in-bool-context. c-family: 2016-10-03 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-common.c (c_common_truthvalue_conversion): Warn for suspicious left shift in boolean context. cp: 2016-10-03 Bernd Edlinger <bernd.edlinger@hotmail.de> * parser.c (cp_parser_condition): Fix a warning. testsuite: 2016-10-03 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-c++-common/Wint-in-bool-context.c: Update test. From-SVN: r240706
2016-09-29Implement P0001R1 - C++17 removal of register storage class specifier c-family/Jakub Jelinek3-0/+15
Implement P0001R1 - C++17 removal of register storage class specifier c-family/ * c.opt (Wregister): New warning. * c-opts.c (c_common_post_options): Enable -Wregister by default for C++17. cp/ * decl.c (cp_finish_decl): Diagnose register storage class on vars except when used in GNU global or local register variable extension. (grokdeclarator): Diagnose register storage class on parameters. * except.c (expand_start_catch_block): Set DECL_REGISTER only after cp_finish_decl call. testsuite/ * c-c++-common/Wvarargs-2.c (foo1): Except new warning for C++17. * c-c++-common/vector-subscript-2.c (vf): Expect new error for C++17. * c-c++-common/vector-subscript-5.c (foo): Don't use register keyword if not __SSE2__. * c-c++-common/Wvarargs.c (foo1, foo3): Expect new warnings for C++17. * g++.dg/compat/struct-layout-1_generate.c (iterative_hash): Remove register keywords. * g++.dg/eh/pr29166.C: Add -Wno-register option. * g++.dg/warn/register-parm-1.C (erroneous_warning, no_erroneous_warning): Expect new warnings for C++17. * g++.dg/warn/register-var-2.C (f): Likewise. * g++.dg/parse/register1.C (f): Expect new error for C++17. * g++.dg/parse/linkage2.C (foo): Likewise. * g++.dg/torture/pr36826.C (CoinMin, CoinMax): Avoid register keyword on parameters for C++17. * g++.dg/cpp1z/register1.C: New test. * g++.dg/cpp1z/register2.C: New test. * g++.dg/cpp1z/register3.C: New test. From-SVN: r240638
2016-09-29[Patch] Remove all uses of TARGET_FLT_EVAL_METHOD_NON_DEFAULT and poison itJames Greenhalgh2-2/+7
I'm going to hookize TARGET_FLT_EVAL_METHOD, so the current definition of TARGET_FLT_EVAL_METHOD_NON_DEFAULT will stop working. The relaxation enabled by TARGET_FLT_METHOD_NON_DEFAULT isn't portable, and keeping it in place is tricky, so this patch removes it, and poisons TARGET_FLT_EVAL_METHOD_NON_DEFAULT in system.h to prevent future use. gcc/ * defaults.h (TARGET_FLT_EVAL_METHOD_NON_DEFAULT): Remove. * system.h (TARGET_FLT_EVAL_METHOD_NON_DEFAULT): Poison. gcc/c-family/ * c-opts.c (c_common_post_options): Remove special case for TARGET_FLT_EVAL_METHOD_NON_DEFAULT with -fexcess-precision=standard in C++. gcc/java/ * lang.c (java_post_options): Remove special case for TARGET_FLT_EVAL_METHOD_NON_DEFAULT with -fexcess-precision=standard. gcc/fortran/ * options.c (gfc_post_options): Remove special case for TARGET_FLT_EVAL_METHOD_NON_DEFAULT with -fexcess-precision=standard. gcc/ada/ * gcc-interface/misc.c (gnat_post_options): Remove special case for TARGET_FLT_EVAL_METHOD_NON_DEFAULT with -fexcess-precision=standard. From-SVN: r240614
2016-09-27c-cppbuiltin.c (c_cpp_builtins): Define __cpp_capture_star_this for -std=c++1z.Jakub Jelinek2-0/+4
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_capture_star_this for -std=c++1z. * g++.dg/cpp1z/feat-cxx1z.C: Add __cpp_capture_star_this test. From-SVN: r240557
2016-09-27auto-inc-dec.c (try_merge): Remove break after return.Jakub Jelinek2-1/+4
* auto-inc-dec.c (try_merge): Remove break after return. * cselib.c (autoinc_split): Likewise. * explow.c (promote_mode): Likewise. * fixed-value.c (fixed_arithmetic): Likewise. * hsa.c (hsa_internal_fn::get_arity): Likewise. * rtlanal.c (modified_between_p, modified_in_p): Likewise. * trans-mem.c (get_attrs_for): Likewise. * tree-if-conv.c (if_convertible_stmt_p): Likewise. * tree-vrp.c (simplify_stmt_using_ranges): Likewise. * config/aarch64/aarch64-builtins.c (aarch64_fold_builtin): Likewise. * config/aarch64/aarch64.c (aarch64_get_condition_code_1): Likewise. * config/c6x/c6x.c (c6x_get_unit_specifier): Likewise. * config/cr16/cr16.c (legitimate_pic_operand_p): Likewise. * config/cris/cris.c (cris_op_str): Likewise. * config/mn10300/mn10300.c (cc_flags_for_code): Likewise. * config/tilepro/tilepro.c (tilepro_emit_setcc_internal_di): Likewise. c-family/ * c-ada-spec.c (print_ada_declaration): Remove break after return. objc/ * objc-act.c (continue_class): Remove break after return. (objc_maybe_printable_name): Likewise. fortran/ * dependency.c (gfc_dep_compare_expr): Remove break after return. * frontend-passes.c (optimize_op): Likewise. * interface.c (gfc_current_interface_head): Likewise. * symbol.c (check_conflict): Likewise. * trans-intrinsic.c (build_fix_expr): Likewise. ada/ * terminals.c (is_gui_app): Remove break after return. From-SVN: r240554
2016-09-26tree.h (memmodel_from_int, [...]): Move to ...Thomas Preud'homme2-0/+5
2016-09-26 Thomas Preud'homme <thomas.preudhomme@arm.com> gcc/ * tree.h (memmodel_from_int, memmodel_base, is_mm_relaxed, is_mm_consume, is_mm_acquire, is_mm_release, is_mm_acq_rel, is_mm_seq_cst, is_mm_sync): Move to ... * memmodel.h: This. New file. * builtins.c: Include memmodel.h. * optabs.c: Likewise. * tsan.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mips/mips.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/sparc/sparc.c: Likewise. * genconditions.c: Include memmodel.h in generated file. * genemit.c: Likewise. * genoutput.c: Likewise. * genpeep.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. gcc/c-family/ * c-common.c: Include memmodel.h. From-SVN: r240504
2016-09-26c-lex.c (c_common_has_attribute): Handle attribute fallthrough.Marek Polacek2-1/+6
* c-lex.c (c_common_has_attribute): Handle attribute fallthrough. * system.h: Use __has_attribute to check whether the fallthrough attribute is supported. * g++.dg/cpp1z/feat-cxx1z.C: Test attribute fallthrough. From-SVN: r240499
2016-09-26Implement -Wimplicit-fallthrough.Marek Polacek3-0/+51
Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r240485
2016-09-24re PR c/77490 (bit-not (~) on boolean should be warned about)Marek Polacek2-0/+9
PR c/77490 * c.opt (Wbool-operation): New. * c-typeck.c (build_unary_op): Warn about bit not on expressions that have boolean value. Warn about ++/-- on booleans. * typeck.c (cp_build_unary_op): Warn about bit not on expressions that have boolean value. * doc/invoke.texi: Document -Wbool-operation. * c-c++-common/Wbool-operation-1.c: New test. * gcc.dg/Wbool-operation-1.c: New test. From-SVN: r240462
2016-09-21c-common.c (c_common_truthvalue_conversion): Inhibit Wint-in-bool-context ↵Bernd Edlinger2-2/+10
warning with from_macro_definition_at. 2016-09-21 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-common.c (c_common_truthvalue_conversion): Inhibit Wint-in-bool-context warning with from_macro_definition_at. Mention the expression will always evaluate to true. From-SVN: r240331
2016-09-21PR bootstrap/77676 - powerpc64 and powerpc64le stage2 bootstrap failMartin Sebor2-1/+7
* c.opt (fprintf-return-value): Temporarily initialize to zero to unblock bootstrap failures. From-SVN: r240321