aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
AgeCommit message (Collapse)AuthorFilesLines
2012-06-29configure.ac: Skip C if explicitly selected.Steven Bosscher1-10155/+0
toplevel/ * configure.ac: Skip C if explicitly selected. * configure: Regenerate. gcc/ * configure.ac: Remove special gtfiles case for C. * configure: Regenerate. * Makefile.in: Remove C front-end hooks and build hooks that will be picked up from c/Make-lang.in now. Add tree-mudflap to C_COMMON_OBJS. * gengtype.c (files_rules): Adjust gt-files for c/c-decl.c. * config/vms/vms.c: Look for c-tree.h in c/. * doc/gty.texi: Remove reference to c-config-lang.in. * doc/sourcebuild.texi: Document the c/ subdirectory. c/ * Make-lang.in: New file, rules migrated from gcc/Makefile.in and add language Makefile hooks. * config-lang.in: New file. * c-config-lang.in: Moved from gcc/config-lang.in to here, and add the required "normal" config-lang.in rules. * c-lang.h: Moved from gcc/ to here. * c-tree.h: Likewise. * c-objc-common.c: Likewise. * c-objc-common.h: Likewise. * c-typeck.c: Likewise. * c-convert.c: Likewise. * c-lang.c: Likewise. * c-aux-info.c: Likewise. * c-errors.c: Likewise. * gccspec.c: Likewise. * c-decl.c: Likewise. Include gt-c-c-decl.h, not gt-c-decl.h. * c-parser.c: Likewise. Include gt-c-c-parser.h, not gt-c-parser.h. c-family/ * cppspec.c: Moved from gcc/ to here. objc/ * Make-ang.in: Adjust for move of C front-end files. * config-lang.in: Likewise. * objc-encoding.c: Look for cp-tree.h in cp/, and for c-tree.h and c-lang.h in c/. * objc-runtime-shared-support.c: Likewise. * objc-next-runtime-abi-01.c: Likewise. * objc-next-runtime-abi-02.c: Likewise. * objc-gnu-runtime-abi-01.c: Likewise. * objc-act.c: Likewise. * objc-lang.c: Likewise. cp/ * Make-lang.in: Remove tree-mudflap.o from CXX_AND_OBJCXX_OBJS. From-SVN: r189080
2012-06-21re PR c/53702 (ICE with -Wall and nested functions and unused typedef)Meador Inge1-4/+12
PR c/53702 * c-decl.c (c_push_function_context): Restore the behavior to reuse the language function allocated for -Wunused-local-typedefs. (c_pop_function_context): If necessary, clear the language function created in c_push_function_context. Always clear out the x_cur_stmt_list field of the restored language function. testsuite/ * gcc.dg/Wunused-local-typedefs.c: New testcase. From-SVN: r188860
2012-06-19The intent of the phases was to have a high-level but mutually exclusive ↵Lawrence Crowl1-2/+2
accounting of compile time. The intent of the phases was to have a high-level but mutually exclusive accounting of compile time. We want to track compile time in a way that tells us which conceptual phases are taking the most time. That intent is not currently satisfied. This patch restores that intent. Add code to verify that the sum of the phase times is less than the total time, to detect when phases are overlapped. A slight amount of leeway is required due to time jitters. This verification is done as the last step in printing timevars so that any timevar information is not lost. Rename the phases to be clearer about what they measure, so that they are less likely to be modified to be overlapping. The primary example is to change TV_PHASE_GENERATE to TV_PHASE_LATE_ASM, meaning late work on the assembly. This name change avoids confusion n moving the timevar start call after the call to lang_hooks.decls.final_write_globals, which prevents overlapping phases. Each implementation of lang_hooks.decls.final_write_globals, is responsible for starting and stopping its own phases. Each implementation currently has a first phase of TV_PHASE_DEFERRED for front-end work deferred until after parsing is complete. The second phase has been renamed from TV_PHASE_CGRAPH to TV_PHASE_OPT_GEN, to better reflect its use as the main optimization and generation phase. This phase accounts for 70%-80% of compilation time during bootstrap. The third phase is TV_PHASE_DBGINFO, except in cp/decl2.c, where it is TV_PHASE_CHECK_DBGINFO because cc1plus mixes checking in with debug info generation. In langhooks.c, write_global_declarations was using TV_PHASE_CHECK_DBGINFO, but it was doing no checking. So, it now uses TV_PHASE_DBGINFO. The changes to LTO are significant. First, initialization now uses TV_PHASE_SETUP. Reading files now uses TV_PHASE_STREAM_IN. Writing files now uses TV_PHASE_STREAM_OUT. The remaining phase is TV_PHASE_OPT_GEN (formerly TV_PHASE_CGRAPH). Finally, because LTO is treated as a front end, TV_PHASE_PARSING and TV_PARSE_GLOBAL active around it. It is not parsing, and so those timers should not be active. Rather than make all front ends manage them, we turn them off as the first thing in LTO and turn them back on as the last thing. Tested on x86_64. Index: gcc/ChangeLog 2012-06-18 Lawrence Crowl <crowl@google.com> * timevar.def (TV_PHASE_GENERATE): Rename to TV_PHASE_LATE_ASM. (TV_PHASE_CGRAPH): Rename to TV_PHASE_OPT_GEN. (TV_PHASE_STREAM_IN): New. (TV_PHASE_STREAM_OUT): New. * timevar.c (validate_phases): New. (timevar_print): Call validate_phases. * c-decl.c (c_write_global_declarations): Rename use of TV_PHASE_CGRAPH to TV_PHASE_OPT_GEN. * langhooks.c (write_global_declarations): Rename use of TV_PHASE_CGRAPH to TV_PHASE_OPT_GEN. Use TV_PHASE_DBGINFO instead of TV_PHASE_CHECK_DBGINFO. * toplev.c (compile_file): Rename use of TV_PHASE_GENERATE to TV_PHASE_LATE_ASM. Move start of TV_PHASE_LATE_ASM to after call to lang_hooks.decls.final_write_globals. Index: gcc/cp/ChangeLog 2012-06-18 Lawrence Crowl <crowl@google.com> * decl2.c (cp_write_global_declarations): Rename use of TV_PHASE_CGRAPH to TV_PHASE_OPT_GEN. Index: gcc/lto/ChangeLog 2012-06-18 Lawrence Crowl <crowl@google.com> * lto.c (do_whole_program_analysis): Rename use of TV_PHASE_CGRAPH to TV_PHASE_OPT_GEN. Use new timevar TV_PHASE_STREAM_OUT around the call to lto_wpa_write_files. (lto_main): Rename use of TV_PHASE_CGRAPH to TV_PHASE_OPT_GEN. Move start of TV_PHASE_OPT_GEN to include call to materialize_cgraph. Use TV_PHASE_SETUP for the call to lto_init. Use new timevar TV_PHASE_STREAM_IN around the call to read_cgraph_and_symbols. Turn TV_PHASE_PARSING off then back on again, because LTO is pretending to be a front end, but is not one. From-SVN: r188765
2012-06-12re PR c/53532 (function call ignored when called with argument of ↵Jakub Jelinek1-1/+4
incompatible, undefined structure) PR c/53532 PR c/51034 PR c/53196 * c-decl.c (build_compound_literal): Call c_incomplete_type_error if type isn't complete. * gcc.dg/pr53532.c: New test. * gcc.dg/c99-complit-2.c: Add two new dg-error directives, adjust line numbers. * gcc.dg/noncompile/950825-1.c: Expect incomplete type error message. * gcc.dg/Wcxx-compat-8.c: Likewise. * gcc.dg/pr51034.c: New test. * gcc.dg/pr53196-1.c: New test. * gcc.dg/pr53196-2.c: New test. From-SVN: r188483
2012-06-04output.h (merge_weak, [...]): Move protos from here...Steven Bosscher1-1/+0
* output.h (merge_weak, assemble_alias, initializer_constant_valid_p, initializer_constant_valid_for_bitfield_p): Move protos from here... * tree.h: ... to here. * cgraphclones.c: Do not include output.h. * gimplify.c: Likewise. * reload.c: Likewise. * recog.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-switch-conversion.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * Makefile.in: Fix dependencies. c-family/ * c-common.c: Do not include output.h. * c-pragma.c: Likewise. cp/ * semantics.c: Do not include output.h. * decl2.c: Likewise. * friend.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. * Make-lang.in: Fix dependencies. ada/ * gcc-interface/utils2.c: Do not include output.h. * gcc-interface/Make-lang.in: Fix dependencies. From-SVN: r188178
2012-05-29c-decl.c (c_push_function_context): Always create a new language function.Meador Inge1-10/+4
2012-05-29 Meador Inge <meadori@codesourcery.com> * c-decl.c (c_push_function_context): Always create a new language function. (c_pop_function_context): Clear the language function created in c_push_function_context. From-SVN: r187979
2012-05-29rtl.h (assign_stack_temp, [...]): Remove 'keep' argument.Michael Matz1-2/+0
* rtl.h (assign_stack_temp, assign_stack_temp_for_type, assign_temp): Remove 'keep' argument. (mark_temp_addr_taken): Remove prototype. * tree.h (expand_decl): Remove prototype. * function.c (struct temp_slot): Remove addr_taken and keep member. (assign_stack_temp_for_type) Don't initialize above, remove keep argument. (assign_stack_temp, assign_temp): Remove keep argument. (mark_temp_addr_taken): Remove. (preserve_temp_slots): Remove handling of addr_taken and keep members. (free_temp_slots): Ditto. * expr.c (expand_expr_real_1 <COMPOUND_LITERAL_EXPR>): Remove dead code. * stmt.c (expand_asm_operands): Remove dead code. (expand_decl): Remove. * c-decl.c (finish_struct): Don't call expand_decl. * builtins.c (expand_builtin_cexpi): Adjust calls to assign_temp and assign_stack_temp. * calls.c (save_fixed_argument_area, initialize_argument_information, expand_call, emit_library_call_value_1, store_one_arg): Ditto. * expmed.c (extract_bit_field_1): Ditto. * expr.c (emit_group_load_1, emit_group_store, copy_blkmode_from_reg, emit_push_insn, expand_assignment, store_field, expand_constructor, expand_cond_expr_using_cmove, expand_expr_real_2, expand_expr_real_1): Ditto. * stmt.c (expand_asm_operands, expand_return): Ditto. * function.c (pop_temp_slots): Call free_temp_slots. * calls.c (store_one_arg): Don't call preserve_temp_slots or free_temp_slots. * expr.c (expand_assignment): Don't call free_temp_slots. * config/arm/arm.c (neon_expand_vector_init): Ditto. * config/i386/i386.c (ix86_expand_vector_set): Ditto. (ix86_expand_vector_extract): Ditto. * config/ia64/ia64.c (spill_xfmode_rfmode_operand, ia64_expand_movxf_movrf): Ditto. * config/mips/mips.c (mips_expand_vi_general): Ditto. * config/mmix/mmix.md (floatdisf2, floatunsdisf2, truncdfsf2, extendsfdf2): Ditto. * config/rs6000/rs6000.c (rs6000_expand_vector_init, rs6000_expand_vector_set, rs6000_expand_vector_extract, rs6000_allocate_stack_temp): Ditto. * config/rs6000/rs6000.md (fix_trunctfsi2_fprs): Ditto. * config/sparc/sparc.c (emit_soft_tfmode_libcall, sparc_emit_float_lib_cmp, sparc_emit_float_lib_cmp, sparc_expand_vector_init): Ditto. From-SVN: r187965
2012-05-16PR preprocessor/7263 - Avoid pedantic warnings on system headers macro tokensDodji Seketeli1-29/+98
Now that we track token locations accross macro expansions, it would be cool to be able to fix PR preprocessor/7263 for real. That is, consider this example where we have a system header named header.h like this: #define _Complex __complex__ #define _Complex_I 1.0iF and then a normal C file like this: #include "header.h" static _Complex float c = _Complex_I; If we compile the file with -pedantic, the usages of _Complex or _Complex_I should not trigger any warning, even though __complex__ and the complex literal are extensions to the standard C. They shouldn't trigger any warning because _Complex and _Complex_I are defined in a system header (and expanded in normal user code). To be able to handle this, we must address two separate concerns. First, warnings about non-standard usage of numerical literals are emitted directly from within libcpp. So we must teach libcpp's parser for numerical literals to use virtual locations, instead of the spelling location it uses today. Once we have that, as the diagnostics machinery already knows how to avoid emitting errors happening on tokens that come from system headers, we win. Second, there is the issue of tracking locations for declaration specifiers, like the "_Complex" in the declaration: static _Complex float c; For that, we need to arrange for each possible declaration specifier to have its own location, because otherwise, we'd warn on e.g, on: _Complex float c; but not on: static _Complex float c; So this patch addresses the two concerns above. It's actually a follow-up on an earlier patch[1] I wrote as part of my initial work on virtual locations. We then agreed[2] that the second concern was important to address before the patch could get a chance to go in. [1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00957.html [2]: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00264.html Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk. libcpp/ PR preprocessor/7263 * include/cpplib.h (cpp_classify_number): Take a location parameter. * expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic macros that take a location parameter. (cpp_classify_number): Take a (virtual) location parameter. Use it for diagnostics. Adjust comments. (eval_token): Take a location parameter. Pass it to cpp_classify_number and to diagnostic routines. (_cpp_parse_expr): Use virtual locations of tokens when parsing expressions. Pass a virtual location to eval_token and to diagnostic routines. gcc/c-family/ PR preprocessor/7263 * c-lex.c (c_lex_with_flags): Pass a virtual location to the call to cpp_classify_number. For diagnostics, use the precise location instead of the global input_location. gcc/ PR preprocessor/7263 * c-tree.h (enum c_declspec_word): Declare new enum. (struct c_declspecs::locations): New member. (declspecs_add_qual, declspecs_add_scspec) (declspecs_add_addrspace, declspecs_add_alignas): Take a new location parameter. * c-decl.c (build_null_declspecs): Initialize the new struct c_declspecs::locations member. (declspecs_add_addrspace): Take a location parameter for the address space. Store it onto declaration specifiers. (declspecs_add_qual): Likewise, take a location parameter for the qualifier. (declspecs_add_type): Likewise, take a location parameter for the type specifier. (declspecs_add_scspec): Likewise, take a location parameter for the storage class specifier. (declspecs_add_attrs): Likewise, take a location parameter for the first attribute. (declspecs_add_alignas): Likewise, take a location parameter for the alignas token. (finish_declspecs): For diagnostics, use the location of the relevant declspec, instead of the global input_location. * c-parser.c (c_parser_parameter_declaration): Pass the precise virtual location of the declspec to the declspecs-setters. (c_parser_declspecs): Likewise. Avoid calling c_parser_peek_token repeatedly. gcc/cp/ PR preprocessor/7263 * cp-tree.h (enum cp_decl_spec): Add new enumerators to cover all the possible declarator specifiers so far. (struct cp_decl_specifier_seq::locations): Declare new member. (cp_decl_specifier_seq::{specs, type_location}): Remove. (decl_spec_seq_has_spec_p): Declare new function. * parser.c (cp_parser_check_decl_spec): Remove. (set_and_check_decl_spec_loc): Define new static function. (decl_spec_seq_has_spec_p): Define new public function. (cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt) (cp_parser_type_specifier, cp_parser_simple_type_specifier) (cp_parser_set_storage_class, cp_parser_set_decl_spec_type) (cp_parser_alias_declaration): Set the locations for each declspec, using set_and_check_decl_spec_loc. (cp_parser_explicit_instantiation, cp_parser_init_declarator) (cp_parser_member_declaration, cp_parser_init_declarator): Use the new declspec location for specifiers. Use the new decl_spec_seq_has_spec_p. (cp_parser_type_specifier_seq): Use the new set_and_check_decl_spec_loc. Stop using cp_parser_check_decl_spec. Use the new decl_spec_seq_has_spec_p. (, cp_parser_init_declarator): Use the new set_and_check_decl_spec_loc. (cp_parser_single_declaration, cp_parser_friend_p) (cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration): Use the new decl_spec_seq_has_spec_p. * decl.c (check_tag_decl): Use new decl_spec_seq_has_spec_p. Use the more precise ds_redefined_builtin_type_spec location for diagnostics about re-declaring C++ built-in types. (start_decl, grokvardecl, grokdeclarator): Use the new decl_spec_seq_has_spec_p. gcc/testsuite/ PR preprocessor/7263 * gcc.dg/binary-constants-2.c: Run without tracking locations accross macro expansion. * gcc.dg/binary-constants-3.c: Likewise. * gcc.dg/cpp/sysmac2.c: Likewise. * testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise location. * gcc.dg/cpp/syshdr3.c: New test. * gcc.dg/cpp/syshdr3.h: New header for the new test above. * gcc.dg/system-binary-constants-1.c: New test. * gcc.dg/system-binary-constants-1.h: New header for the new test above. * g++.dg/cpp/syshdr3.C: New test. * g++.dg/cpp/syshdr3.h: New header the new test above. * g++.dg/system-binary-constants-1.C: New test. * g++.dg/system-binary-constants-1.h: New header the new test above. From-SVN: r187587
2012-05-02tree.c (valid_constant_size_p): New function.Richard Guenther1-3/+3
2012-05-02 Richard Guenther <rguenther@suse.de> * tree.c (valid_constant_size_p): New function. * tree.h (valid_constant_size_p): Declare. * cfgexpand.c (expand_one_var): Adjust check for too large variables by using valid_constant_size_p. * varasm.c (assemble_variable): Likewise. c/ * c-decl.c (grokdeclarator): Properly check for sizes that cover more than half of the address-space. cp/ * decl.c (grokdeclarator): Properly check for sizes that cover more than half of the address-space. 2012-05-02 Richard Guenther <rguenther@suse.de> * fold-const.c (div_if_zero_remainder): sizetypes no longer sign-extend. (int_const_binop_1): New worker for int_const_binop with overflowable parameter. Pass it through to force_fit_type_double. (int_const_binop): Wrap around int_const_binop_1 with overflowable equal to one. (size_binop_loc): Call int_const_binop_1 with overflowable equal to minus one, forcing overflow detection for even unsigned types. (extract_muldiv_1): Remove bogus TYPE_IS_SIZETYPE special-casing. (fold_binary_loc): Call try_move_mult_to_index with signed offset. * stor-layout.c (initialize_sizetypes): sizetypes no longer sign-extend. (layout_type): For zero-sized arrays ignore overflow on the size calculations. * tree-ssa-ccp.c (bit_value_unop_1): Likewise. (bit_value_binop_1): Likewise. * tree.c (double_int_to_tree): Likewise. (double_int_fits_to_tree_p): Likewise. (force_fit_type_double): Likewise. (host_integerp): Likewise. (int_fits_type_p): Likewise. * varasm.c (output_constructor_regular_field): Sign-extend the field-offset to cater for negative offsets produced by the Ada frontend. * omp-low.c (extract_omp_for_data): Convert the loop step to signed for pointer adjustments. * g++.dg/tree-ssa/pr19807.C: Adjust. From-SVN: r187042
2012-05-01re PR c/37303 (const compound initializers in structs are written to .data ↵Ian Lance Taylor1-1/+3
instead of .rodata) gcc/: PR c/37303 * c-decl.c (build_compound_literal): Make the decl readonly if it an array of a readonly type. * gimplify.c (gimplify_compound_literal_expr): Add fallback parameter. Change all callers. If the decl is not addressable and is not an l-value, make it readonly. gcc/testsuite: PR c/37303 * gcc.dg/pr37303.c: New test. From-SVN: r187027
2012-04-30cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.cJan Hubicka1-1/+1
* cgraph.c (ld_plugin_symbol_resolution_names): Move to symtab.c (cgraph_asm_nodes, cgraph_asm_last_node): Move to cgraphunit.c (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Move to cgraphunit.c. (cgraph_make_decl_local): Move to symtab.c (cgraph_make_node_local_1): Update. (cgraph_can_remove_if_no_direct_calls_and): Update. (used_from_object_file_p): Update. (resolution_used_from_other_file_p): Move to symtab.c (cgraph_used_from_object_file_p): move to symtab.c (verify_cgraph_node): Verify same comdat groups. * cgraph.h (cgraph_asm_node): Rename to ... (asm_node): ... this one. (cgraph_asm_nodes): Rename to ... (asm_nodes): ... this one. (symtab_add_to_same_comdat_group): New function. (symtab_dissolve_same_comdat_group_list): New function. (symtab_used_from_object_file_p): Declare. (symtab_make_decl_local): Declare. (cgraph_add_to_same_comdat_group): Remove. (cgraph_add_asm_node): Remove. (cgraph_used_from_object_file_p, varpool_used_from_object_file_p): Remove. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one. (cgraph_optimize): Rename to .... (compile): ... this one. (add_asm_node): Declare. (fixup_same_cpp_alias_visibility): Declare. (cgraph_make_decl_local): Remove. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one. (varpool_remove_unreferenced_decls): Remove. * ipa-inline-transform.c (clone_inlined_nodes): Dissolve comdat groups. (preserve_function_body_p): Make static. * toplev.c (compile_file): Update comments; update. * cgraphunit.c: Update comments. (cgraph_expand_all_functions): Rename to ... (expand_all_functions): ... this one; update. (cgraph_mark_functions_to_output): Rename to ... (mark_functions_to_output): ... this one; cleanup. (cgraph_output_pending_asms): Remove prototype. (asm_nodes, asm_last_node): New static vars. (cgraph_process_new_functions): Update. (cgraph_reset_node): Cleanup; add comment. (cgraph_add_new_function): Update. (cgraph_output_pending_asms): Rename to ... (output_asm_statements): ... this one. (add_asm_node): New function. (fixup_same_cpp_alias_visibility): New function based on code in cgraph_analyze_function. (cgraph_analyze_function): Use it. (cgraph_order_sort): Update. (cgraph_output_in_order): Update. (cgraph_function_versioning): Update. (cgraph_optimize): Rename to ... (compile): ... this one; initialize streamer hooks here. (cgraph_finalize_compilation_unit): Rename to ... (finalize_compilation_unit): ... this one; do not initialize streamer hook here. * lto-streamer-out.c (lto_output_toplevel_asms): Update. * dwarf2out.c: Update ocmment. * optimize.c (maybe_clone_body): Use symtab_add_to_same_comdat_group. * method.c (use_thunk): Likewise. * semantics.c (maybe_add_lambda_conv_op): Likewise. * decl2.c (maybe_emit_vtables): Likewise. (cp_write_global_declarations): Use finalize_compilation_unit. * parser.c (cp_parser_asm_definition): Use add_asm_node. * lto-streamer-in.c (lto_input_toplevel_asms): Use add_asm_node * c-decl.c (c_write_global_declarations): Use finalize_compilation_unit. * langhooks.c (write_global_declarations): Update. * ipa.c (cgraph_externally_visible_p): Update. (dissolve_same_comdat_group_list): Remove. (function_and_variable_visibility): Update. * symtab.c: Inlcude lto-streamer.h and rtl.h (ld_plugin_symbol_resolution_names): New. (symtab_add_to_same_comdat_group): New. (symtab_dissolve_same_comdat_group_list): New. (resolution_used_from_other_file_p): Move here from cgraph.c (symtab_used_from_object_file_p): New. (symtab_make_decl_local): New. * passes.c (register_pass): Update comments. * c-parser.c (c_parser_asm_definition): Update. * varpool.c (varpool_analyze_node): Use fixup_same_cpp_alias_visibility. (varpool_remove_unreferenced_decls): Make static. (varpool_assemble_pending_decls): Rename to ... (varpool_output_variables): ... this one; call varpool_remove_unreferenced_decls. (varpool_used_from_object_file_p): Remove. * gogo-tree.cc (Gogo::write_globals): Use finalize_compilation_unit. * gcc-interface/utils.c (rest_of_subprog_body_compilation): Update comment. (gnat_write_global_declarations): Use finalize_compilation_unit. * f95-lang.c (gfc_finish): Update comments. * lto.c (lto_main): Use compile (). * lto-partition.c (partition_cgraph_node_p): Use symtab_used_from_object_file_p. (partition_varpool_node_p): Likewise. From-SVN: r186998
2012-04-23lto-symtab.c (lto_cgraph_replace_node): Do not call mark_reahcable_node.Jan Hubicka1-10/+0
* lto-symtab.c (lto_cgraph_replace_node): Do not call mark_reahcable_node. * cgraph.c (cgraph_remove_node): Do not clear reachable. (cgraph_mark_reachable_node): Remove. (cgraph_mark_force_output_node): Do not set reachable. (dump_cgraph_node): Do not dump reachable. (cgraph_create_virtual_clone): Do not set reachable. * cgraph.h (cgraph_node): Remove reachable flag. (varpool_node): Remove reachable flag. (cgraph_mark_if_needed): Remove. (cgraph_mark_reachable_node): Remove. * tree-emutls.c (ipa_lower_emutls): Do not check reachable. * cgraphunit.c (cgraph_finalize_function): Do not mark node as reachable. (cgraph_add_new_function): Likewise. (cgraph_mark_if_needed): Remove. (cgraph_analyze_function): Do not set target as reachable. (process_function_and_variable_attributes): Do not care about dllexport. (cgraph_analyze_functions): Do not set reachable flags. (cgraph_mark_functions_to_output): Do not check reachability. (cgraph_copy_node_for_versioning): Do not set reachable flag. (dbxout_expand_expr): Update. * c-decl.c (merge_decls): Do not track changed externs. * ipa.c: Include pointer-set.h (enqueue_cgraph_node): Use reachable pointer set. (process_references): Likewise. (cgraph_remove_unreachable_nodes): Likewise. (whole_program_function_and_variable_visibility): Do not recompute reachable. * trans-mem.c (ipa_tm_execute): Do not check reachable flag. From-SVN: r186700
2012-04-22re PR c/44774 (-Werror=edantic)Manuel López-Ibáñez1-46/+46
2012-04-22 Manuel López-Ibáñez <manu@gcc.gnu.org> PR c/44774 gcc/ * doc/invoke.texi (pedantic): Rename to Wpedantic. * common.opt (Wpedantic): New. (pedantic): Alias Wpedantic. * diagnostic.c (warning_at): Likewise. * c-decl.c (diagnose_mismatched_decls): Likewise. (build_array_declarator): Likewise. (mark_forward_parm_decls): (check_bitfield_type_and_width): Likewise. (grokdeclarator): Likewise. (grokfield): Likewise. (finish_struct): Likewise. (build_enumerator): Likewise. (store_parm_decls_oldstyle): Likewise. (declspecs_add_qual): Likewise. (declspecs_add_type): Likewise. (finish_declspecs): Likewise. * c-typeck.c (composite_type): Likewise. (comp_target_types): Likewise. (build_array_ref): Likewise. (pointer_diff): Likewise. (build_unary_op): Likewise. (build_conditional_expr): Likewise. (build_c_cast): Likewise. (convert_for_assignment): Likewise. (maybe_warn_string_init): Likewise. (digest_init): Likewise. (pop_init_level): Likewise. (set_init_index): Likewise. (c_finish_goto_label): Likewise. (c_finish_return): Likewise. (do_case): Likewise. (build_binary_op): Likewise. * c-parser.c (static): Likewise. (c_parser_external_declaration): Likewise. (c_parser_declaration_or_fndef): Likewise. (c_parser_static_assert_declaration_no_se): Likewise. (c_parser_enum_specifier): Likewise. (c_parser_struct_or_union_specifier): Likewise. (c_parser_struct_declaration): Likewise. (c_parser_alignas_specifier): Likewise. (c_parser_braced_init): Likewise. (c_parser_initelt): Likewise. (c_parser_compound_statement_nostart): Likewise. (c_parser_conditional_expression): Likewise. (c_parser_alignof_expression): Likewise. (c_parser_postfix_expression): Likewise. (c_parser_postfix_expression_after_paren_): Likewise. (c_parser_objc_class_instance_variables): Likewise. (c_parser_objc_method_definition): Likewise. (c_parser_objc_methodprotolist): Likewise. c-family/ * c.opt (Wpedantic): New. (pedantic): Alias Wpedantic. * c-opts.c (c_common_handle_option): Replace -pedantic with -Wpedantic. (c_common_post_options): Likewise. (sanitize_cpp_opts): Likewise. * c-lex.c (interpret_float): Likewise. * c-format.c (check_format_types): Likewise. * c-common.c (pointer_int_sum): Likewise. (c_sizeof_or_alignof_type): Likewise. (c_add_case_label): Likewise. (c_do_switch_warnings): Likewise. * c-pragma.c (handle_pragma_float_const_decimal64): Likewise. cp/ * typeck.c (composite_pointer_type): Likewise. (cxx_sizeof_or_alignof_type): Likewise. (cp_build_array_ref): Likewise. (cp_build_function_call_vec): Likewise. (cp_build_addr_expr_1): Likewise. (convert_member_func_to_ptr): Likewise. * decl.c (check_tag_decl): Likewise. (check_static_variable_definition): Likewise. (compute_array_index_type): Likewise. (create_array_type_for_decl): Likewise. (grokdeclarator): Likewise. (grok_op_properties): Likewise. * error.c (maybe_warn_cpp0x): Likewise. * pt.c (maybe_process_partial_specialization): Likewise. (convert_template_argument): Likewise. (do_decl_instantiation): Likewise. (do_type_instantiation): Likewise. * parser.c (cp_parser_primary_expression): Likewise. (cp_parser_postfix_expression): Likewise. (cp_parser_unary_expression): Likewise. (cp_parser_question_colon_clause): Likewise. (cp_parser_lambda_introducer): Likewise. (cp_parser_lambda_declarator_opt): Likewise. (cp_parser_compound_statement): Likewise. (cp_parser_jump_statement): Likewise. (cp_parser_declaration_seq_opt): Likewise. (cp_parser_enum_specifier): Likewise. (cp_parser_enumerator_list): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_member_declaration): Likewise. * call.c (build_conditional_expr_1): Likewise. * friend.c (make_friend_class): Likewise. * name-lookup.c (pushdecl_maybe_friend_1): Likewise. From-SVN: r186681
2012-03-09c-tree.h (c_default_pointer_mode): New variable.Tristan Gingold1-3/+24
2012-03-09 Tristan Gingold <gingold@adacore.com> * c-tree.h (c_default_pointer_mode): New variable. * c-decl.c (c_default_pointer_mode): New variable. (c_build_pointer_type): New function. (grokdeclarator): Call c_build_pointer_type instead of build_pointer_type. * config/vms/vms-c.c: Include c-tree.h (saved_pointer_mode): New variable. (handle_pragma_pointer_size): New function. (vms_pragma_pointer_size, vms_pragma_required_pointer_size): Likewise. (vms_c_register_pragma): Register __pointer_size and __required_pointer_size pragmas. From-SVN: r185136
2012-02-23re PR c/52290 (internal compiler error: tree check: expected function_decl, ↵Uros Bizjak1-1/+2
have var_decl in start_function, at c-decl.c:7712) PR c/52290 * c-decl.c (start_function): Exit early if decl1 is not FUNTION_DECL. testsuite/ChangeLog: PR c/52290 * gcc.dg/noncompile/pr52290.c: New test. From-SVN: r184511
2012-02-14re PR c/52181 (merge_decls doesn't handle DECL_USER_ALIGN properly)Jakub Jelinek1-1/+2
PR c/52181 * c-decl.c (merge_decls): Copy DECL_USER_ALIGN bit from olddecl to newdecl. * decl.c (duplicate_decls): If olddecl has bigger DECL_ALIGN than newdecl, copy DECL_ALIGN to newdecl and or DECL_USER_ALIGN bits. * c-c++-common/pr52181.c: New test. From-SVN: r184193
2012-01-13c-decl.c: Do not include tree-mudflap.hSteven Bosscher1-1/+0
gcc/ * c-decl.c: Do not include tree-mudflap.h * tree-optimize.c: Likewise. * Makefile.in: Update dependencies. cp/ * decl2.c: Do not include tree-mudflap.h * semantics.c: Likewise. From-SVN: r183165
2012-01-06c-decl.c (ext_block): Moved up.Arnaud Charlet1-3/+8
* c-decl.c (ext_block): Moved up. (collect_all_refs, for_each_global_decl): Take ext_block into account. From-SVN: r182953
2011-12-20gcc:Joseph Myers1-6/+6
* c-decl.c (diagnose_mismatched_decls, grokdeclarator, grokfield) (finish_struct): Refer to C11 in comments. Use flag_isoc11. * c-parser.c (c_parser_static_assert_declaration) (c_parser_static_assert_declaration_no_semi, c_parser_declspecs) (c_parser_alignas_specifier, c_parser_alignof_expression): Refer to C11 in comments. Use flag_isoc11. * c-typeck.c (comptypes_check_different_types): Refer to C11 in comment. * doc/cpp.texi (Overview): Refer to -std=c11 instead of -std=c1x. * doc/cppopts.texi (-std=c11, -std=gnu11): Document in preference to -std=c1x and -std=gnu1x. * doc/extend.texi (Inline, Alternate Keywords, Other Builtins) (__builtin_complex, Unnamed Fields): Refer to -std=c11 and C11 instead of -std=c1x and C1X. * doc/invoke.texi (-std=c11, -std=iso9899:2011): Document in preference to -std=c1x. (-std=gnu11): Document in preference to -std=gnu1x. * doc/standards.texi: Document C11 instead of C1X. Document C11 as actual standard. Document headers required from freestanding C11 implementations. * ginclude/float.h, ginclude/stddef.h: Test __STDC_VERSION__ >= 201112L for C11. Update comments to refer to C11. gcc/c-family: * c-common.c (flag_isoc99): Update comment to refer to C11. (flag_isoc1x): Change to flag_isoc11. * c-common.h (flag_isoc99): Update comment to refer to C11. (flag_isoc1x): Change to flag_isoc11. * c-cppbuiltin.c (cpp_atomic_builtins): Change comment to refer to C11. * c-opts.c (set_std_c1x): Change to set_std_c11. (c_common_handle_option): Handle OPT_std_c11 and OPT_std_gnu11. Call set_std_c11. (set_std_c89, set_std_c99, set_std_c11): Use flag_isoc11. (set_std_c1): Use CLK_STDC11 and CLK_GNUC11. * c.opt (std=c1x): Change to std=c11. Document as non-draft standard. (std=c1x, std=iso9899:2011): Add as aliases of std=c11. (std=gnu1x): Change to std=gnu11. Refer to non-draft standard. (std=gnu1x): Make alias of std=gnu11. gcc/testsuite: * gcc.dg/c11-version-1.c, gcc.dg/c11-version-2.c, gcc.dg/c94-version-1.c, gcc.dg/c99-version-1.c, gcc.dg/gnu11-version-1.c: New tests. libcpp: * include/cpplib.h (CLK_GNUC1X): Change to CLK_GNUC11. (CLK_STDC1X): Change to CLK_STDC11. * init.c (lang_defaults): Update comments. (cpp_init_builtins): Update language tests. Use 201112L for C11 __STDC_VERSION__. From-SVN: r182551
2011-12-05re PR debug/51410 (duplicate variable DIE)Jakub Jelinek1-1/+1
PR debug/51410 * c-decl.c (pop_scope): Don't add DECL_EXTERNAL decls for debug info if scope is file_scope. * gcc.dg/debug/dwarf2/pr51410.c: New test. From-SVN: r182027
2011-12-05re PR c/51339 (ICE: in convert_move, at expr.c:326 with -fopenmp and ↵Jakub Jelinek1-2/+2
parallel for) PR c/51339 * c-decl.c (c_finish_incomplete_decl, finish_decl): Call relayout_decl instead of layout_decl. * gcc.dg/gomp/pr51339.c: New test. From-SVN: r182026
2011-11-24c-decl.c (warn_if_shadowing): Don't warn if shadowed identifier is from ↵Alan Modra1-1/+4
system header. * c-decl.c (warn_if_shadowing): Don't warn if shadowed identifier is from system header. From-SVN: r181684
2011-11-06c-decl.c (shadow_tag_warned, [...]): Handle _Alignas specifiers.Joseph Myers1-0/+83
* c-decl.c (shadow_tag_warned, grokdeclarator): Handle _Alignas specifiers. (build_null_declspecs): Initialize align_log and alignas_p fields. (declspecs_add_alignas): New. * c-parser.c (c_token_starts_declspecs): Handle RID_ALIGNAS. (c_parser_declspecs): Handle _Alignas specifiers. (c_parser_alignas_specifier): New. (c_parser_alignof_expression): Diagnose alignof use for non-C1X. Diagnose _Alignof (expression). * c-tree.h (struct c_declspecs): Add align_log and alignas_p fields. (declspecs_add_alignas): Declare. * ginclude/stddef.h (max_align_t): Define for C1X and C++11. * ginclude/stdalign.h: New. * Makefile.in (USER_H): Add stdalign.h. c-family: * c-common.c (c_common_reswords): Add _Alignas and _Alignof. (c_sizeof_or_alignof_type): Diagnose alignof applied to a function type. (check_user_alignment): New. Split out of handle_aligned_attribute. Disallow integer constants with noninteger types. Conditionally allow zero. (handle_aligned_attribute): Use check_user_alignment. * c-common.h (RID_ALIGNAS, check_user_alignment): New. testsuite: * g++.dg/cpp0x/alignof3.C, gcc.dg/c1x-align-1.c, gcc.dg/c1x-align-2.c, gcc.dg/c1x-align-3.c, gcc.dg/c1x-align-4.c, gcc.dg/c90-align-1.c, gcc.dg/c99-align-1.c: New tests. * gcc.dg/gnu89-const-expr-1.c, gcc.dg/gnu90-const-expr-1.c, gcc.dg/gnu99-const-expr-1.c, gcc.dg/gnu99-static-1.c: Update expected diagnostics. From-SVN: r181048
2011-10-11Convert standard builtin functions from being arrays to using a functional ↵Michael Meissner1-12/+16
interface From-SVN: r179820
2011-09-27common.opt: Add -foptimize-strlen option.Jakub Jelinek1-1/+15
* common.opt: Add -foptimize-strlen option. * Makefile.in (OBJS): Add tree-ssa-strlen.o. (tree-sssa-strlen.o): Add dependencies. * opts.c (default_options_table): Enable -foptimize-strlen by default at -O2 if not -Os. * passes.c (init_optimization_passes): Add pass_strlen after pass_object_sizes. * timevar.def (TV_TREE_STRLEN): New timevar. * params.def (PARAM_MAX_TRACKED_STRLENS): New parameter. * tree-pass.h (pass_strlen): Declare. * tree-ssa-strlen.c: New file. * c-decl.c (merge_decls): If compatible stpcpy prototype is seen, set implicit_built_in_decls[BUILT_IN_STPCPY]. cp/ * decl.c (duplicate_decls): If compatible stpcpy prototype is seen, set implicit_built_in_decls[BUILT_IN_STPCPY]. testsuite/ * gcc.dg/strlenopt-1.c: New test. * gcc.dg/strlenopt-1f.c: New test. * gcc.dg/strlenopt-2.c: New test. * gcc.dg/strlenopt-2f.c: New test. * gcc.dg/strlenopt-3.c: New test. * gcc.dg/strlenopt-4.c: New test. * gcc.dg/strlenopt-4g.c: New test. * gcc.dg/strlenopt-4gf.c: New test. * gcc.dg/strlenopt-5.c: New test. * gcc.dg/strlenopt-6.c: New test. * gcc.dg/strlenopt-7.c: New test. * gcc.dg/strlenopt-8.c: New test. * gcc.dg/strlenopt-9.c: New test. * gcc.dg/strlenopt-10.c: New test. * gcc.dg/strlenopt-11.c: New test. * gcc.dg/strlenopt-12.c: New test. * gcc.dg/strlenopt-12g.c: New test. * gcc.dg/strlenopt-13.c: New test. * gcc.dg/strlenopt-14g.c: New test. * gcc.dg/strlenopt-14gf.c: New test. * gcc.dg/strlenopt-15.c: New test. * gcc.dg/strlenopt-16g.c: New test. * gcc.dg/strlenopt-17g.c: New test. * gcc.dg/strlenopt-18g.c: New test. * gcc.dg/strlenopt.h: New file. From-SVN: r179277
2011-09-08PR c++/33255 - Support -Wunused-local-typedefs warningDodji Seketeli1-6/+36
gcc/ * c-decl.c (lookup_name): Use the new maybe_record_typedef_use. (pushdecl): Use the new record_locally_defined_typedef. (store_parm_decls): Allocate cfun->language. (finish_function): Use the new maybe_warn_unused_local_typedefs, and free cfun->language. (c_push_function_context): Allocate cfun->language here only if needed. (c_pop_function_context): Likewise, mark cfun->language for collection only when it should be done. * c-common.c (handle_used_attribute): Don't ignore TYPE_DECL nodes. * c-typeck.c (c_expr_sizeof_type, c_cast_expr): Use the new maybe_record_local_typedef_use. gcc/c-family * c-common.h (struct c_language_function::local_typedefs): New field. (record_locally_defined_typedef, maybe_record_typedef_use) (maybe_warn_unused_local_typedefs): Declare new functions. * c-common.c (record_locally_defined_typedef) (maybe_record_typedef_use) (maybe_warn_unused_local_typedefs): Define new functions. * c.opt: Declare new -Wunused-local-typedefs flag. gcc/cp * name-lookup.c (pushdecl_maybe_friend_1): Use the new record_locally_defined_typedef. * decl.c (finish_function): Use the new maybe_warn_unused_local_typedefs. (grokfield): Use the new record_locally_defined_typedef. * parser.c (lookup_name): Use the new maybe_record_typedef_use. gcc/doc/ * invoke.texi: Update documentation for -Wunused-local-typedefs. gcc/testsuite/ * g++.dg/warn/Wunused-local-typedefs.C: New test file. * c-c++-common/Wunused-local-typedefs.c: Likewise. libstdc++-v3/ * include/ext/bitmap_allocator.h (__detail::__mini_vector::__lower_bound): Remove unused typedef. * src/istream.cc (std::operator>>(basic_istream<char>& __in, basic_string<char>& __str)): Likewise. (std::getline): Likewise. * src/valarray.cc (__valarray_product): Likewise. From-SVN: r178692
2011-08-19c-decl.c (grokdeclarator): Diagnose _Noreturn for non-C1X if pedantic.Joseph Myers1-1/+12
* c-decl.c (grokdeclarator): Diagnose _Noreturn for non-C1X if pedantic. * c-parser.c (c_parser_declspecs): Include _Noreturn in syntax comment. * ginclude/stdnoreturn.h (noreturn): Don't define for C++. testsuite: * gcc.dg/c90-noreturn-1.c, gcc.dg/c99-noreturn-1.c: New tests. From-SVN: r177899
2011-08-18c-decl.c (shadow_tag_warned): Check for _Noreturn.Joseph Myers1-6/+33
* c-decl.c (shadow_tag_warned): Check for _Noreturn. (quals_from_declspecs): Assert _Noreturn not present. (grokdeclarator): Handle _Noreturn. (build_null_declspecs): Initialize noreturn_p. (declspecs_add_scspec): Handle RID_NORETURN. * c-parser.c (c_token_starts_declspecs, c_parser_declspecs) (c_parser_attributes): Handle RID_NORETURN. * c-tree.h (struct c_declspecs): Add noreturn_p. * ginclude/stdnoreturn.h: New. * Makefile.in (USER_H): Add stdnoreturn.h. c-family: * c-common.c (c_common_reswords): Add _Noreturn. (keyword_is_function_specifier): Handle RID_NORETURN. * c-common.h (RID_NORETURN): New. testsuite: * gcc.dg/c1x-noreturn-1.c, gcc.dg/c1x-noreturn-2.c, gcc.dg/c1x-noreturn-3.c, gcc.dg/c1x-noreturn-4.c, gcc.dg/c1x-noreturn-5.c: New tests. From-SVN: r177881
2011-08-11plugin.def: Add event for finish_decl.Romain Geissler1-0/+2
2011-08-11 Romain Geissler <romain.geissler@gmail.com> Brian Hackett <bhackett1024@gmail.com> gcc/ChangeLog: * plugin.def: Add event for finish_decl. * plugin.c (register_callback, invoke_plugin_callbacks): Same. * c-decl.c (finish_decl): Invoke callbacks on above event. * doc/plugins.texi: Document above event. gcc/cp/ChangeLog: * decl.c (cp_finish_decl): Invoke callbacks on finish_decl event. gcc/testsuite/ChangeLog: * g++.dg/plugin/decl_plugin.c: New. * g++.dg/plugin/decl-plugin-test.C: New. * g++.dg/plugin/plugin.exp: Add above testcase. Co-Authored-By: Brian Hackett <bhackett1024@gmail.com> From-SVN: r177674
2011-07-22re PR c++/30112 (pragma redefine_extname fails when namespaces are involved)Jason Merrill1-0/+8
PR c++/30112 gcc/c-family/ * c-common.h: Declare c_linkage_bindings. * c-pragma.c (handle_pragma_redefine_extname): Use it. gcc/ * c-decl.c (c_linkage_bindings): Define. gcc/cp/ * decl.c (cp_finish_decl): Apply pragma redefine_extname in other namespaces as well. * name-lookup.c (c_linkage_bindings): Define. (lookup_extern_c_fun_in_all_ns): Rename from lookup_extern_c_fun_binding_in_all_ns. Return tree. (pushdecl_maybe_friend_1): Adjust. Copy DECL_ASSEMBLER_NAME. Co-Authored-By: Mark Glisse <marc.glisse@normalesup.org> From-SVN: r176650
2011-07-06re PR tree-optimization/49645 (g++.dg/tree-ssa/pr8781.C FAILs on Tru64 UNIX)Richard Guenther1-0/+2
2011-07-06 Richard Guenther <rguenther@suse.de> PR tree-optimization/49645 * c-decl.c (finish_decl): Also set DECL_HARD_REGISTER for global register variables. * tree-ssa-sccvn.c (vn_reference_op_eq): Disregard differences in type qualification here ... (copy_reference_ops_from_ref): ... not here. (vn_reference_lookup_3): ... or here. (copy_reference_ops_from_ref): Record decl bases as MEM[&decl]. (vn_reference_lookup): Do the lookup with a valueized ao-ref. * g++.dg/tree-ssa/pr8781.C: Disable SRA. From-SVN: r175916
2011-07-05c-common.c (c_common_nodes_and_builtins): Build all common tree nodes first.Richard Guenther1-2/+0
2011-07-05 Richard Guenther <rguenther@suse.de> c-family/ * c-common.c (c_common_nodes_and_builtins): Build all common tree nodes first. * c-decl.c (c_init_decl_processing): Defer building common tree nodes to c_common_nodes_and_builtins. cp/ * decl.c (cxx_init_decl_processing): Defer building common tree nodes to c_common_nodes_and_builtins. From-SVN: r175856
2011-06-27c-common.h (c_tree_chain_next): New static inline function.Jakub Jelinek1-1/+1
* c-common.h (c_tree_chain_next): New static inline function. * c-decl.c (union lang_tree_node): Use it in chain_next expression. * cp-tree.h (union lang_tree_node): Use it in chain_next expression. From-SVN: r175542
2011-06-24re PR c++/46400 (g++ Segmentation Fault on heavily templated project.)Jakub Jelinek1-1/+1
PR c++/46400 * cp-tree.h (union lang_tree_node): Use TYPE_NEXT_VARIANT instead of TYPE_CHAIN for chain_next for types. * c-decl.c (union lang_tree_node): Use TYPE_NEXT_VARIANT instead of TYPE_CHAIN for chain_next for types. From-SVN: r175389
2011-06-10cp-tree.h (error_operand_p): Remove.Paolo Carlini1-1/+1
/gcc/cp 2011-06-10 Paolo Carlini <paolo.carlini@oracle.com> * cp-tree.h (error_operand_p): Remove. /gcc 2011-06-10 Paolo Carlini <paolo.carlini@oracle.com> * tree.h (error_operand_p): Add. * dbxout.c (dbxout_type_fields): Use the latter. * c-decl.c (add_stmt): Likewise. * gimplify.c (omp_add_variable, omp_notice_variable, gimplify_scan_omp_clauses): Likewise. From-SVN: r174899
2011-05-27move TS_STATEMENT_LIST to be a substructure of TS_TYPEDNathan Froyd1-1/+5
move TS_STATEMENT_LIST to be a substructure of TS_TYPED gcc/ * c-decl.c (c_push_function_context): Copy the current statement list stack. (add_stmt): Check building_stmt_list_p and push_stmt if necessary. (finish_struct): Call building_stmt_list_p instead of checking cur_stmt_list. * c-parser.c (c_parser_postfix_expression): Likewise. * c-typeck.c (c_end_compound_stmt): Likewise. * print-tree.c (print_node) [STATEMENT_LIST]: Don't print TREE_CHAIN. * tree-iterator.c (stmt_list_cache): Change to a VEC. (alloc_stmt_list): Adjust for stmt_list_cache's new type. (free_stmt_list): Likewise. * tree.h (struct tree_statement_list): Include typed_tree instead of tree_common. * tree.c (initialize_tree_contains_struct): Mark TS_STATEMENT_LIST as TS_TYPED instead of TS_COMMON. gcc/c-family/ * c-common.h (struct stmt_tree_s) [x_cur_stmt_list]: Change to a VEC. (stmt_list_stack): Define. (cur_stmt_list): Adjust for new type of x_cur_stmt_list. * c-semantics.c (push_stmt_list, pop_stmt_list): Likewise. gcc/cp/ * cp-tree.h (building_stmt_tree): Delete. * decl.c (save_function_data): Tweak initializer for x_cur_stmt_list. (build_aggr_init_full_exprs): Call building_stmt_list_p instead of building_stmt_tree. (initialize_local_var): Likewise. (finish_function): Likewise. * decl2.c (finish_anon_union): Likewise. * init.c (begin_init_stmts): Likewise. (finish_init_stmts): Likewise. (expand_aggr_init_1): Likewise. * name-lookup.c (do_local_using_decl): Likewise. (do_namespace_alias): Likewise. (do_using_directive): Likewise. (cp_emit_debug_info_for_using): Likewise. * semantics.c (add_stmt): Assert that stmt_list_stack is non-empty. From-SVN: r174343
2011-05-23re PR c/49120 (bogus "value computed is not used" warning (variable-length ↵Jakub Jelinek1-1/+1
array in compound statement)) PR c/49120 * c-decl.c (start_decl): Convert expr to void_type_node. * gcc.dg/pr49120.c: New test. From-SVN: r174081
2011-05-10c-decl.c (c_override_global_bindings_to_false): Remove.Joseph Myers1-5/+1
* c-decl.c (c_override_global_bindings_to_false): Remove. (global_bindings_p): Don't check c_override_global_bindings_to_false. * c-tree.h (c_override_global_bindings_to_false): Remove. * c-typeck.c (composite_type): Don't set c_override_global_bindings_to_false. From-SVN: r173632
2011-05-07langhooks.h (lang_hooks_for_types): Change global_bindings_p's return type ↵Eric Botcazou1-5/+3
to bool and adjust comment. 2011-05-07  Eric Botcazou  <ebotcazou@adacore.com> * langhooks.h (lang_hooks_for_types): Change global_bindings_p's return type to bool and adjust comment. * fold-const.c (fold_range_test): Adjust call to global_bindings_p. (fold_mathfn_compare): Remove calls to global_bindings_p. (fold_inf_compare): Likewise. * stor-layout.c (variable_size): Adjust call to global_bindings_p. * c-tree.h (global_bindings_p): Adjust prototype. * c-decl.c (global_bindings_p): Return bool and simplify. ada/ * gcc-interface/gigi.h (global_bindings_p): Adjust prototype. * gcc-interface/utils.c (global_bindings_p): Return bool and simplify. cp/ * name-lookup.h (global_bindings_p): Adjust prototype. * name-lookup.c (global_bindings_p): Return bool. fortran/ * f95-lang.c (global_bindings_p): Return bool and simplify. go/ * go-lang.c (global_bindings_p): Return bool and simplify. java/ * java-tree.h (global_bindings_p): Adjust prototype. * decl.c (global_bindings_p): Return bool. lto/ * lto-lang.c (global_bindings_p): Return bool. From-SVN: r173535
2011-05-05tree.h (get_pending_sizes): Remove prototype.Eric Botcazou1-6/+0
* tree.h (get_pending_sizes): Remove prototype. (put_pending_size): Likewise. (put_pending_sizes): Likewise. * stor-layout.c (pending_sizes): Delete. (get_pending_sizes): Likewise. (put_pending_size): Likewise. (put_pending_sizes): Likewise. (variable_size): Do not call put_pending_size and tidy up. * function.h (struct function): Remove dont_save_pending_sizes_p. * lto-streamer-in.c (input_function): Do not stream it. * lto-streamer-out.c (output_function): Likewise. * tree-inline.c (initialize_cfun): Do not copy it. * c-decl.c (store_parm_decls): Do not set it. * omp-low.c (create_task_copyfn): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. cp/ * decl.c (start_preparsed_function): Likewise. fortran/ * trans-decl.c (trans_function_start): Likewise. ada/ * gcc-interface/utils.c (begin_subprog_body): Do not call get_pending_sizes. (end_subprog_body): Likewise. From-SVN: r173424
2011-05-05c-decl.c (finish_decl): Don't call get_pending_sizes.Joseph Myers1-55/+21
* c-decl.c (finish_decl): Don't call get_pending_sizes. (grokparm): Add parameter expr. Pass it to grokdeclarator. (push_parm_decl): Add parameter expr. Pass it to grokdeclarator. (c_variable_size): Remove. (grokdeclarator): Use save_expr instead of c_variable_size. Don't call put_pending_sizes. (get_parm_info): Add parameter expr. Use it to set arg_info->pending_sizes. (store_parm_decls): Use arg_info->pending_sizes instead or calling get_pending_sizes. * c-parser.c (c_parser_parms_declarator): Update call to c_parser_parms_list_declarator. (c_parser_parms_list_declarator): Take parameter expr. Update call to push_parm_decl. Update recursive call. Don't call get_pending_sizes. Update calls to get_parm_info. (c_parser_objc_method_definition): Update calls to c_parser_objc_method_decl and objc_start_method_definition. (c_parser_objc_methodproto): Update call to c_parser_objc_method_decl. (c_parser_objc_method_decl): Add parameter expr. Update call to grokparm. (c_parser_objc_try_catch_finally_statement): Update call to grokparm. * c-tree.h (struct c_arg_info.pending_sizes): Change to a tree. (get_parm_info, grokparm, push_parm_decl): Update prototypes. c-family: * c-objc.h (objc_start_method_definition): Update prototype. * stub-objc.c (objc_start_method_definition): Add extra parameter. cp: * parser.c (cp_parser_objc_method_definition_list): Update call to objc_start_method_definition. objc: * objc-act.c (objc_start_method_definition): Add parameter expr. Update call to start_method_def. (objc_generate_cxx_ctor_or_dtor, objc_synthesize_getter, objc_synthesize_setter) Update calls to objc_start_method_definition. (objc_get_parm_info): Add parameter expr. Update call to get_parm_info. (start_method_def): Add parameter expr. Update call to objc_get_parm_info. * objc-gnu-runtime-abi-01.c (build_module_initializer_routine): Update call to objc_get_parm_info. * objc-runtime-shared-support.h (objc_get_parm_info): Add extra parameter. From-SVN: r173422
2011-05-04c-decl.c (check_bitfield_type_and_width): Do not pass NULL to build_int_cst.Richard Guenther1-1/+1
2011-05-04 Richard Guenther <rguenther@suse.de> * c-decl.c (check_bitfield_type_and_width): Do not pass NULL to build_int_cst. * c-typeck.c (really_start_incremental_init): Use bitsize_int for constructor indices. (push_init_level): Likewise. c-family/ * c-common.c (fix_string_type): Use size_int for index type bounds. (start_fname_decls): Do not pass NULL to build_int_cst. (c_init_attributes): Likewise. * c-lex.c (c_lex_with_flags): Likewise. From-SVN: r173378
2011-05-03c-decl.c (grokdeclarator): Instead of looking at TREE_OVERFLOW check if the ↵Richard Guenther1-9/+7
constant fits in the index type. 2011-05-03 Richard Guenther <rguenther@suse.de> * c-decl.c (grokdeclarator): Instead of looking at TREE_OVERFLOW check if the constant fits in the index type. * gcc.dg/large-size-array-5.c: New testcase. From-SVN: r173297
2011-05-02Upgrade the utility of timevars.Lawrence Crowl1-0/+9
Index: gcc/ChangeLog 2011-04-27 Lawrence Crowl <crowl@google.com> * timevar.h (timevar_cond_start): Remove unused POP_TIMEVAR_AND_RETURN. (timevar_cond_start): New for starting a timer only when it is not already running. (timevar_cond_stop): New for stopping a timer when it was not already running. * timevar.c (timevar_stop): Enable start/stop timers to start again. (timevar_cond_start): New as above. (timevar_cond_stop): New as above. * timevar.def: Add start/stop timers for compiler phases, TV_PHASE_SETUP, TV_PHASE_PARSING, TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_DBGINFO (C), TV_PHASE_CHECK_DBGINFO (C++), TV_PHASE_GENERATE, and TV_PHASE_FINALIZE. Change push/pop timer TV_PARSE to TV_PARSE_GLOBAL. Add push/pop timers TV_PARSE_STRUCT, TV_PARSE_ENUM, TV_PARSE_FUNC, TV_PARSE_INLINE, TV_PARSE_INMETH, TV_TEMPLATE_INST. Change push/pop timer TV_NAME_LOOKUP into a start/stop timer. Make unused TV_OVERLOAD into a start/stop timer. Remove unused timers TV_OVERLOAD, TV_TEMPLATE_INSTANTIATION. Mark the strings for TV_NAME_LOOKUP and TV_OVERLOAD with a "|" to indicate that they are start/stop timers. * toplev.c (compile_file): Change TV_PARSE to TV_PARSE_GLOBAL. Add start/stop timers TV_PHASE_PARSING and TV_PHASE_GENERATE. Move initialization to do_compile. (do_compile): Add initialization from above. Add start/stop timers TV_PHASE_SETUP and TV_PHASE_FINALIZE. * c-decl.c (c_write_global_declarations): Add start/stop of TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_DBGINFO. * c-parser.c (c_parser_declaration_or_fndef): Push/pop TV_PARSE_FUNC or TV_PARSE_INLINE, as appropriate. (c_parser_enum_specifier): Push/pop TV_PARSE_ENUM. (c_parser_struct_or_union_specifier): Push/pop TV_PARSE_STRUCT. Index: gcc/cp/ChangeLog 2011-04-27 Lawrence Crowl <crowl@google.com> * decl.c: (push_local_name): Change TV_NAME_LOOKUP to start/stop. (poplevel): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start/stop. (define_label): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start/stop. (xref_tag): Likewise. (lookup_label): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. * pt.c: (instantiate_class_template): Add a wrapper to push/pop new TV_TEMPLATE_INST. (instantiate_template): Add a wrapper to push/pop new TV_TEMPLATE_INST. (lookup_template_class): Refactor timevar calls out to a wrapper function. Change use of TV_NAME_LOOKUP to TV_TEMPLATE_INST. (instantiate_decl): Change TV_PARSE to TV_TEMPLATE_INST. * name-lookup.c: (store_bindings): Change TV_NAME_LOOKUP to start/stop. (poplevel_class): Change TV_NAME_LOOKUP to start_cond/stop_cond. (push_namespace): Likewise. (pop_nested_namespace): Likewise. (pushdecl_namespace_level): Likewise. (store_class_bindings): Likewise. (push_to_top_level): Likewise. (identifier_type_value): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start/stop. (find_binding): Likewise. (push_using_decl): Likewise. (lookup_arg_dependent): Likewise. (push_using_directive): Likewise. (qualified_lookup_using_namespace): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start/stop. (lookup_type_current_level): Likewise. Refactor inner return to break. (pushdecl_class_level): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start_cond/stop_cond. (pushdecl_top_level_1): Likewise. (lookup_using_namespace): Likewise. (pushdecl_with_scope): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. (push_overloaded_decl): Likewise. (push_class_level_binding): Likewise. (namespace_binding): Likewise. (set_namespace_binding): Likewise. (supplement_binding): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_name_real): Likewise. (lookup_type_scope): Likewise. (namespace_ancestor): Likewise. (lookup_name_innermost_nonclass_level): Likewise. (pushtag): Likewise. (pop_from_top_level): Likewise. (pushdecl_maybe_friend): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. Wrap long lines. (add_using_namespace): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. Bypass wrapper on call to self. * decl2.c: (cp_write_global_declarations): Add start/stop of new TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_CHECK_DBGINFO. Remove push/pop calls to TV_VARCONST. * parser.c: Add include of "timevar.h". (cp_parser_explicit_instantiation): Add push/pop calls to TV_TEMPLATE_INST. (cp_parser_enum_specifier): Add push/pop calls to new TV_PARSE_ENUM. (cp_parser_class_specifier): Add wrapper to add push/pop calls to TV_PARSE_STRUCT. (cp_parser_function_definition_from_specifiers_and_declarator): Add push/pop calls to new TV_PARSE_FUNC or TV_PARSE_INLINE. (cp_parser_late_parsing_for_member): Add push/pop calls to new TV_PARSE_INMETH. * call.c: Add include of "timevar.h". (convert_class_to_reference): Wrap and add push/pop calls to TV_OVERLOAD. (build_op_call): Likewise. (build_conditional_expr): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. (build_user_type_conversion): Reorganize to single return and add push/pop calls to TV_OVERLOAD. (perform_overload_resolution): Likewise. * Make-lang.in: Add dependence of call.o and parser.o on $(TIMEVAR_H). From-SVN: r173277
2011-05-02re PR c/35445 (ICE with conflicting declarations)Simon Martin1-1/+1
gcc/ 2011-05-02 Simon Martin <simartin@users.sourceforge.net> PR c/35445 * c-decl.c (finish_decl): Only create a composite if the types are compatible. gcc/testsuite/ 2011-05-02 Simon Martin <simartin@users.sourceforge.net> PR c/35445 * gcc.dg/pr35445.c: New test. From-SVN: r173269
2011-04-15In gcc/c-family/: 2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com>Nicola Pero1-7/+11
In gcc/c-family/: 2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com> * c-objc.h (objc_get_interface_ivars): Removed. (objc_detect_field_duplicates): New. * stub-objc.c: Likewise. In gcc/: 2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com> * c-decl.c (detect_field_duplicates): Call objc_detect_field_duplicates instead of objc_get_interface_ivars. In gcc/objc/: 2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com> * objc-act.c (objc_get_interface_ivars): Removed. (objc_detect_field_duplicates): New. (hash_instance_variable): New. (eq_instance_variable): New. In gcc/objcp/: 2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com> * objcp-decl.c (objcp_finish_struct): Use objc_detect_field_duplicates instead of having a local implementation. In gcc/testsuite/: 2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/naming-4.m: Updated. * objc.dg/naming-5.m: Updated. * objc.dg/naming-6.m: New. * objc.dg/naming-7.m: New. * obj-c++.dg/naming-1.mm: Updated. * obj-c++.dg/naming-2.mm: Updated. * obj-c++.dg/naming-3.mm: New. * obj-c++.dg/naming-4.mm: New. From-SVN: r172511
2011-04-13ada-tree.h (union lang_tree_node): Check for TS_COMMON before calling ↵Nathan Froyd1-1/+1
TREE_CHAIN. gcc/ada/ * gcc-interface/ada-tree.h (union lang_tree_node): Check for TS_COMMON before calling TREE_CHAIN. * gcc-interface/misc.c (gnat_init_ts): New function. (LANG_HOOKS_INIT_TS): Define. gcc/ * c-decl.c (union lang_tree_node): Check for TS_COMMON before calling TREE_CHAIN. * print-tree.c (print_node): Likewise. * tree-inline.c (copy_tree_r): Likewise. * c-lang.c (LANG_HOOKS_INIT_TS): Define. * lto-streamer-in.c (lto_input_tree_pointers): Check for TS_TYPED instead of TS_COMMON. * lto-streamer-out.c (lto_output_tree_pointers): Likewise. * tree.c (initialize_tree_contains_struct): Handle TS_TYPED. (copy_node_stat): Zero TREE_CHAIN only if necessary. (MARK_TS_BASE, MARK_TS_TYPED, MARK_TS_COMMON): Move these... (MARK_TS_DECL_COMMON, MARK_TS_DECL_COMMON, MARK_TS_DECL_WRTL): ...and these... (MARK_TS_DECL_WITH_VIS, MARK_TS_DECL_NON_COMMON): ...and these... * tree.h: ...here. (TREE_CHAIN): Check for a TS_COMMON structure. (TREE_TYPE): Check for a TS_TYPED structure. gcc/c-family/ * c-common.h (c_common_init_ts): Declare. * c-common.c (c_common_init_ts): Define. gcc/cp/ * cp-lang.c (cp_init_ts): Call cp_common_init_ts. Move tree_contains_struct initialization to... * cp-objcp-common.c (cp_common_init_ts): ...here. Use MARK_* macros. * cp-objcp-common.h (cp_common_init_ts): Declare. * cp-tree.h (union lang_tree_node): Check for TS_COMMON before calling TREE_CHAIN. gcc/fortran/ * f95-lang.c (union lang_tree_node): Check for TS_COMMON before calling TREE_CHAIN. gcc/go/ * go-lang.c (union lang_tree_node): Check for TS_COMMON before calling TREE_CHAIN. gcc/java/ * java-tree.h (union lang_tree_node): Check for TS_COMMON before calling TREE_CHAIN. gcc/lto/ * lto-tree.h (union lang_tree_node): Check for TS_COMMON before calling TREE_CHAIN. * lto.c (lto_fixup_common): Likewise. gcc/objc/ * objc-lang.c (objc_init_ts): Move code for this function... * objc-act.c (objc_common_init_ts): ...here. Define. * objc-act.h (objc_common_init_ts): Declare. gcc/objcp/ * objcp-lang.c (objcxx_init_ts): Call objc_common_init_ts and cp_common_init_ts. From-SVN: r172359
2011-04-12cgraph.h (cgraph_node): Remove function declaration.Martin Jambor1-1/+1
2011-04-12 Martin Jambor <mjambor@suse.cz> * cgraph.h (cgraph_node): Remove function declaration. (cgraph_create_node): Declare. (cgraph_get_create_node): Likewise. * cgraph.c (cgraph_create_node): Renamed to cgraph_create_node_1. Updated all callers. (cgraph_node): Renamed to cgraph_create_node, assert that a node for the decl does not already exist. Call cgraph_get_create_node instead of cgraph_node. (cgraph_get_create_node): New function. (cgraph_same_body_alias): Update comment. (cgraph_set_call_stmt): Call cgraph_get_node instead of cgraph_node, assert it does not return NULL. (cgraph_update_edges_for_call_stmt): Likewise. (cgraph_clone_edge): Likewise. (cgraph_create_virtual_clone): Likewise. (cgraph_update_edges_for_call_stmt_node): Call cgraph_get_create_node instead of cgraph_node. (cgraph_add_new_function): Call cgraph_create_node or cgraph_get_create_node instead of cgraph_node. * cgraphbuild.c (record_reference): Call cgraph_get_create_node instead of cgraph_node. (record_eh_tables): Likewise. (mark_address): Likewise. (mark_load): Likewise. (build_cgraph_edges): Call cgraph_get_create_node instead of cgraph_node. (rebuild_cgraph_edges): Likewise. * cgraphunit.c (cgraph_finalize_function): Call cgraph_get_create_node instead of cgraph_node. (cgraph_copy_node_for_versioning): Call cgraph_create_node instead of cgraph_node. * lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Call cgraph_create_node instead of cgraph_node. * c-decl.c (finish_function): Call cgraph_get_create_node instead of cgraph_node. * lto-cgraph.c (input_node): Likewise. * lto-streamer-in.c (input_function): Likewise. * varasm.c (mark_decl_referenced): Likewise. (assemble_alias): Likewise. gcc/c-family/ * c-gimplify.c (c_genericize): Call cgraph_get_create_node instead of cgraph_node. gcc/cp/ * cp/class.c (cp_fold_obj_type_ref): Call cgraph_get_create_node instead of cgraph_node. * cp/decl2.c (cxx_callgraph_analyze_expr): Likewise. (cp_write_global_declarations): Likewise. * cp/optimize.c (maybe_clone_body): Likewise. * cp/semantics.c (maybe_add_lambda_conv_op): Likewise. * cp/mangle.c (mangle_decl): Likewise. * cp/method.c (make_alias_for_thunk): Likewise. (use_thunk): Likewise. gcc/ada/ * gcc-interface/utils.c (end_subprog_body): Call cgraph_get_create_node instead of cgraph_node. gcc/fortran/ * trans-decl.c (gfc_generate_function_code): Call cgraph_get_create_node instead of cgraph_node. gcc/objc/ * objc-act.c (mark_referenced_methods): Call cgraph_get_create_node instead of cgraph_node. From-SVN: r172307
2011-04-01c-decl.c (grokdeclarator): Fix formatting.Gary Funck1-2/+2
2011-04-01 Gary Funck <gary@intrepid.com> * c-decl.c (grokdeclarator): Fix formatting. From-SVN: r171831
2011-03-21re PR c/47939 (Missing DW_TAG_typedef for qualified types)Richard Guenther1-1/+9
2011-03-21 Richard Guenther <rguenther@suse.de> PR c/47939 * c-decl.c (grokdeclarator): Drop to the main variant only for array types. Drop flag_gen_aux_info check. * gcc.dg/debug/dwarf2/pr47939-1.c: New testcase. * gcc.dg/debug/dwarf2/pr47939-2.c: Likewise. * gcc.dg/debug/dwarf2/pr47939-3.c: Likewise. * gcc.dg/debug/dwarf2/pr47939-4.c: Likewise. From-SVN: r171245