aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
AgeCommit message (Collapse)AuthorFilesLines
2005-06-25Update FSF address.Kelley Cook1-2/+2
From-SVN: r101312
2005-06-15Make-lang.in: Reformat some long lines.Nathan Sidwell1-6/+0
* Make-lang.in: Reformat some long lines. (gt-cp-rtti.h): New target. (cp/rtti.o): Add dependency. * config-lang.in (gtfiles): Add cp/rtti.c. * cp-tree.h (CPTI_TI_DESC_TYPE, CPTI_BLTN_DESC_TYPE, CPTI_PTR_DESC_TYPE, CPTI_ARY_DESC_TYPE, CPTI_FUNC_DESC_TYPE, CPTI_ENUM_DESC_TYPE, CPTI_CLASS_DESC_TYPE, CPTI_SI_CLASS_DESC_TYPE, CPTI_VMI_CLASS_DESC_TYPE, CPTI_PTM_DESC_TYPE, CPTI_BASE_DESC_TYPE): Remove. (ti_desc_type_node, bltn_desc_type_node, ptr_desc_type_node, ary_desc_type_node, func_desc_type_node, enum_desc_type_node, class_desc_type_node, si_class_desc_type_node, vmi_class_desc_type_node, ptm_desc_type_node, base_desc_type_node): Remove. * decl.c: Adjust documentation of global trees. * rtti.c (TINFO_PSEUDO_TYPE, TINFO_VTABLE_DECL, TINFO_REAL_NAME): Remove. (struct tinfo_s): New. (enum tinfo_kind): New. (tinfo_descs): New. (get_tinfo_decl): Adjust use of tinfo descriptor. (tinfo_base_init, generic_initializer, ptr_initializer, ptm_initializer, class_initializer): Likewise. (get_pseudo_ti_init): Take descriptor index. Adjust. (create_pseudo_type_info): Likewise. (get_pseudo_ti_desc): Return descriptor index. Adjust. (create_tinfo_types): Adjust use of create_pseudo_type_info. (emit_tinfo_decl): Adjust use of tinfo descriptor. From-SVN: r100971
2005-06-15Canonicalize whitespace.Mike Stump1-295/+295
From-SVN: r100965
2005-06-14Remove extra white spacing at end of lines.Mike Stump1-46/+46
From-SVN: r100952
2005-06-14* decl.c (grokdeclarator): Only check TREE_OVERFLOW on INTEGER_CST.Roger Sayle1-0/+1
From-SVN: r100936
2005-06-13re PR c++/20789 (ICE with incomplete type in template)Nathan Sidwell1-0/+10
cp: PR c++/20789 * decl.c (cp_finish_decl): Clear runtime runtime initialization if in-class decl's initializer is bad. PR c++/21929 * parser.c (struct cp_parser): Document that scope could be error_mark. (cp_parser_diagnose_invalid_type_name): Cope with error_mark for scope. (cp_parser_nested_name_specifier): Return NULL_TREE on error. (cp_parser_postfix_expression): Deal with null or error_mark scope. (cp_parser_elaborated_type_specifier): Adjust cp_parser_nested_name_specifier call. * parser (cp_parser_skip_to_end_of_block_or_statement): Cleanup. testsuite: PR c++/21929 * g++.dg/parse/crash26.C: New. PR c++/20789 * g++.dg/init/member1.C: New. From-SVN: r100880
2005-06-03re PR c++/21336 (Internal compiler error when using custom new operators)Mark Mitchell1-40/+46
PR c++/21336 * cp-tree.h (grok_op_properties): Remove friendp parameter. * decl.c (grokfndecl): Adjust call. (grok_op_properties): Determine the class of which the function is a member by looking at its DECL_CONTEXT, not current_class_type. * pt.c (tsubst_decl): Adjust call to grok_op_properties. PR c++/21336 * g++.dg/template/new2.C: New test. From-SVN: r100541
2005-06-02re PR c++/21280 (#pragma interface, templates, and "inline function used but ↵Nathan Sidwell1-1/+2
never defined") cp: PR c++/21280 * Make-lang.in (method.o): Add diagnostic.h * decl.c (start_preparsed_function): Use decl's location for file info. * decl2.c (cp_finish_file): Set input_location before synthesizing a function. (mark_used): When deferring a synthesized function, save current location. Do not set function's location when actually synthesizing it. * method.c: #include diagnostic.h. (synthesize_method): Set the functions source location. Show needed location if errors are emitted. testsuite: PR c++/21280 * g++.dg/opt/interface2.h: New. * g++.dg/opt/interface2.C: New. * g++.dg/init/ctor4.C: Adjust error lines. * g++.old-deja/g++.bob/inherit2.C: Likewise. * g++.old-deja/g++.bugs/900205_04.C: Likewise. * g++.old-deja/g++.jason/opeq3.C: Likewise. * g++.old-deja/g++.pt/assign1.C: Likewise. * g++.old-deja/g++.pt/crash20.C: Likewise. From-SVN: r100500
2005-06-02decl.c (start_decl): Simplify specialization handling.Nathan Sidwell1-11/+11
* decl.c (start_decl): Simplify specialization handling. Remove unneeded CLASSTYPE_TEMPLATE_INSTANTIATION check. * mangle.c (discriminator_for_local_entity): Use VEC_index. From-SVN: r100488
2005-06-02re PR c++/20350 (extern template and struct initializer and specification ↵Nathan Sidwell1-7/+8
for a static variable) cp: PR c++/20350 * decl.c (duplicate_decls): Copy all of DECL_USE_TEMPLATE. testsuite: PR c++/20350 * g++.dg/template/spec24.C: New. From-SVN: r100486
2005-05-27cp-tree.def (UNARY_PLUS_EXPR): New C++ unary tree code.Roger Sayle1-2/+2
* cp-tree.def (UNARY_PLUS_EXPR): New C++ unary tree code. * parser.c (cp_parser_unary_expression): Use UNARY_PLUS_EXPR instead of CONVERT_EXPR. (cp_parser_unary_expression): Likewise. * typeck.c (build_unary_op): Likewise. * call.c (add_builtin_candidate, build_new_op): Likewise. * error.c (dump_expr): Likewise. * pt.c (tsubst_copy, tsubst_copy_and_build): Likewise. * decl.c (ambi_op_p, grok_op_properties): Likewise. * dump.c (dump_op): Likewise. * lex.c (init_operators): Likewise. * operators.def ("+"): Likewise. * cp-gimplify.c (cp_gimplify_expr): Handle UNARY_PLUS_EXPR like a conversion, if the result and argument types differ. * tree.c (fold_if_not_in_template): Fold UNARY_PLUS_EXPR much like a NOP_EXPR when !processing_template_decl. * cxx-pretty-print.c (pp_cxx_cast_expression): Prototype. (pp_cxx_unary_expression): Handle new UNARY_PLUS_EXPR tree code. Co-Authored-By: Giovanni Bajo <giovannibajo@gcc.gnu.org> From-SVN: r100285
2005-05-25common.opt (-Wattributes): New.DJ Delorie1-9/+11
* common.opt (-Wattributes): New. Default true. * doc/invoke.texi (-Wno-attributes): Document. * attribs.c (decl_attributes): Move warning control from if() to warning(OPT_*). * c-common.c (handle_packed_attribute): Likewise. (handle_nocommon_attribute): Likewise. (handle_common_attribute): Likewise. (handle_noreturn_attribute): Likewise. (handle_noinline_attribute): Likewise. (handle_always_inline_attribute): Likewise. (handle_used_attribute): Likewise. (handle_unused_attribute): Likewise. (handle_const_attribute): Likewise. (handle_transparent_union_attribute): Likewise. (handle_constructor_attribute): Likewise. (handle_destructor_attribute): Likewise. (handle_mode_attribute): Likewise. (handle_alias_attribute): Likewise. (handle_visibility_attribute): Likewise. (handle_tls_model_attribute): Likewise. (handle_malloc_attribute): Likewise. (handle_returns_twice_attribute): Likewise. (handle_pure_attribute): Likewise. (handle_deprecated_attribute): Likewise. (handle_vector_size_attribute): Likewise. (handle_nothrow_attribute): Likewise. (handle_cleanup_attribute): Likewise. (handle_warn_unused_result_attribute): Likewise. (handle_sentinel_attribute): Likewise. * c-decl.c (diagnose_mismatched_decls): Likewise. (start_decl): Likewise. (grokdeclarator): Likewise. (start_function): Likewise. * c-format.c (check_function_format): Likewise. * stor-layout.c (place_field): Likewise. (finalize_record_size): Likewise. * tree.c (handle_dll_attribute)): Likewise. * varasm.c (default_assemble_visibility): Likewise. * config/darwin.c (darwin_handle_weak_import_attribute): Likewise. (darwin_assemble_visibility): Likewise. * config/arc/arc.c (arc_handle_interrupt_attribute): Likewise. * config/arm/arm.c (arm_handle_fndecl_attribute): Likewise. (arm_handle_isr_attribute): Likewise. * config/avr/avr.c (avr_handle_progmem_attribute): Likewise. (avr_handle_fndecl_attribute): Likewise. * config/bfin/bfin.c (handle_int_attribute): Likewise. * config/c4x/c4x.c (c4x_handle_fntype_attribute): Likewise. * config/h8300/h8300.c (h8300_handle_fndecl_attribute): Likewise. (h8300_handle_eightbit_data_attribute): Likewise. (h8300_handle_tiny_data_attribute): Likewise. * config/i386/i386.c (ix86_handle_cdecl_attribute): Likewise. (ix86_handle_regparm_attribute): Likewise. (ix86_handle_struct_attribute): Likewise. * config/i386/winnt.c (ix86_handle_shared_attribute): Likewise. (i386_pe_encode_section_info): Likewise. * config/ia64/ia64.c (ia64_handle_model_attribute): Likewise. * config/ip2k/ip2k.c (ip2k_handle_progmem_attribute): Likewise. (ip2k_handle_fndecl_attribute): Likewise. * config/m32r/m32r.c (m32r_handle_model_attribute): Likewise. * config/m68hc11/m68hc11 (m68hc11_handle_page0_attribute): Likewise. (m68hc11_handle_fntype_attribute): Likewise. (m68hc11_encode_section_info): Likewise. * config/m68k/m68k.c (m68k_handle_fndecl_attribute): Likewise. * config/mcore/mcore.c (mcore_handle_naked_attribute): Likewise. * config/ns32k/ns32k.c (ns32k_handle_fntype_attribute): Likewise. * config/rs6000/rs6000.c (rs6000_handle_longcall_attribute): Likewise. * config/sh/sh.c (sh_handle_interrupt_handler_attribute): Likewise. (sh_handle_sp_switch_attribute): Likewise. (sh_handle_trap_exit_attribute): Likewise. * config/sh/symbian.c (sh_symbian_dllimport_p): Likewise. (sh_symbian_handle_dll_attribute): Likewise. * config/stormy16/stormy16.c (xstormy16_handle_interrupt_attribute): Likewise. (xstormy16_handle_below100_attribute): Likewise. * config/v850/v850.c (v850_handle_interrupt_attribute): Likewise. [testsuite] * gcc.dg/Wattributes-1.c: New. * gcc.dg/Wattributes-2.c: New. * gcc.dg/Wattributes-3.c: New. [cp] * decl.c (duplicate_decls): Move warning control from if() to warning(OPT_*). * name-lookup.c (parse_using_directive): Likewise. * parser.c (cp_parser_elaborated_type_specifier): Likewise. (cp_parser_init_declarator): Likewise. * tree.c (handle_com_interface_attribute): Likewise. [java] * class.c (set_constant_value): Move warning control from if() to warning(OPT_*). From-SVN: r100136
2005-05-24class.c (layout_class_type): Do not issue C++ ABI warnings for ObjC structs.Ziemowit Laski1-16/+1
* class.c (layout_class_type): Do not issue C++ ABI warnings for ObjC structs. * decl.c (objc_mark_locals_volatile): Streamline by calling objc_volatilize_decl(). * parser.c (cp_parser_objc_message_expression): Allow simple type specifiers (instead of merely type names) as message receivers. * pt.c (template_args_equal): Do not call objc_comptypes(). * typeck.c (composite_pointer_type): If both pointers are ObjC-esque, arbitrarily choose the first; do not call objc_comptypes(). (comptypes): Do not call objc_comptypes(). (convert_for_assignment): Call objc_compare_types(). (comp_ptr_ttypes_real): Call objc_type_quals_match() before concluding that types do not match. From-SVN: r100125
2005-05-19re PR c++/21495 (internal compiler error: Segmentation fault)Jakub Jelinek1-24/+1
PR c++/21495 * decl.c (grokdeclarator): Fix "storage class specified for" error reporting. * g++.dg/parse/extern1.C: New test. * g++.dg/tls/diag-2.C: Adjust expected error message wording. From-SVN: r99960
2005-05-17Yet more Objective-C++...Ziemowit Laski1-5/+18
* cp-objcp-common.h (cxx_get_alias_set): Move from here... (cxx_warn_unused_global_decl): Likewise. (cp_expr_size): Likewise. (cp_tree_size): Likewise. (cp_var_mod_type_p): Likewise. (cxx_initialize_diagnostics): Likewise. (cxx_types_compatible_p): Likewise. * cp-tree.h: to here. (do_poplevel): Add. * lex.c (D_OBJC): Add. (init_reswords): Add. * Make-lang.in (cp/pt.o): Add cp/cp-objcp-common.h. * parser.c: Add c-common.h include. * pt.c: Add c-common.h and cp-objcp-common.h includes. (template_args_equal): Use objc_comptypes as well. (tsubst_copy_and_build): Use objcp_tsubst_copy_and_build as well. * semantics.c (do_poplevel): Remove static. * decl.c (objc_mark_locals_volatile): Don't change decls that are already ok. * decl2.c (generate_ctor_or_dtor_function): Add code to initialize Objective C++ early enough. * lex.c (struct resword reswords): Add Objective-C++ support. * parser.c (cp_lexer_get_preprocessor_token): Add Objective-C++. (cp_parser_objc_message_receiver): Add. (cp_parser_objc_message_args): Likewise. (cp_parser_objc_message_expression): Likewise. (cp_parser_objc_encode_expression): Likewise. (cp_parser_objc_defs_expression): Likewise. (cp_parser_objc_protocol_expression): Likewise. (cp_parser_objc_selector_expression): Likewise. (cp_parser_objc_expression): Likewise. (cp_parser_objc_visibility_spec): Likewise. (cp_parser_objc_method_type): Likewise. (cp_parser_objc_protocol_qualifiers): Likewise. (cp_parser_objc_typename): Likewise. (cp_parser_objc_selector_p): Likewise. (cp_parser_objc_selector): Likewise. (cp_parser_objc_method_keyword_params): Likewise. (cp_parser_objc_method_tail_params_opt): Likewise. (cp_parser_objc_interstitial_code): Likewise. (cp_parser_objc_method_signature): Likewise. (cp_parser_objc_method_prototype_list): Likewise. (cp_parser_objc_method_definition_list): Likewise. (cp_parser_objc_class_ivars): Likewise. (cp_parser_objc_identifier_list): Likewise. (cp_parser_objc_alias_declaration): Likewise. (cp_parser_objc_class_declaration): Likewise. (cp_parser_objc_protocol_declaration): Likewise. (cp_parser_objc_protocol_refs_opt): Likewise. (cp_parser_objc_superclass_or_category): Likewise. (cp_parser_objc_class_interface): Likewise. (cp_parser_objc_class_implementation): Likewise. (cp_parser_objc_end_implementation): Likewise. (cp_parser_objc_declaration): Likewise. (cp_parser_objc_try_catch_finally_statement): Likewise. (cp_parser_objc_synchronized_statement): Likewise. (cp_parser_objc_throw_statement): Likewise. (cp_parser_objc_statement): Likewise. (cp_parser_primary_expression): Add Objective-C++. (cp_parser_statement): Likewise. (cp_parser_declaration): Likewise. (cp_parser_simple_type_specifier): Likewise. (cp_parser_type_name): Likewise. (cp_parser_parameter_declaration_list): Likewise. (cp_parser_member_declaration) Likewise. * tree.c: Include debug.h. * typeck.c (composite_pointer_type): Add Objective-C++ support. (finish_class_member_access_expr): Likewise. (build_function_call): Allow objc to rewrite FUNCTION_DECLs. (build_modify_expr): Allow objc to generate write barriers. * Make-lang.in (cp/tree.o): Add debug.h. * tree.c (lvalue_p_1, case CONST_DECL): Add. From-SVN: r99855
2005-05-17re PR c++/21454 (const array doesn't live in the rodata section in C++)Jakub Jelinek1-0/+2
PR c++/21454 * decl.c (maybe_deduce_size_from_array_init): Call cp_apply_type_quals_to_decl after completing array type. * g++.dg/opt/const4.C: New test. From-SVN: r99817
2005-05-16decl.c (build_library_fn_1): Move setting TREE_NOTHROW ...Richard Henderson1-2/+3
* decl.c (build_library_fn_1): Move setting TREE_NOTHROW ... (build_library_fn): ... here. From-SVN: r99800
2005-05-07decl.c (wrapup_globals_for_namespace): Use VEC instead of VARRAY.Kazu Hirata1-3/+3
* decl.c (wrapup_globals_for_namespace): Use VEC instead of VARRAY. * name-lookup.c (add_decl_to_level, begin_scope): Likewise. * name-lookup.h (cp_binding_level): Change the type of static_decls to VEC(tree,gc)*. From-SVN: r99346
2005-05-04cp-tree.h (language_function): Change the type of x_local_names to VEC.Kazu Hirata1-6/+4
* cp-tree.h (language_function): Change the type of x_local_names to VEC. * decl.c (push_local_name): Adjust uses of local_names. From-SVN: r99209
2005-04-25target-def.h (TARGET_CXX_USE_AEABI_ATEXIT): Define.Paul Brook1-5/+26
* target-def.h (TARGET_CXX_USE_AEABI_ATEXIT): Define. * target.h (struct gcc_target): Add cxx.use_aeabi_atexit. * config/arm/arm.c (arm_cxx_atexit_name): New function. (TARGET_CXX_USE_AEABI_ATEXIT): New macro. * cp/decl.c (get_atexit_node): Reorder arguments for __aeabi_atexit. (register_dtor_fn): Likewise. * doc/tm.texi: Document TARGET_CXX_USE_AEABI_ATEXIT. From-SVN: r98732
2005-04-23diagnostic.c (warning): Accept parameter to classify warning option.DJ Delorie1-35/+35
* diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-22decl.c (make_rtl_for_nonlocal_decl): Don't try get_fileinfo if ↵Per Bothner1-1/+4
input_filename is NULL... * decl.c (make_rtl_for_nonlocal_decl): Don't try get_fileinfo if input_filename is NULL, as it is for (say) __PRETTY_FUNCTION__. From-SVN: r98582
2005-04-21vec.h: Update API to separate allocation mechanism from type.Nathan Sidwell1-3/+3
* vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-18decl.c (expand_static_init): Call build2 and build3 instead of build.Kazu Hirata1-4/+4
* decl.c (expand_static_init): Call build2 and build3 instead of build. From-SVN: r98318
2005-04-09c-common.def: Move FOR_STMT...Ian Lance Taylor1-1/+8
./ * c-common.def: Move FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT to cp/cp-tree.def. * c-common.h (WHILE_COND, WHILE_BODY): Move to cp/cp-tree.h. (DO_COND, DO_BODY): Likewise. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Likewise. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Likewise. (c_common_stmt_codes): Remove FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, and SWITCH_STMT. (build_continue_stmt, build_break_stmt): Don't declare. (c_do_switch_warnings): Update declaration. * c-gimplify.c (enum bc_t): Remove. (struct c_gimplify_ctx, ctxp): Remove. (push_context, pop_context): Remove static functions. (c_genericize): Don't call push_context or pop_context. (begin_bc_block, finish_bc_block): Remove static functions. (build_bc_goto): Likewise. (gimplify_c_loop): Likewise. (gimplify_for_stmt, gimplify_while_stmt): Likewise. (gimplify_do_stmt, gimplify_switch_stmt): Likewise. (c_gimplify_expr): Remove handling of FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. * c-common.c (c_do_switch_warnings): Rename from c_do_switch_warnings_1. (c_do_switch_warnings) [old version]: Remove. (c_do_switch_expr_warnings): Remove. * c-typeck.c (c_finish_case): Call new c_do_switch_warnings function instead of c_do_switch_expr_warnings. * c-dump.c (c_dump_tree): Remove handling of BREAK_STMT, CONTINUE_STMT, DO_STMT, FOR_STMT, SWITCH_STMT, and WHILE_STMT. * c-pretty-print.c (pp_c_statement): Likewise. * c-semantics.c (build_break_stmt, build_continue_stmt): Remove. cp/ * cp-tree.def: Define FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. * cp-tree.h (cp_stmt_codes): Add FOR_STMT, WHILE_STMT, DO_STMT, BREAK_STMT, CONTINUE_STMT, SWITCH_STMT. (WHILE_COND, WHILE_BODY): Define. (DO_COND, DO_BODY): Define. (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY): Define. (SWITCH_STMT_COND, SWITCH_STMT_BODY, SWITCH_STMT_TYPE): Define. * cp-gimplify.c (enum bc_t): Define. (struct cp_gimplify_ctx, ctxp): Define. (push_context, pop_context): New static functions. (begin_bc_block, finish_bc_block): New static functions. (build_bc_goto): New static function. (gimplify_cp_loop, gimplify_for_stmt): New static functions. (gimplify_while_stmt, gimplify_do_stmt): Likewise. (gimplify_switch_stmt): Likewise. (cp_gimplify_expr): Handle FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT, CONTINUE_STMT, BREAK_STMT. (cp_genericize): Call push_context and pop_context. * semantics.c (finish_break_stmt): Just call build_stmt (BREAK_STMT) rather than build_break_stmt. (finish_continue_stmt): Corresponding change. * decl.c (pop_switch): Update call to c_do_switch_warnings for new parameters. * cxx-pretty-print.c (pp_cxx_statement): Handle SWITCH_STMT, WHILE_STMT, DO_STMT, FOR_STMT, BREAK_STMT, CONTINUE_STMT. * dump.c (cp_dump_tree): Likewise. From-SVN: r97885
2005-04-06c-decl.c (finish_decl): Apply pending #pragma weak regardless of scope.Joseph Myers1-2/+1
* c-decl.c (finish_decl): Apply pending #pragma weak regardless of scope. cp: * decl.c (start_decl): Apply pending #pragma weak regardless of scope. testsuite: * gcc.dg/weak/weak-12.c, g++.dg/ext/weak2.C: New tests. From-SVN: r97733
2005-04-05re PR target/20673 (C PCH testsuite assembly comparison failure)Mark Mitchell1-5/+6
PR c++/20673 * decl.c (grokdeclarator): Correct attribute handling. PR c++/20673 * g++.dg/ext/attrib21.C: New test. From-SVN: r97640
2005-03-29re PR c/20519 (completed type not selected properly with typeof)Richard Henderson1-77/+17
PR c/20519 * c-decl.c (c_finish_incomplete_decl): Update complete_array_type call. (build_compound_literal): Likewise. Propagate decl type into the initializer. (finish_decl): Likewise. Use new return value from complete_array_type for zero sized arrays. (complete_array_type): Move ... * c-common.c (complete_array_type): ... here. Change first argument to pointer-to-type-node. Consistently use sizetype for the index except for zero sized arrays. Detect zero sized arrays for pedantic mode diagnostics. Create a new type node instead of modifying the old node in place. * c-tree.h (complete_array_type): Move decl ... * c-common.h (complete_array_type): ... here. cp/ * decl.c (cp_complete_array_type): Rename from complete_array_type. Use the new complete_array_type in c-common.c. Update all callers. * cp-tree.h (cp_complete_array_type): Update to match. From-SVN: r97223
2005-03-22re PR c++/19980 (ICE on invalid template declaration)Volker Reichelt1-1/+6
PR c++/19980 * decl.c (start_preparsed_function): Robustify. * g++.dg/template/redecl3.C: New test. From-SVN: r96872
2005-03-19re PR c++/20240 (invalid using-redeclaration accepted)Kriang Lerdsuwanakij1-0/+6
PR c++/20240 * decl.c (decls_match): Compare context of VAR_DECL. * g++.dg/lookup/using13.C: New test. From-SVN: r96725
2005-03-17re PR c++/19966 (Misleading message "must take exactly one argument")Paolo Carlini1-14/+13
2005-03-17 Paolo Carlini <pcarlini@suse.de> PR c++/19966 * cp-tree.h (grok_op_properties): Change return type to void. * decl.c (grok_op_properties): Return early - don't check the arity - in case of a static member or an operator that cannot be non-member; tidy a bit. From-SVN: r96609
2005-03-14Friend class name lookup 5/n PR c++/1016Kriang Lerdsuwanakij1-5/+29
Friend class name lookup 5/n PR c++/1016 * cp-tree.h (pushtag): Adjust declaration. * decl.c (lookup_and_check_tag): Call lookup_type_scope if lookup_name fails. (xref_tag): Adjust call to pushtag. Make hidden class visible. (start_enum): Adjust call to pushtag. * name-lookup.c (ambiguous_decl): Ignore hidden names. (qualify_lookup): Change return type to bool. (hidden_name_p): New function. (lookup_namespace_name, unqualified_namespace_lookup, lookup_name_real): Use it. (lookup_type_scope): Update comments. (maybe_process_template_type_declaration): Change parameter name from globalize to is_friend. (pushtag): Change globalize parameter of type int to tag_scope. Hide name if introduced by friend declaration. * name-lookup.h (hidden_name_p): Add declaration. * parser.c (cp_parser_lookup_name): Don't deal with hidden name here. * pt.c (push_template_decl_real): Make hidden class template visible. (lookup_template_class, instantiate_class_template): Adjust call to pushtag. * semantics.c (begin_class_definition): Likewise. * rtti.c (init_rtti_processing, build_dynamic_cast_1, tinfo_base_init, emit_support_tinfos): Use ts_current instead of ts_global. * g++.dg/lookup/hidden-class1.C: New test. * g++.dg/lookup/hidden-class2.C: Likewise. * g++.dg/lookup/hidden-class3.C: Likewise. * g++.dg/lookup/hidden-class4.C: Likewise. * g++.dg/lookup/hidden-class5.C: Likewise. * g++.dg/lookup/hidden-class6.C: Likewise. * g++.dg/lookup/hidden-class7.C: Likewise. * g++.dg/lookup/hidden-class8.C: Likewise. * g++.dg/lookup/hidden-class9.C: Likewise. * g++.dg/lookup/hidden-temp-class1.C: Likewise. * g++.dg/lookup/hidden-temp-class2.C: Likewise. * g++.dg/lookup/hidden-temp-class3.C: Likewise. * g++.dg/lookup/hidden-temp-class4.C: Likewise. * g++.dg/lookup/hidden-temp-class5.C: Likewise. * g++.dg/lookup/hidden-temp-class6.C: Likewise. * g++.dg/lookup/hidden-temp-class7.C: Likewise. * g++.dg/lookup/hidden-temp-class8.C: Likewise. * g++.dg/lookup/hidden-temp-class9.C: Likewise. * g++.dg/lookup/hidden-temp-class10.C: Likewise. * g++.dg/lookup/hidden-temp-class11.C: Likewise. From-SVN: r96430
2005-03-10PR c++/18384, c++/18327Jakub Jelinek1-19/+13
PR c++/18384, c++/18327 * decl.c (reshape_init_array): Use UHWI type for max_index_cst and index. Convert max_index to size_type_node if it isn't host_integerp (, 1). * g++.dg/init/array19.C: New test. From-SVN: r96236
2005-03-09re PR c++/16859 (Empty initializer for array of unknown size spuriously ↵Paolo Carlini1-4/+6
accepted) 2005-03-09 Paolo Carlini <pcarlini@suse.de> PR c++/16859 * decl.c (complete_array_type): In pedantic mode, return 3 for an empty initializer list as the initializer for an array of unknown bound (8.5.1/4). (maybe_deduce_size_from_array_init): Fix final test to use the above. From-SVN: r96194
2005-03-09re PR c++/20142 (implicit assignment operator with multi-dimensional array ↵Mark Mitchell1-8/+0
is broken) PR c++/20142 * cp-tree.h (target_type): Remove. * decl.c (layout_var_decl): Remove #if 0'd code. (cp_finish_decl): Remove dead code. * init.c (build_vec_init): When determining whether or not the element type has an asignment operator, look through all array dimensions. * typeck.c (target_type): Remove. PR c++/20142 * g++.dg/init/array18.C: New test. From-SVN: r96170
2005-03-02name-lookup.c (push_overloaded_decl): Don't error if the new decl matches ↵Alexandre Oliva1-1/+2
the old one. gcc/cp/ChangeLog: * name-lookup.c (push_overloaded_decl): Don't error if the new decl matches the old one. * decl.c (redeclaration_error_message): Likewise. gcc/testsuite/ChangeLog: * g++.dg/overload/using2.C: New. From-SVN: r95798
2005-03-01decl.c (finish_function): Use SET_EXPR_LOCATION instead of unavailable ↵Per Bothner1-0/+4
annotate_with_file_line... * decl.c (finish_function): Use SET_EXPR_LOCATION instead of unavailable annotate_with_file_line, if USE_MAPPED_LOCATION. From-SVN: r95772
2005-02-27re PR c++/20206 (COMDAT broken for C++ thunks)Jakub Jelinek1-1/+16
PR c++/20206 * decl.c (cxx_comdat_group): Put thunks for TARGET_USE_LOCAL_THUNK_ALIAS_P (function) functions into the same comdat group as the thunk target. * g++.dg/opt/thunk2.C: New test. * g++.dg/opt/covariant1.C: New test. From-SVN: r95619
2005-02-24re PR c++/20175 (Warnings are issued when initializing struct members with ↵Jakub Jelinek1-1/+4
"strings") PR c++/20175 * decl.c (reshape_init): Don't warn about missing braces if STRING_CST initializes a char/wchar_t array. * g++.dg/warn/Wbraces2.C: New test. From-SVN: r95512
2005-02-24re PR c++/19878 (ICE in import_export_decl)Mark Mitchell1-0/+2
PR c++/19878 * decl.c (grokvardecl): Set DECL_INTERFACE_KNOWN for declarations with internal linkage. PR c++/19878 * g++.dg/init/const2.C: New test. From-SVN: r95490
2005-02-23decl.c (grokvardecl): Don't exempt anonymous types from having linkage for ↵Alexandre Oliva1-17/+9
variables that have... gcc/cp/ChangeLog: * decl.c (grokvardecl): Don't exempt anonymous types from having linkage for variables that have linkage other than "C". gcc/testsuite/ChangeLog: * g++.dg/lookup/anon2.C: Don't let access checks make it look like the test passes. * g++.dg/other/anon3.C: Accept a warning. From-SVN: r95462
2005-02-23re PR c++/20073 (ICE initializing const array)Mark Mitchell1-27/+8
PR c++/20073 * decl.c (start_decl_1): Don't clear TREE_READONLY. (cp_finish_decl): Likewise. (complete_vars): Call cp_apply_type_quals_to_decl. * typeck.c (cp_apply_type_quals): Avoid setting TREE_READONLY in cases where that's not valid. PR c++/20073 * g++.dg/init/const1.C: New test. From-SVN: r95441
2005-02-21re PR c++/19076 (Pointer to member function not matched to pointer to member ↵Douglas Gregor1-7/+48
template) 2005-02-21 Douglas Gregor <dgregor@cs.indiana.edu> PR c++/19076 PR c++/6628 * cp-tree.h (cp_apply_type_quals_to_decl): Declared. * decl.c (grokdeclarator): Pedwarn about qualifying a function type. Add qualifiers when declaring a typedef of a function type. Member function pointers pick up the qualifiers of the typedef used to declare them. Don't complain about creating cv-qualified function types. Complain about qualified function typedefs that are used to declare non-static member functions or free functions. Use cp_apply_type_quals_to_decl. (start_preparsed_function): Use cp_apply_type_quals_to_decl. (grokclassfn): Use cp_apply_type_quals_to_decl. * error.c (dump_type_suffix): Print qualifiers for function types. * pt.c (tsubst_decl): Use cp_apply_type_quals_to_decl. (tsubst): When substituting a function type into a member pointer type, pass along the qualifiers. (unify): Unify member pointers to member function pointers. * tree.c (cp_build_qualified_type_real): Function types may be qualified. This includes restrict qualifiers. * typeck.c (cp_apply_type_quals_to_decl): New function to replace use of c_apply_type_quals_to_decl. Drops qualifiers that are being added to function types. From-SVN: r95356
2005-02-19decl.c (start_decl_1): Only check TYPE_NEEDS_CONSTRUCTING if type is not ↵Jakub Jelinek1-1/+1
error_mark_node. * decl.c (start_decl_1): Only check TYPE_NEEDS_CONSTRUCTING if type is not error_mark_node. From-SVN: r95241
2005-02-18re PR c++/19813 (wrong code with -finline-limit)Jakub Jelinek1-0/+15
PR c++/19813 * emit-rtl.c (set_mem_attributes_minus_bitpos): Add assertion that ref to be marked MEM_READONLY_P doesn't have base that needs constructing. * decl.c (start_decl_1): Clear TREE_READONLY flag if its type has TYPE_NEEDS_CONSTRUCTING. (complete_vars): Likewise. From-SVN: r95217
2005-02-14re PR c++/19884 (ICE on explicit instantiation of a non-template constructor)Nathan Sidwell1-0/+3
cp: PR c++/19884 * pt.c (check_explicit_specialization): Make sure namespace binding lookup found an overloaded function. (lookup_template_function): Just assert FNS is an overloaded function. PR c++/19895 * decl.c (grokdeclarator): Check for error mark node in ptrmem construction. testsuite: PR c++/19895 * g++.dg/parse/ptrmem3.C: New. PR c++/19884 * g++.old-deja/g++.oliva/template6.C: Add another case. * g++.dg/template/explicit6.C: New. From-SVN: r95009
2005-02-14re PR c++/17816 (duplicate definition of pure virtual function not diagnosed)Alexandre Oliva1-1/+2
gcc/cp/ChangeLog: PR c++/17816 * decl.c (redeclaration_error_message): Report redefinition of pure virtual function. gcc/testsuite/ChangeLog: PR c++/17816 * g++.dg/other/redecl2.C: New. From-SVN: r95008
2005-02-11re PR c++/19755 (-Wmissing-braces doesn't warn anymore)Mark Mitchell1-4/+9
PR c++/19755 * decl.c (reshape_init): Issue warnings about missing braces. PR c++/19755 * g++.dg/warn/Wbraces1.C: New test. From-SVN: r94882
2005-02-10re PR c++/19787 (Internal compiler error with ambiguous conversion functions)Mark Mitchell1-12/+28
PR c++/19787 * call.c (initialize_reference): Robustify. PR ++/19732 * decl.c (grokdeclarator): Check for invalid use of destructor names. PR c++/19762 * parser.c (cp_parser_unqualified_id): Avoid creating destructor names with invalid types. PR c++/19826 * parser.c (cp_parser_direct_declarator): Allow type-dependent expressions as array bounds. PR c++/19739 * parser.c (cp_parser_attributes_list): Allow empty lists. PR c++/19787 * g++.dg/conversion/ambig1.C: New test. PR c++/19739 * g++.dg/ext/attrib19.C: New test. PR c++/19732 * g++.dg/parse/dtor5.C: New test. PR c++/19762 * g++.dg/template/dtor3.C: New test. PR c++/19826 * g++.dg/template/static11.C: New test. * g++.dg/template/crash2.C: Remove dg-error marker. From-SVN: r94788
2005-02-09re PR c++/19733 (ICE on invalid destructor call)Mark Mitchell1-3/+0
PR c++/19733 * class.c (add_method): Don't set TYPE_HAS_DESTRUCTOR. (check_bases): Give warnings about a base class with a non-virtual destructor, even if it is implicit. (finish_struct_bits): Don't copy TYPE_HAS_DESTRUCTOR. (maybe_warn_about_overly_private_class): Don't use TYPE_HAS_DESTRUCTOR. (finish_struct_methods): Don't set TYPE_HAS_DESTRUCTOR. (check_for_override): Give it external linkage. (add_implicitly_declared_members): Generate destructors lazily. (check_field_decls): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (check_bases_and_members): Call check_methods before check_field_decls. (check_bases_and_members): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR, not TYPE_HAS_DESTRUCTOR. (finish_struct_1): Do not use TYPE_HAS_DESTRUCTOR. * cp-tree.def (PSEUDO_DTOR_EXPR): Document. * cp-tree.h (TYPE_HAS_DESTRUCTOR): Remove. (lang_type_class): Add lazy_destructor. (CLASSTYPE_LAZY_DESTRUCTOR): New macro. (CLASSTYPE_DESTRUCTORS): Robustify. (TYPE_HAS_DESTRUCTOR): Remove. (check_for_override): Declare. (build_vbase_delete): Remove. * cvt.c (convert_to_void): Issue errors about pseudo-destructor expressions. * decl.c (cxx_maybe_build_cleanup): Remove dead code. * except.c (dtor_nothrow): Lazily create destructors if necessary. (build_throw): Use TYPE_HAS_NONTRIVIAL_DESTRUCTOR. * init.c (build_delete): Lazily create destructors, if necessary. (build_vbase_delete): Remove. * method.c (locate_dtor): Simplify. (implicitly_declare_fn): Add support for destructors. * parser.c (cp_parser_lookup_name): Lazily create destructors, if necessary. * pt.c (check_explicit_specialization): Don't use TYPE_HAS_DESTRUCTOR. (instantiate_class_template): Likewise. * ptree.c (cxx_print_type): Don't print TYPE_HAS_DESTRUCTOR. * rtti.c (emit_support_tinfos): Robustify. * search.c (lookup_fnfields_1): Lazily create destructors. * typeck.c (build_class_member_access_expr): Remove PSEUDO_DTOR_EXPR handling. (lookup_destructor): Likewise. PR c++/19733 * g++.dg/parse/crash23.C: New test. * g++.dg/warn/Weff1.C: New test. From-SVN: r94759