aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
AgeCommit message (Collapse)AuthorFilesLines
2003-07-19fixfixes.c [...]: Remove unnecessary casts.Kaveh R. Ghazi1-1/+1
gcc: * fixinc/fixfixes.c fixinc/fixincl.c fixinc/fixlib.c fixinc/server.c objc/objc-act.c: Remove unnecessary casts. f: * com.c data.c expr.c fini.c g77spec.c global.c lab.c lex.c name.c sta.c stc.c std.c storag.c stt.c stw.c symbol.c target.c type.c: Remove unnecessary casts. cp: * call.c class.c decl.c decl2.c g++spec.c lex.c parser.c pt.c rtti.c semantics.c typeck.c: Remove unnecessary casts. java: * class.c java-tree.h jcf-write.c jvspec.c: Remove unnecessary casts. treelang: * treetree.c: Remove unnecessary casts. From-SVN: r69593
2003-07-10PR c++ 9483Nathan Sidwell1-2/+15
cp: PR c++ 9483 * class.c (check_field_decls): Pass DECL_NAME to constructor_name_p. * decl2.c (constructor_name_p): Avoid repeated constructor_name calls. * decl.c (grokdeclarator): Refactor ctor/dtor detection. testsuite: PR c++ 9483 * g++.dg/other/field1.C: New test. From-SVN: r69180
2003-07-09fold-const.c (make_range): Do not access operand 1 for a zero-operand operator.Mark Mitchell1-103/+89
* fold-const.c (make_range): Do not access operand 1 for a zero-operand operator. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * cp-tree.def (NON_DEPENDENT_EXPR): New node. * cp-tree.h (build_call_from_tree): Remove. (build_member_call): Likewise. (dependent_template_arg_p): Remove. (any_dependent_template_arguments_p): New function. (dependent_template_id_p): Likewise. (any_type_dependent_arguments_p): Likewise. (build_non_dependent_expr): Likewise. (build_non_dependent_args): Likewise. (build_x_compound_expr): Adjust prototype. * call.c (build_new_method_call): Handle non-dependent expressions correctly. * decl2.c (grok_array_decl): Likewise. (build_offset_ref_call_from_tree): Likewise. (build_call_from_tree): Remove. * error.c (dump_decl): Handle NON_DEPENDENT_EXPR. (dump_expr): Likewise. * init.c (build_member_call): Remove. * mangle.c (write_expression): Update handling for template-ids. * parser.c (cp_parser_primary_expression): Use any_dependent_template_arguments_p. Update constant-expression handling. (cp_parser_postfix_expression): Use any_type_dependent_arguments_p. Simplify call processing. (cp_parser_unary_expression): Simplify. (cp_parser_expression): Adjust for changes to build_x_compound_expr. (cp_parser_template_argument): Implement standard-conforming parsing of non-type template arguments. (cp_parser_direct_declarator): Use cp_parser_fold_non_dependent_expr. (cp_parser_fold_non_dependent_expr): New function. (cp_parser_next_token_ends_template_argument_p): Likewise. * pt.c (convert_template_argument): Do not call maybe_fold_nontype_arg. (tsubst_baselink): Likewise. (tsubst_copy_and_build): Share common code. Make sizeof/alignof processing work correctly for non-dependent expressions. Adjust handling of COMPOUND_EXPR. Simplify call processing. (value_dependent_expression_p): Deal with functional casts and sizeof/alignof correctly. (type_dependent_expression_p): Handle overloaded functions. (any_type_dependent_arguments_p): New function. (any_dependent_template_arguments_p): Likewise. (dependent_template_p): Treat SCOPE_REFs as dependent. (dependent_template_id_p): Simplify. (build_non_dependent_expr): New function. (build_non_dependent_args): Likewise. * semantics.c (finish_stmt_expr): Don't make dependent statement-expresions have void type. (finish_call_expr): Handle non-dependent expressions correctly. * tree.c (lvalue_p_1): Treat NON_DEPENDENT_EXPRs as lvalues. * typeck.c (cxx_sizeof_or_alignof_type): Give the expression type size_t, even in templates. (expr_sizeof): Likewise. (finish_class_member_access_expr): Handle non-dependent expressions correctly. (build_x_indirect_ref): Likewise. (build_x_binary_op): Likewise. (build_x_unary_op): Likewise. (build_x_conditional_expr): Likewise. (build_x_compound_expr): Likewise. * typeck2.c (build_x_arrow): Likewise. 2003-07-08 Mark Mitchell <mark@codesourcery.com> * g++.dg/abi/mangle17.C: Make sure template expressions are dependent. * g++.dg/abi/mangle4.C: Mark erroneous casts. * g++.dg/debug/debug7.C: Mark erronous new-declarator. * g++.dg/opt/stack1.C: Remove erroneous code. * g++.dg/parse/template7.C: New test. * g++.dg/template/dependent-expr1.C: Mark erroneous code. * g++.old-deja/g++.pt/crash4.C: Likewise. 2003-07-09 Mark Mitchell <mark@codesourcery.com> * gcj/array.h (JvPrimClass): Don't parenthesize the output. From-SVN: r69130
2003-07-09java-tree.h (DECL_NUM_STMTS): Rename to...Jan Hubicka1-2/+5
* java-tree.h (DECL_NUM_STMTS): Rename to... (DECL_ESTIMATED_INSNS): ... this. * lang.c (java_estimate_num_insns, java_estimate_num_insns_1): New static functions. (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): Define. * parser.y (add_stmt_to_compound): Do not account statements. * cp-lang.c (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): New. * decl.c (duplicate_decls): Use DECL_ESTIMATED_INSNS. (start_function): Use DECL_ESTIMATED_INSNS. * optimize.c (maybe_clone_body): Use DECL_ESTIMATED_INSNS. * decl2.c (maybe_emit_vtables): Fix marking vtables as needed in unit-at-a-time * c-common.c (c_estimate_num_insns_1): New static function. (c_estimate_num_insns): New global function. * c-common.h (DECL_NUM_STMTS): Rename to... (DECL_ESTIMATED_INSNS): ... this. (c_estimate_num_insns): Declare. * c-decl.c (duplicate_decls): Use DECL_ESTIMATED_INSNS. * c-lang.c (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): New. * c-semantics.c (add_stmt): Do not account statements. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS): New. * langhooks.h (lang_hooks_for_tree_inlining): Add estimate_num_insns * params.def (max-inline-insns-auto, max-inline-insns-auto): set to 100. (max-inline-insns): set to 300. (min-inline-insns): set to 10. * tree-inline.c (struct inline_data): Rename inlined_stmts to inlined-insns. (INSNS_PER_STMT): Kill. (inlinable_function_p): Compute and store body size. (expand_call_inline): Likewise. (optimize_inline_calls): Likewise. From-SVN: r69113
2003-07-08cp-tree.h (build_scoped_method_call): Remove.Mark Mitchell1-423/+3
* cp-tree.h (build_scoped_method_call): Remove. (lookup_qualified_name): Remove parameter. (tsubst_copy_and_build): Declare. (finish_qualified_object_call_expr): Remove. (check_accessibility_of_qualified_id): New function. (finish_qualified_id_expr): Likewise. (non_reference): Likewise. (build_expr_from-tree): Remove. * call.c (non_reference): Remove. (build_scoped_method_call): Likewise. (build_method_call): Use error_operand_p. Assert that we are not processing a template. (standard_conversion): Use non_reference. * class.c (build_vtbl_entry_ref): Likewise. (build_vtbl_ref_1): Likewise. * cvt.c (build_expr_type_conversion): Use non_reference. * decl.c (lookup_qualified_name): Remove flags parameter. (grok_op_properties): Use non_reference. * decl2.c (grok_array_decl): Likewise. (build_expr_from_tree): Remove. (build_offset_ref_call_from_tree): Update comment. * error.c (parm_to_string): Call reinit_global_formatting_buffer. * except.c (prepare_eh_types): Use non_reference. (can_convert_eh): Likewise. * init.c (build_dtor_call): Avoid using build_method_call. * mangle.c (write_template_param): Remove misleading comment. * method.c (locate_copy): Use non_reference. * parser.c (cp_parser_scope_through_which_access_occurs): Remove. (cp_parser_primary_expression): Do not create SCOPE_REFs is non-dependent contexts. (cp_parser_postfix_expression): Use finish_qualified_id_expr. (cp_parser_direct_declarator): Use tsubst_copy_and_build, not build_expr_from_tree. (cp_parser_lookup_name): Adjust call to lookup_qualified_name. Use check_accessibility_of_qualified_id. * pt.c (maybe_fold_nontype_arg): Use tsubst_copy_and_build, not build_expr_from_tree. (tsubst_baselink): New function. (tsubst_qualified_id): Likewise. (tsubst_copy): Use them. Remove support for METHOD_CALL_EXPR. (tsubst_expr): Adjust call to lookup_qualified_name. (tsubst_copy_and_build): Handle SCOPE_REFs specially. Adjust handling of CALL_EXPRs. (value_dependent_expression_p): Use INTEGRAL_OR_ENUMERATION_TYPE_P. * rtti.c (get_tinfo_decl_dynamic): Use non_reference. * search.c (check_final_overrider): Likewise. * semantics.c (check_accessibility_of_qualified_id): New function. (finish_qualified_object_call_expr): Remove. * typeck.c (target_type): Use non_reference. (cxx_sizeof_or_alignof_type): Likewise. (dubious_conversion_warnings): Likewise. (convert_for_initialization): Likewise. (non_reference): New function. From-SVN: r69063
2003-07-07genextract.c: Convert remaining prototypes to ISO C90.Andreas Jaeger1-2/+1
2003-07-07 Andreas Jaeger <aj@suse.de> * genextract.c: Convert remaining prototypes to ISO C90. * cpplex.c (_cpp_free_buff): Convert prototype to ISO C90. * fold-const.c (fold_single_bit_test): Likewise. * diagnostic.c (default_diagnostic_finalizer): Likewise. * cfgrtl.c (rtl_redirect_edge_and_branch): Likewise. * gengtype.c (write_array): Generate ISO C90 prototypes. * genflags.c (gen_proto): Generate ISO C90 prototypes. For cp: 2003-07-07 Andreas Jaeger <aj@suse.de> * friend.c: Convert to ISO C90 prototypes. * Make-lang.in ($(srcdir)/cp/cfns.h): Use ANSI-C as output language. * cfns.h: Regenerate. * typeck.c: Convert remaining prototypes to ISO C90. * search.c: Likewise. * decl2.c (build_expr_from_tree): Convert prototype to ISO C90. * semantics.c (expand_or_defer_fn): Likewise * mangle.c (discriminator_for_string_literal): Likewise. * g++spec.c (lang_specific_driver): Likewise. * search.c (lookup_base_r): Remove unused variable. From-SVN: r69050
2003-07-06call.c: Fix comment formatting.Kazu Hirata1-6/+6
* call.c: Fix comment formatting. * class.c: Likewise. * cp-tree.h: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * error.c: Likewise. * method.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * typeck.c: Likewise. From-SVN: r69022
2003-07-05call.c: Fix comment typos.Kazu Hirata1-1/+1
* call.c: Fix comment typos. * class.c: Likewise. * cp-tree.h: Likewise. * cvt.c: Likewise. * decl2.c: Likewise. * decl.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise From-SVN: r68956
2003-07-04call.c (build_addr_func): Handle bound pointers-to-members.Mark Mitchell1-2/+0
* call.c (build_addr_func): Handle bound pointers-to-members. (build_method_call): Do not call resolve_offset_ref. (implicit_conversion): Likewise. (resolve_scoped_fn_name): Use finish_non_static_data_member, not resolve_offset_ref. (resolve_args): Do not call resolve_offset_ref. (build_conditional_expr): Likewise. (build_new_method_call): Likewise. * cp-tree.def (OFFSET_REF): Update documentation. (cp_convert_to_pointer): Update handling of conversions from pointers to members to pointers. (ocp_convert): Do not call resolve_offset_ref. (convert_to_void): Likewise. (build_expr_type_conversion): Likewise. (delete_sanity): Likewise. (resolve_offset_ref): Simplify greatly. (build_vec_delete): Do not call resolve_offset_ref. * parser.c (cp_parser_postfix_expression): Call resolve_offset_ref if appropriate. (cp_parser_unary_expression): Use cp_parser_simple_cast_expression. (cp_parser_delete_expression): Likewise. (cp_parser_cast_expression): Likewise. (cp_parser_pm_expression): Use cp_parser_binary_op. (cp_parser_simple_cast_expression): New function. * rtti.c (build_dynamic_cast_1): Do not call resolve_offset_ref. * semantics.c (finish_increment_expr): Likewise. (finish_typeof): Likewise. * tree.c (lvalue_p_1): Do not handle OFFSET_REF. * typeck.c (require_complete_type): Do not handle OFFSET_REFs. (decay_conversion): Do not call resolve_offset_ref. (finish_class_member_access_expr): Likewise. (convert_arguments): Likewise. (build_x_binary_op): Handle DOTSTAR_EXPR. (condition_conversion): Do not call resolve_offset_ref. (unary_complex_lvalue): Likewise. (build_static_cast): Likewise. (build_reinterpret_cast): Likewise. (build_const_cast): Likewise. (build_c_cast): Likewise. (build_modify_expr): Likewise. (convert_for_assignment): Likewise. (convert_for_initialization): Likewise. * typeck2.c (build_x_arrow): Likewise. (build_m_component_ref): Simplify. * g++.old-deja/g++.jason/typeid1.C: Add dg-error marker. * g++.old-deja/g++.mike/net36.C: Tweak error messages. From-SVN: r68911
2003-07-03call.c (build_scoped_method_call): Use convert_to_void.Mark Mitchell1-16/+11
* call.c (build_scoped_method_call): Use convert_to_void. (build_method_call): Likewise. * class.c (check_field_decls): Remove dead code. * cvt.c (convert_from_reference): Remove OFFSET_TYPE handling. * decl2.c (grok_array_decl): Remove dead code. (arg_assoc_type): Avoid relying on POINTER_TYPE over OFFSET_TYPE as pointer-to-member representation. * init.c (build_offset_ref): Tidy. (build_vec_delete_1): Use convert_to_void. * mangle.c (write_type): Avoid relying on POINTER_TYPE over OFFSET_TYPE as pointer-to-member representation. From-SVN: r68895
2003-07-03re PR c++/9162 ([New parser] Problem with default argument in a friend function)Nathan Sidwell1-2/+8
cp: PR c++/9162 * decl.c (grokdeclarator): Return friend decls, not void_type_node. * decl2.c (grokfield): Alter friend decl check. * parser.c (struct cp_parser): Document default_arg chain on unparsed_functions_queue. (cp_parser_save_default_args): New. (cp_parser_init_declarator, cp_parser_function_definition, cp_parser_member_declaration): Call it. (cp_parser_class_specifier): Remove unused variable. Alter processing of unparsed_functions_queue. testsuite: PR c++/9162 * g++.dg/parse/defarg4.C: New. From-SVN: r68886
2003-07-03class.c (add_method, [...]): Fix format specifier.Kaveh R. Ghazi1-2/+4
* class.c (add_method, check_field_decl): Fix format specifier. * decl.c (duplicate_decls, pushdecl, check_goto, fixup_anonymous_aggr, maybe_commonize_var, grokdeclarator, start_enum): Likewise. * decl2.c (ambiguous_decl): Likewise. * pt.c (redeclare_class_template): Likewise. From-SVN: r68878
2003-07-02re PR c++/9779 (ICE in type_unknown_p when casting in static member)Nathan Sidwell1-0/+5
cp: PR c++/9779 * decl2.c (arg_assoc_class): Don't die on NULL type. * typeck.c (type_unknown_p): Don't die on untyped expressions. testsuite: PR c++/9779 * g++.dg/template/dependent-expr1.C: New. From-SVN: r68824
2003-07-02re PR c++/6949 (ICE in tsubst_decl, at cp/pt.c:5733)Mark Mitchell1-1/+1
PR c++/6949 * decl2.c (grokfield): Create TEMPLATE_DECLs for methods in local classes. PR c++/6949 * g++.dg/template/local3.C: New test. From-SVN: r68818
2003-07-02decl2.c (defer_fn): Set DECL_DEFER_OUTPUT.Jan Hubicka1-17/+43
* decl2.c (defer_fn): Set DECL_DEFER_OUTPUT. (finish-file): Do not process function with DECL_DEFER_OUTPUT clear; clear DECL_DEFER_OUTPUT once function is processed; avoid flags massaging. * cp-tree.h (DECL_NEEDED_P): Support unit-at-a-time (expand_or_defer_fn): Declare. (lower_function): Declare. * decl.c (start_cleanup_fn): Use expand_or_defer_fn. * decl2.c: Include cgraph.h and varpool.h (maybe_emit_vtables): Make explicit instantations as needed. (mark_member_pointers, lower_function): New functions. (finish_file): Do unit-at-a-time. * method.c (synthesize_method): Use expand_or_defer_fn. * optimize.c (maybe_clone_body): Use expand_or_defer_fn. * parser.c (cp_parser_function_definition_after_decl): Use expand_or_defer_fn. * pt.c (instantiate_decl): Likewise. * semantics.c: Include cgraph.h (expand_or_defer_fn): Break out from ... (expand_body): ... here; deal with unit-at-a-time. * cp-lang.c (LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, LANG_HOOKS_CALLGRAPH_LOWER_FUNCTION): Define. From-SVN: r68801
2003-07-01re PR c++/9559 (ICE with invalid initialization of a static const member)Mark Mitchell1-6/+1
PR c++/9559 * decl2.c (grokfield): Do not build NOP_EXPRs around the error_mark_node. PR c++/9559 * g++.dg/init/static1.C: New test. From-SVN: r68764
2003-06-24langhooks-def.h (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): New macro.Jan Hubicka1-6/+6
* langhooks-def.h (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): New macro. * langhooks.h (lang_hooks_for_decls): Add prepare_assemble_variable. * varasm.c (assemble_variable): Call prepare_assemble_variable. * class.c (build_vtable): Make vtables. * cp-tree.h (DECL_VTABLE_OR_VTT_P): New macro. * decl2.c (output_vtable_inherit): Rename to ... (prepare_assemble_variable): ... this one; change interface. (maybe_emit_vtables): Do not call output_vtable_inherit. * cp-lang.c (LANG_HOOKS_PREPARE_ASSEMBLE_VARIABLE): Define. * cp-tree.h (prepare_assemble_variable): New. From-SVN: r68418
2003-06-23decl.c (register_dtor_fn): Mark cleanup as used.Jan Hubicka1-1/+3
* decl.c (register_dtor_fn): Mark cleanup as used. * decl2.c (mark_vtable_entries): Skip nops. * rtti.c (get_tinfo_ptr): Mark tinfo as used. (build_dynamic_cast_1): Likewise. (tinfo_base_init): Likewise. (emit_tinfo_decl): Likewise. From-SVN: r68377
2003-06-20re PR middle-end/11041 (ICE: const myclass &x = *x; (when operator*() defined))Mark Mitchell1-2/+1
PR c++/11041 * call.c (initialize_reference): Do not use cp_finish_decl to emit temporary variables. * cp-tree.h (static_aggregates): Declare. (pushdecl_top_level_and_finish): Likewise. * decl.c (pushdecl_top_level_1): New function. (pushdecl_top_level): Use it. (pushdecl_top_level_and_finish): New function. (initialize_local_var): Remove redundant code. (cp_finish_decl): Remove support for RESULT_DECLs. Don't check building_stmt_tree. * decl.h (static_aggregates): Remove. * decl2.c (get_guard): Use pushdecl_top_level_and_finish. * rtti.c (get_tinfo_decl): Use pushdecl_top_level_and_finish. (tinfo_base_init): Likewise. PR c++/11041 * g++.dg/init/ref7.C: New test. From-SVN: r68236
2003-06-11decl2.c (generate_ctor_or_dtor_function): Avoid expanding a global static ↵Roger Sayle1-14/+32
constructor/destructor if it will be empty, i.e. * decl2.c (generate_ctor_or_dtor_function): Avoid expanding a global static constructor/destructor if it will be empty, i.e. either doesn't call any ctors/dtors or only calls pure or const ctors/dtors. From-SVN: r67800
2003-06-10re PR c++/11131 (Unrelated declaration removes inline flag from function)Mark Mitchell1-1/+3
PR c++/11131 * tree-inline.c (inlinable_function_p): Call the language-specific hook early. PR c++/11131 * cp-tree.h (template_for_substitution): Declare. * decl2.c (mark_used): Use it when figuring out whether or not a function is inline. * pt.c (template_for_substitution): Give it external linkage. * tree.c (cp_cannot_inline_tree_fn): Instantiate as early as possible. PR c++/11131 * g++.dg/opt/template1.C: New test. From-SVN: r67698
2003-05-21init.c (build_vec_delete): Copy the address into a temporary variable before ↵Jason Merrill1-2/+1
calling build_vec_delete_1. * init.c (build_vec_delete): Copy the address into a temporary variable before calling build_vec_delete_1. * decl2.c (delete_sanity): Don't call stabilize_reference. From-SVN: r67072
2003-05-03class.c (finish_struct): Use location_t and input_location directly.Nathan Sidwell1-16/+9
* class.c (finish_struct): Use location_t and input_location directly. * decl.c (make_label_decl): Likewise. (use_label): Likewise. * decl2.c (warn_if_unknown_interface): Likewise. (start_static_initialization_or_destruction): Likewise. (generate_ctor_or_dtor_function): Likewise. (finish_file): Likewise. * error.c (print_instantiation_full_context): Likewise. * init.c (create_temporary_var): Likewise. * method.c (synthesize_method): Likewise. * parser.c (cp_token): Likewise. (cp_lexer_set_source_position_from_token): Likewise. (cp_lexer_get_preprocessor_token): Likewise. (cp_parser_statement): Likewise. * pt.c (tsubst_friend_function): Likewise. (instantiate_class_template): Likewise. (tsubst_decl): Likewise. (tsubst): Likewise. (instantiate_decl): Likewise. * semantics.c (begin_class_definition): Likewise. (expand_body): Likewise. From-SVN: r66423
2003-05-01input.h (lineno): Rename to ...Nathan Sidwell1-10/+10
* input.h (lineno): Rename to ... (input_line): ... here. * tree.h (lineno): Rename to ... (input_line): ... here. * scan.h (lineno): Rename to ... (input_line): ... here. * toplev.c (lineno): Rename to ... (input_line): ... here. (push_srcloc, pop_srcloc): Rename lineno to input_line. * c-common.c (c_expand_start_cond, fname_decl): Likewise. * c-decl.c (poplevel, pop_label_level, lookup_label, lookup_tag, store_parm_decls, c_expand_body_1): Likewise. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-lex.c (fe_file_change, cb_def_pragma, c_lex): Likewise. * c-opts.c (c_common_post_options, c_common_parse_file): Likewise. * c-parse.in (save_filename, maybe_type_qual, ifc): Likwise. * c-semantics.c (finish_stmt_tree, build_stmt, emit_local_var, gentrtl_goto_stmt, genrtl_expr_stmt_value, genrtl_decl_stmt, genrtl_if_stmt, genrtl_while_stmt, genrtl_do_stmt, genrtl_return_stmt, genrtl_for_stmt, build_break_stmt, build_continue_stmt, genrtl_switch_stmt, genrtl_asm_stmt, prep_stmt, find_reachable_label, expand_unreachable_stmt): Likewise. * coverage.c (create_coverage): Likewise. * diagnostic.c (pedwarn, sorry, error, fatal_error, internal_error, warning, diagnostic_report_current_module, inform): Likewise. * expr.c (expand_expr): Likewise. * integrate.c (expand_inline_function, output_inline_function): Likewise. * rtl-error.c (file_and_line_for_asm): Likewise. * tree-inline.c (find_alloca_call, find_builtin_longjmp_call, walk_tree): Likewise. * tree.c (make_node): Likewise. * ada, cp, f, java, objc, treelang: Likewise. ada * trans.c (build_unit_elab, set_lineno): Rename lineno to input_line. * utils.c (pushdecl, create_label_decl, begin_subprog_body, end_subprog_body): Likewise. * utils2.c (build_call_raise): Likewise. cp * class.c (finish_struct): Rename lineno to input_line. * decl.c (push_binding_level, pop_binding_level, suspend_binding_level, resume_binding_level, make_label_decl, use_label, start_function): Likewise. * decl2.c (warn_if_unknown_interface, start_static_initialization_or_destruction, generate_ctor_or_dtor_function, finish_file): Likewise. * error.c (cp_line_of, print_instantiation_full_context, print_instantiation_context): Likewise. * except.c (check_handlers_1, check_handlers): Likewise. * init.c (create_temporary_var): Likewise. * method.c (use_thunk, synthesize_method): Likewise. * parser.c (cp_lexer_set_source_position_from_token, cp_lexer_get_preprocessor_token): Likewise. * pt.c (push_tinst_level, pop_tinst_level, tsubst_friend_function, instantiate_class_template, tsubst_decl, tsubst, tsubst_expr, instantiate_decl): Likewise. * semantics.c (genrtl_try_block, finish_label_stmt, begin_class_definition, expand_body, genrtl_finish_function): Likewise. * tree.c (build_min_nt, build_min): Likewise. f * ansify.c (die_unless): Rename lineno to input_line. * com.c (ffecom_subscript_check_, ffecom_do_entry_, ffecom_gen_sfuncdef_, ffecom_start_progunit_, ffecom_sym_transform_, ffecom_sym_transform_assign_, bison_rule_pushlevel_, bison_rule_compstmt_, finish_function, store_parm_decls): Likewise. * intrin.c (ffeintrin_fulfill_generic): Likewise. * lex.c (ffelex_hash_, ffelex_include_, ffelex_next_line_, ffelex_file_fixed, ffelex_file_free): Likewise. * std.c (ffestd_exec_end): Likewise. * ste.c (ffeste_emit_line_note_, ffeste_start_block_, ffeste_start_stmt_): Likewise. * ste.h (ffeste_filelinenum, ffeste_set_line): Likewise. java * lex.h (lineno): Rename to ... (input_line): ... here * parse-scan.y (lineno): Rename to ... (input_line): ... here. (reset_report): Rename lineno to input_line. * check-init.c (check_init): Likewise. * class.c (push_class): Likewise. * decl.c (complete_start_java_method, end_java_method): Likewise. * expr.c (expand_byte_code): Likewise. * jcf-parse.c (give_name_to_class, parse_class_file): Likewise. * jcf-write.c (generate_bytecode_insns): Likewise. * lex.c (java_init_lex, java_allocate_new_line, do_java_lex): Likewise. * parse.h (YYNOT_TWICE): Likewise. * parse.y (empty_statement, expression_statement, java_pop_parser_context, java_parser_context_save_global, yyerror, register_fields, method_header, safe_layout_class, find_in_imports_on_demand, create_artificial_method, source_end_java_method, start_complete_expand_method, build_thisn_assign, java_complete_lhs, maybe_absorb_scoping_block): Likewise. objc * objc-act.c (objc_init): Rename lineno to input_line. (build_module_descriptor, build_selector_translation_table, build_protocol_template, build_method_prototype_list_template, build_category_template, build_selector_table, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template, add_instance_variable): Likewise. treelang * tree1.c (treelang_init): Rename lineno to input_line. From-SVN: r66333
2003-05-01decl2.c (comdat_linkage): Don't externalize explicit instantiations.Mark Mitchell1-1/+1
* decl2.c (comdat_linkage): Don't externalize explicit instantiations. From-SVN: r66331
2003-05-01re PR c++/10554 (ICE with illegal using declaration)Kriang Lerdsuwanakij1-0/+1
PR c++/10554 * decl2.c (do_class_using_decl): Check if operand 0 of SCOPE_REF is not NULL. * g++.dg/lookup/using5.C: New test. From-SVN: r66329
2003-04-30PR c++/9432, c++/9528Kriang Lerdsuwanakij1-0/+8
PR c++/9432, c++/9528 * decl2.c (validate_nonmember_using_decl): Handle SCOPE_REF. * g++.dg/lookup/using4.C: New test. From-SVN: r66298
2003-04-26* decl2.c (finish_file): Fix merge botch.Mark Mitchell1-0/+2
From-SVN: r66114
2003-04-26decl2.c (finish_file): Don't call import_export_decl for functions that are ↵Mark Mitchell1-4/+14
not defined. * decl2.c (finish_file): Don't call import_export_decl for functions that are not defined. (handle_class_head): Robustify. * pt.c (instantiate_decl): Do not call cp_finish_decl for variables that are not defined. * g++.old-deja/g++.pt/instantiate12.C: Explicit instantiate initialized static data members. From-SVN: r66095
2003-04-22Makefile.in (calls.o): Depend on except.h.Mark Mitchell1-1/+27
* Makefile.in (calls.o): Depend on except.h. * calls.c: Include except.h. (emit_call_1): Call note_eh_region_may_contain_throw if appropriate. * except.c (eh_region): Add may_contain_throw. (expand_eh_region_end_cleanup): Do not include handler code when it cannot be reached. (note_eh_region_may_contain_throw): New function. * except.h (note_eh_region_may_contain_throw): New function. * call.c (build_over_call): Use build_cxx_call. (build_cxx_call): New method, split out of build_over_call. * cp-tree.h (language_function): Add can_throw. (build_cxx_call): Declare it. * decl.c (finish_function): If a function does not contain any calls to functions that can throw an exception, indicate that fact. * decl2.c (mark_used): Do not defer the instantiation of functions, if the current function does not throw. * optimize.c (maybe_clone_body): Copy TREE_NOTHROW to the clones. * pt.c (instantiate_decl): Make sure import_export_decl is called before emitting things. * rtti.c (throw_bad_cast): Use build_cxx_call. (build_dynamic_cast_1): Likewise. * typeck.c (build_function_call): Likewise. * g++.dg/template/recurse.C: Adjust location of error messages. From-SVN: r65929
2003-04-20cpplex.c (_cpp_lex_direct): Set BOL for CPP_EOF tokens.Nathan Sidwell1-22/+34
.: * cpplex.c (_cpp_lex_direct): Set BOL for CPP_EOF tokens. * gcov.c (output_lines): Don't be so fussy about going past EOF. cp: * cp/decl2.c (start_static_storage_duration_function): Take count arg, don't check if it wraps round. (generate_ctor_or_dtor_function): Add locus arg, use it. (generate_ctor_and_dtor_functions_for_priority): Data arg is a locus. (finish_file): Set line numbers to past EOF for synthesized functions. From-SVN: r65847
2003-04-15decl2.c (mark_used): Don't instantiate anything if skip_evaluation.Jason Merrill1-4/+3
* decl2.c (mark_used): Don't instantiate anything if skip_evaluation. From-SVN: r65642
2003-04-13tree.c (build_constructor): New function.Zack Weinberg1-1/+1
* tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-03gengtype-lex.l (IWORD): Add CHAR_BITFIELD.Kaveh R. Ghazi1-2/+6
gcc: * gengtype-lex.l (IWORD): Add CHAR_BITFIELD. * system.h (CHAR_BITFIELD): New. cp: * operators.def (DEF_SIMPLE_OPERATOR, DEF_ASSN_OPERATOR, DEF_ASSN_OPERATOR): Delete spurious semi-colon. * rtti.c (dfs_class_hint_mark): Likewise. * decl.c (push_local_name, push_class_level_binding, maybe_inject_for_scope_var): Don't use POP_TIMEVAR_AND_RETURN in functions returning void. * decl2.c (add_using_namespace): Likewise. * decl.c (print_binding_level, print_other_binding_stack, print_binding_stack): Cast argument of %p specifier to void*. * ptree.c (cxx_print_decl): Likewise. * cp-tree.h (VAR_OR_FUNCTION_DECL_CHECK, VAR_FUNCTION_OR_PARM_DECL_CHECK, VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK, RECORD_OR_UNION_TYPE_CHECK, BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK, LANG_TYPE_CLASS_CHECK, LANG_TYPE_PTRMEM_CHECK, LANG_DECL_U2_CHECK): Add __extension__. * decl.c (set_current_binding_level): New macro. Use throughout when setting the current binding level. * cp-tree.h (cp_lvalue_kind, base_access): Delete trailing comma in enum. * method.c (mangling_flags): Likewise. * cp-tree.h (lang_type_header): Add __extension__ and use CHAR_BITFIELD for members. From-SVN: r65201
2003-03-30cp-tree.h (binding_for_name): Move to name-lookup.h Adjust prototype.Gabriel Dos Reis1-4/+6
* cp-tree.h (binding_for_name: Move to name-lookup.h Adjust prototype. (cxx_scope_find_binding_for_name): Likewise. * decl.c (find_binding: Move to name-lookup.c. (binding_for_name): Likewise. (cxx_scope_find_binding_for_name): Likewise. (BINDING_LEVEL): Remove. (push_binding): Tidy. (push_class_binding): Likewise. (pop_binding): Likewise. (poplevel): Likewise. (poplevel_class): Likewise. (set_identifier_type_value_with_scope): Likewise. (push_overloaded_decl): Likewise. (lookup_tag): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_name_current_level): Likewise. (maybe_inject_for_scope_var): Likewise. (namespace_binding): Move to name-lookup.c. (set_namespace_binding): Likewise. * decl2.c (lookup_using_namespace): Tidy. (qualified_lookup_using_namespace): Likewise. (do_toplevel_using_decl): Likewise. * name-lookup.c: Include "timevar.h" * name-lookup.h (cxx_scope): Declare. (struct cxx_binding): Lose member "has_level". Adjust "scope" member declaration. (BINDING_SCOPE): Adjust definition. (BINDING_HAS_LEVEL_P): Remove. From-SVN: r65044
2003-03-28decl2.c (generate_ctor_or_dtor_function): Tolerate a non-existant ssdf_decls ↵Mark Mitchell1-10/+20
array. * decl2.c (generate_ctor_or_dtor_function): Tolerate a non-existant ssdf_decls array. (finish_file): Call generator_ctor_or_dtor_function when there are static constructors or destructors and no other static initializations. * g++.dg/init/attrib1.C: New test. From-SVN: r64979
2003-03-28re PR c++/10047 (-fno-default-inline produces bogus warnings)Nathan Sidwell1-1/+5
cp: PR c++/10047 * decl2.c (finish_file): Don't warn about explicitly instantiated inline decls. testsuite: PR c++/10047 * g++.dg/template/inline1.C: New test. From-SVN: r64953
2003-03-24re PR c++/10026 (ICE on incomplete type)Nathan Sidwell1-0/+2
cp: PR c++/10026 * decl2.c (arg_assoc_type) [ERROR_MARK]: Don't die. testsuite: PR c++/10026 * g++.dg/lookup/koenig1.C: New test. PR C++/10199 * g++.dg/lookup/template2.C: New test. From-SVN: r64809
2003-03-21decl2.c (arg_assoc_class): Correct check for namespace-scope friends.Mark Mitchell1-1/+1
* cp/decl2.c (arg_assoc_class): Correct check for namespace-scope friends. * cp/pt.c (instantiate_class_template): Fix formatting. * g++.dg/template/friend17.C: New test. From-SVN: r64645
2003-03-20cp-tree.h (unemitted_tinfo_decls): Declaration of a new varray.Matt Austern1-6/+31
* cp-tree.h (unemitted_tinfo_decls): Declaration of a new varray. (unemitted_tinfo_decl_p): Remove. (emit_tinfo_decl): Change declaration to remove unused parameter. * decl2.c (finish_file): Change tinfo emission to loop through unemitted_tinfo_decls array instead of looping through all decls. * rtti.c (unemitted_tinfo_decl_p): Declare as static, remove unused second parameter. (init_rtti_processing): initialize unemitted_tinfo_decls varray. (get_tinfo_decls): push new tinfo decl on unemitted_tinfo_decls. (emit_tinfo_decl): remove unused second parameter, add assertion that decl hasn't already been emitted. From-SVN: r64621
2003-03-15Compile-time improvement: 2/n.Gabriel Dos Reis1-33/+31
* cp-tree.h (struct cxx_binding): New datatype; (struct lang_identifier): Use it. (LOCAL_BINDING_P): Adjust definition. (INHERITED_VALUE_BINDING_P): Likewise. (BINDING_SCOPE): Likewise. (BINDING_HAS_LEVEL_P): Likewise. (BINDING_VALUE): Likewise. (BINDING_TYPE): Likewise. (IDENTIFIER_VALUE): Likewise. (struct tree_binding): Remove. (TS_CP_BINDING): Likewise. ((union lang_tree_node): Remove field "binding". (cxx_binding_clear): New macro. (binding_for_name): Adjust return type. (qualified_lookup_using_namespace): Adjust prototype. (lookup_using_namespace): Adjust prototype. (cxx_scope_find_binding_for_name): Declare. * cp-tree.def: Remove CPLUS_BINDING definition. * parse.y (parse_scoped_id): Don't type-abuse of 'id'. Allocate temporary cxx_binding on stack. Simplify. * decl.c (push_binding): Adjust local variable type. (add_binding): Likewise. (push_class_binding): Likewise. (pop_binding): Likewise. (poplevel): Likewise. (poplevel_class): Likewise. (free_bindings): Adjust type. (find_binding): Adjust return type, add a third parameter. Remove non-useful assertion now that we use static typing. (cxx_scope_find_binding_for_name): New function. (binding_for_name): Use it. Adjust local variable type. Simplify. (namespace_binding): Simplify. (set_namespace_binding): Likewise. (set_identifier_type_value_with_scope): Adjust local variable type. (lookup_tag): Don't type-abuse of local variable 'old'. (lookup_namespace_name): Likewise. Allocate binding on stack. (select_decl): Adjust prototype. (unqualified_namespace_lookup): Allocate binding on stack. Don't type-abuse of local variable 'val'. (lookup_name_real): Likewise. (maybe_inject_for_scope_var): Adjust local variable type. (cp_tree_node_structure): Remove CPLUS_BINDING case label. (namespace_binding): Adjust logic, simplify. (BINDING_LEVEL): Adjust definition. (push_class_level_binding): Adjust local variable type. (struct cxx_saved_binding): Adjust field 'binding' type. * decl2.c (ambiguous_decl): Adjust prototype. (lookup_using_namespace): Adjust local variable type. (qualified_lookup_using_namespace): Catch type error and correct ensueing logic error. (do_nonmember_using_decl): Adjust local variable type. Allocate temporary cxx_binding on stack. (do_toplevel_using_decl): Adjust local variable type. * ptree.c (cxx_print_cxx_binding): New function. (cxx_print_identifier): Use it. (cxx_print_xnode): Delete CPLUS_BINDING case label. From-SVN: r64405
2003-03-13decl2.c (do_nonmember_using_decl): Correct handling of simultaneous ↵Mark Mitchell1-0/+7
type/non-type bindings. * decl2.c (do_nonmember_using_decl): Correct handling of simultaneous type/non-type bindings. * g++.dg/parse/namespace9.C: New test. From-SVN: r64323
2003-03-12re PR c++/9336 (ICE in cp_line_of, at cp/error.c:2191)Mark Mitchell1-10/+4
PR c++/9336 * g++.dg/parse/namespace8.C: New test. PR c++/9336 * decl2.c (do_nonmember_using_decl): Do not call duplicate decls to merge old and new declarations. From-SVN: r64216
2003-03-11re PR c++/9924 (Multiple using statements for builtin functions not allowed)Mark Mitchell1-12/+18
PR c++/9924 * g++.dg/overload/builtin2.C: New test. 2003-03-11 Mark Mitchell <mark@codesourcery.com> PR c++/9924 * decl2.c (do_nonmember_using_decl): Ignore anticipated builtins. From-SVN: r64197
2003-03-11re PR c++/8700 (unhelpful error message for binding temp to reference)Mark Mitchell1-4/+3
PR c++/8700 * call.c (convert_class_to_reference): Adjust usage of splice_viable. (any_viable): Remove. (splice_viable): Combine with any_viable. (print_z_candidates): Avoid printing duplicates. (build_user_type_conversion_1): Adjust usage of splice_viable. (build_new_function_call): Likewise. (build_operator_new_call): Likewise. (build_object_call): Likewise. (build_conditional_expr): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. (joust): Remove spurious comment. * cp-tree.h (DECL_FRIENDLIST): Correct documentation. * decl2.c (arg_assoc_class): Simplify. * friend.c (add_friend): Likewise. From-SVN: r64173
2003-03-11re PR c++/8660 (template overloading ICE in tsubst_expr, at cp/pt.c:7644)Jason Merrill1-0/+10
PR c++/8660 * decl2.c (check_classfn): A member template only matches a member template. From-SVN: r64166
2003-03-10re PR c++/9868 (ICE in c_expand_expr when qualifying member variable)Jason Merrill1-3/+4
PR c++/9868 * call.c (resolve_scoped_fn_name): Handle the case of a function pointer member. From-SVN: r64122
2003-03-08re PR c++/9809 (when are builtins brought into view)Mark Mitchell1-42/+56
PR c++/9809 * g++.dg/parse/builtin1.C: New test. PR c++/9982 * g++.dg/abi/cookie1.C: New test. * g++.dg/abi/cookie2.C: Likewise. PR c++/9524 * g++.dg/parse/field1.C: New test. PR c++/9912 * g++.dg/parse/class1.C: New test. * g++.dg/parse/namespace7.C: Likewise. * g++.old-deja/g++.other/decl5.C: Remove XFAILs. From-SVN: r63977
2003-02-26re PR c++/9683 (bug in initialization chains for static const variables from ↵Mark Mitchell1-15/+24
template classes) PR c++/9683 * decl2.c (prune_vars_needing_no_initialization): Do not throw away initializations for DECL_EXTERNAL VAR_DECLs. (finish_file): Adjust accordingly. * pt.c (instantiate_decl): Do not defer VAR_DECLs. PR c++/9683 * g++.dg/template/static3.C: New test. From-SVN: r63455
2003-02-15search.c: ANSIfy function declarations and definitions.Nathan Sidwell1-3/+3
* search.c: ANSIfy function declarations and definitions. * cp-tree.h (lookup_field, lookup_member): Last parameter is a bool. * call.c (build_method_call, resolve_scoped_fn_name, build_java_interface_fn_ref): Adjust lookup_field, lookup_member calls. * class.c (handle_using_decl): Likewise. * decl.c (make_typename_type, make_unmound_class_template, start_decl, compute_array_index_type): Likewise. * decl2.c (build_expr_from_tree, build_call_from_tree): Likewise. * init.c (expand_member_init, build_member_call): Likewise. * pt.c (tsubst_copy, tsubst_copy_and_build, do_decl_instantiation, resolve_typename_type): Likewise. * typeck.c (lookup_destructor, finish_class_member_access_exprm build_prememfunc_access_expr): Likewise. From-SVN: r62939