Commit Graph

720 Commits

Author SHA1 Message Date
Nathan Sidwell d479d37f5e input.h (lineno): Rename to ...
* 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-01 16:13:36 +00:00
Mark Mitchell 49bf457745 decl2.c (comdat_linkage): Don't externalize explicit instantiations.
* decl2.c (comdat_linkage): Don't externalize explicit
	instantiations.

From-SVN: r66331
2003-05-01 15:46:01 +00:00
Kriang Lerdsuwanakij d0af00afb9 re PR c++/10554 (ICE with illegal using declaration)
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-05-01 15:02:13 +00:00
Kriang Lerdsuwanakij d7ed5e55a2 PR c++/9432, c++/9528
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-30 17:51:41 +00:00
Mark Mitchell e2b694230a * decl2.c (finish_file): Fix merge botch.
From-SVN: r66114
2003-04-26 20:22:12 +00:00
Mark Mitchell ea56c40c48 decl2.c (finish_file): Don't call import_export_decl for functions that are 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-26 01:27:09 +00:00
Mark Mitchell b2dd096b0c Makefile.in (calls.o): Depend on except.h.
* 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-22 05:44:12 +00:00
Nathan Sidwell 299f79b5a0 cpplex.c (_cpp_lex_direct): Set BOL for CPP_EOF tokens.
.:	* 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-20 11:57:38 +00:00
Jason Merrill ac5f3b6763 decl2.c (mark_used): Don't instantiate anything if skip_evaluation.
* decl2.c (mark_used): Don't instantiate anything if
        skip_evaluation.

From-SVN: r65642
2003-04-15 12:26:03 -04:00
Zack Weinberg dcf92453c8 tree.c (build_constructor): New function.
* 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-13 01:45:35 +00:00
Kaveh R. Ghazi de94b46c5c gengtype-lex.l (IWORD): Add CHAR_BITFIELD.
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-04-03 15:42:16 +00:00
Gabriel Dos Reis ed3cf9539b cp-tree.h (binding_for_name): Move to name-lookup.h Adjust prototype.
* 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-30 16:00:39 +00:00
Mark Mitchell 400fbc0868 decl2.c (generate_ctor_or_dtor_function): Tolerate a non-existant ssdf_decls 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-28 19:30:41 +00:00
Nathan Sidwell 433cd9c9cb re PR c++/10047 (-fno-default-inline produces bogus warnings)
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-28 08:02:15 +00:00
Nathan Sidwell 2ef6c975b9 re PR c++/10026 (ICE on incomplete type)
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-24 18:20:12 +00:00
Mark Mitchell 963142fcd5 decl2.c (arg_assoc_class): Correct check for namespace-scope friends.
* 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-21 07:04:07 +00:00
Matt Austern a260bce676 cp-tree.h (unemitted_tinfo_decls): Declaration of a new varray.
* 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-20 21:14:30 +00:00
Gabriel Dos Reis af6fd53f5a Compile-time improvement: 2/n.
* 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-15 16:30:02 +00:00
Mark Mitchell 45707d3120 decl2.c (do_nonmember_using_decl): Correct handling of simultaneous 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-13 20:54:36 +00:00
Mark Mitchell 2601a4ee73 re PR c++/9336 (ICE in cp_line_of, at cp/error.c:2191)
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-12 07:23:15 +00:00
Mark Mitchell 0c33daffa3 re PR c++/9924 (Multiple using statements for builtin functions not allowed)
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-11 23:07:45 +00:00
Mark Mitchell 436f8a4ce0 re PR c++/8700 (unhelpful error message for binding temp to reference)
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-11 15:43:14 +00:00
Jason Merrill 5b8e011cf6 re PR c++/8660 (template overloading ICE in tsubst_expr, at cp/pt.c:7644)
PR c++/8660
        * decl2.c (check_classfn): A member template only matches a
        member template.

From-SVN: r64166
2003-03-11 05:33:28 -05:00
Jason Merrill 6e9554e198 re PR c++/9868 (ICE in c_expand_expr when qualifying member variable)
PR c++/9868
        * call.c (resolve_scoped_fn_name): Handle the case of a function
        pointer member.

From-SVN: r64122
2003-03-10 16:10:37 -05:00
Mark Mitchell 089d6ea74b re PR c++/9809 (when are builtins brought into view)
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-03-08 09:12:54 +00:00
Mark Mitchell cec24319c6 re PR c++/9683 (bug in initialization chains for static const variables from 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-26 05:39:01 +00:00
Nathan Sidwell 86ac05753c search.c: ANSIfy function declarations and definitions.
* 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
2003-02-15 18:03:22 +00:00
Gabriel Dos Reis fd295cb213 decl2.c: Include "timevar.h".
* decl2.c: Include "timevar.h".
	(namespace_ancestor): Time name lookup.
	(add_using_namespace): Likewise.
	(lookup_using_namespace): Likewise.
	(qualified_lookup_using_namespace): Likewise.
	(decl_namespace): Likewise.
	(lookup_arg_dependent): Likewise.
	* lex.c (do_identifier): Likewise.
	(do_scoped_id): Likewise.
	* pt.c (lookup_template_class): Likewise.

From-SVN: r62892
2003-02-14 06:04:41 +00:00
Mark Mitchell 14d22dd667 c-common.c (builtin_define_float_constants): Define __<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.
* c-common.c (builtin_define_float_constants): Define
	__<TYPE>_HAS_INFINITY__ and __<TYPE>_HAS_QUIET_NAN__.

	* call.c (build_field_call): Use build_new_op, not build_opfncall.
	(prep_operand): New function.
	(build_new_op): Use it.  Remove dead code.
	* class.c (pushclass): Change "modify" parameter type from int to
	bool.
	(currently_open_class): Use same_type_p, not pointer equality.
	(push_nested_class): Adjust calls to pushclass, remove modify
	parameter.
	* cp-tree.h (INTEGRAL_OR_ENUMERATION_TYPE_P): New macro.
	(pushclass): Change prototype.
	(push_nested_class): Likewise.
	(grokoptypename): Remove.
	(build_opfncall): Remove.
	(value_dependent_expression_p): Declare.
	(resolve_typename_type): Likewise.
	(resolve_typename_type_in_current_instantiation): Likewise.
	(enter_scope_of): Remove.
	(tsubst): Remove.
	(tsubst_expr): Likewise.
	(tsubst_copy): Likewise.
	(tsubst_copy_and_build): Likewise.
	* decl.c (warn_about_implicit_typename_lookup): Remove.
	(finish_case_label): Return error_mark_node for erroneous labels.
	(start_decl): Adjust calls to push_nested_class.
	(grokfndecl): Call push_scope/pop_scope around call to
	duplicate_decls.
	(grokdeclarator): Do not call tsubst.
	(start_function): Adjust calls to push_nested_class.
	* decl2.c (grok_array_decl): Use build_new_op, not build_opfncall.
	(check_classfn): Use push_scope/pop_scope around type comparisions.
	(grokoptypename): Remove.
	(push_sscope): Adjust call to push_nested_class.
	* error.c (dump_type): Show cv-qualification of typename types.
	* init.c (build_member_call): Use build_new_op, not
	build_opfncall.
	* method.c (build_opfncall): Remove.
	* parser.c (cp_parser): Add allow_non_constant_expression_p and
	non_constant_expression_p.
	(cp_parser_constant_expression): Adjust prototype.
	(cp_parser_resolve_typename_type): Remove.
	(cp_parser_non_constant_expression): New function.
	(cp_parser_non_constant_id_expression): Likewise.
	(cp_parser_new): Set allow_non_constant_expression_p and
	non_constant_expression_p.
	(cp_parser_primary_expression): Reject `this' and `va_arg' in
	constant-expressions.  Note that dependent names aren't really
	constant.
	(cp_parser_postfix_expression): Reject conversions to non-integral
	types in constant-expressions.  Neither are increments or
	decrements.
	(cp_parser_unary_expression): Reject increments and decrements in
	constant-expressions.
	(cp_parser_direct_new_declarator): Adjust call to
	cp_parser_constant_expression.
	(cp_parser_cast_expression): Reject conversions to non-integral
	types in constant-expressions.
	(cp_parser_assignment_expression): Rejects assignments in
	constant-expressions.
	(cp_parser_expression): Reject commas in constant-expressions.
	(cp_parser_labeled_statement): Adjust call to
	cp_parser_constant_expression.
	(cp_parser_direct_declarator): Simplify array bounds, even in
	templates, when they are non-dependent.  Use
	resolve_typename_type, not cp_parser_resolve_typename_type.
	(cp_parser_class_head): Use resolve_typename_type, not
	cp_parser_resolve_typename_type.
	(cp_parser_member_declaration): Adjust call to
	cp_parser_constant_expression.
	(cp_parser_constant_initializer): Likewise.
	(cp_parser_constructor_declarator): Use resolve_typename_type, not
	cp_parser_resolve_typename_type.
	(cp_parser_late_parsing_default_args): Adjust call to
	push_nested_class.
	* pt.c (tsubst): Give it internal linkage.
	(tsubst_expr): Likewise.
	(tsubst_copy): Likewise.
	(tsubst_copy_and_build): Likewise.
	(push_access_scope_real): Likewise.
	(tsubst_friend_class): Likewise.
	(instantiate_class_template): Adjust call to pushclass.
	(value_dependent_expression_p): Give it external linkage.
	Robustify.
	(resolve_typename_type): New function.
	* semantics.c (finish_call_expr): Use build_new_op, not
	build_opfncall.
	(begin_constructor_declarator): Remove.
	(begin_class_definition): Adjust call to pushclass.
	(enter_scope_of): Remove.
	* typeck.c (comptypes): Resolve typename types as appropriate.
	(build_x_indirect_ref): Use build_new_op, not build_opfncall.
	(build_x_compound_expr): Likewise.
	(build_modify_expr): Likewise.
	(build_x_modify_expr): Likewise.
	* typeck2.c (build_x_arrow): Likewise.

	* g++.dg/parser/constant1.C: New test.

	* include/std/std_limits.h (numeric_limits<float>::has_infinity):
	Use __FLT_HAS_INIFINITY__ to initialize.
	(numeric_limits<float>::has_quiet_NaN): Likewise.
	(numeric_limits<double>::has_infinity): Use __DBL_HAS_INIFINITY__
	to initialize.
	(numeric_limits<double>::has_quiet_NaN): Likewise.
	(numeric_limits<long double>::has_infinity): Use
	__LDBL_HAS_INIFINITY__ to initialize.
	(numeric_limits<long_double>::has_quiet_NaN): Likewise.

From-SVN: r62130
2003-01-30 07:24:02 +00:00
Mark Mitchell 8fbc5ae723 cp-tree.h (lang_type_class): Remove is_partial_instantiation.
* cp-tree.h (lang_type_class): Remove is_partial_instantiation.
	(PARTIAL_INSTANTIATION_P): Remove.
	(IMPLICIT_TYPENAME_P): Likewise.
	(IMPLICIT_TYPENAME_TYPE_DECL_P): Likewise.
	(build_typename_type): Remove declaration.
	(parmlist_is_exprlist): Likewise.
	* decl.c (build_typename_type): Make it static, remove third
	parameter.
	(push_class_binding): Don't do implicit typename stuff.
	(make_typename_type): Likewise.
	(lookup_name_real): Likewise.
	(grokdeclarator): Don't try to convert declarations into
	initializations.  Don't do implicit typename stuff.
	(parmlist_is_exprlist): Remove.
	(xref_basetypes): Simplify.
	* decl2.c (grokfield): Don't try to convert declarations into
	initializations.
	(build_anon_union_vars): Do this while processing templates, too.
	(finish_anon_union): Likewise.
	* error.c (dump_type): Remove implicit typename handling.
	* parser.c (cp_parser_diagnose_invalid_type_name): New method.
	(cp_parser_primary_expression): Correct handling of names not
	found by unqualified name lookup in templates.
	(cp_parser_nested_name_specifier_opt): Avoid checking dependency
	of types when possible.
	(cp_parser_simple_declaration): Complain intelligently about some
	invalid declarations.
	(cp_parser_member_declaration): Likewise.
	(cp_parser_constructor_declarator_p): Don't check when we're in a
	function scope.
	* pt.c (instantiate_class_template): Remove
	PARTIAL_INSTANTIATION_P gunk.
	* search.c (lookup_field_r): Don't build implicit typenames.
	(marked_pushdecls_p): Don't enter dependent base types.
	(unmarked_pushdecls_p): Likewise.
	* semantics.c (begin_class_definition): Remove implicit typename
	stuff.

	* config/locale/gnu/messages_members.h: Use this-> to refer to
	unqualified members of base clasess.
	* config/locale/ieee_1003.1-2001/codecvt_specializations.h: Likewise.
	* include/bits/codecvt.h: Likewise.
	* include/bits/deque.tcc: Likewise.
	* include/bits/fstream.tcc: Likewise.
	* include/bits/istream.tcc: Likewise.
	* include/bits/list.tcc: Likewise.
	* include/bits/locale_facets.h: Likewise.
	* include/bits/ostream.tcc: Likewise.
	* include/bits/sstream.tcc: Likewise.
	* include/bits/stl_bvector.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_tree.h: Likewise.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/vector.tcc: Likewise.
	* include/ext/ropeimpl.h: Likewise.
	* include/ext/stdio_filebuf.h: Likewise.
	* include/ext/stl_rope.h: Likewise.
	* include/std/std_fstream.h: Likewise.
	* include/std/std_sstream.h: Likewise.

Co-Authored-By: Jeffrey Oldham <oldham@codesourcery.com>

From-SVN: r61403
2003-01-16 20:30:50 +00:00
Kaveh R. Ghazi dd1b7476b1 decl2.c (check_classfn): Fix uninitialized warning.
cp:
	* decl2.c (check_classfn): Fix uninitialized warning.
	(build_anon_union_vars): Likewise.
	* pt.c (tsubst_copy): Likewise.

gcc:
	* genattr.c (main): Rearrange output to avoid prototype warning.
	* genautomata.c (transform_3): Fix ambiguous-else warning.
	* local-alloc.c (requires_inout): Add parentheses around
	assignment used as truth-value.
	* timevar.c: Move system includes above local includes.  Include
	toplev.h
	* Makefile.in (timevar.o): Depend on toplev.h.

From-SVN: r61308
2003-01-15 01:21:46 +00:00
Mark Mitchell 2050a1bbac re PR c++/9128 (Typeid does not work on polymorphic classes)
PR c++/9128
	* g++.dg/rtti/typeid1.C: New file.

	PR c++/9153
	* g++.dg/parse/lookup1.C: New file.

	PR c++/9171
	* g++.dg/templ/spec5.C: New file.

	* cp-tree.h (reparse_absdcl_as_expr): Remove.
	(reparse_absdcl_as_casts): Likewise.
	(reparse_decl_as_expr): Likewise.
	(finish_decl_parsing): Likewise.
	* decl2.c (reparse_absdcl_as_expr): Remove.
	(reparse_absdcl_as_casts): Likewise.
	(repase_decl_as_expr): Likewise.
	(finish_decl_parsing): Likewise.

	PR c++/9128
	PR c++/9153
	PR c++/9171
	* parser.c (cp_parser_pre_parsed_nested_name_specifier): New
	function.
	(cp_parser_nested_name_specifier_opt): Correct the
	check_dependency_p false.
	(cp_parser_postfix_expression): Fix formatting.
	(cp_parser_decl_specifier_seq): Avoid looking for constructor
	declarators when possible.
	(cp_parser_template_id): Avoid performing name-lookup when
	possible.
	(cp_parser_class_head): Do not count specializations when counting
	levels of templates.
	(cp_parser_constructor_declarator_p): Return immediately if
	there's no chance that the tokens form a constructor declarator.
	* rtti.c (throw_bad_typeid): Add comment.  Do not return an
	expression with reference type.
	(get_tinfo_decl_dynamic): Do not return an expression with
	reference type.
	(build_typeid): Add comment.  Do not return an expression with
	reference type.
	* typeck.c (build_class_member_access_expr): Improve handling of
	conditionals and comma-expressions as objects.

From-SVN: r61166
2003-01-10 20:30:56 +00:00
Geoffrey Keating 17211ab553 Merge from pch-branch.
From-SVN: r61136
2003-01-10 02:22:34 +00:00
Mark Mitchell c10cdb3d75 re PR c++/9165 (false "defined but not used" warnings)
PR c++/9165
	* decl2.c (build_cleanup): Mark the object as used.

	PR c++/9165
	* g++.dg/warn/Wunused-3.C: New test.

From-SVN: r60972
2003-01-07 02:38:32 +00:00
Mark Mitchell 4c4646b541 * decl2.c (mark_used): Do not synthesize thunks.
From-SVN: r60967
2003-01-07 01:34:37 +00:00
Nathanael Nerode 3fd5abcf46 cvt.c, [...]: This is the C++ front end, not the C front end.
* cvt.c, decl.c, decl2.c: This is the C++ front end, not the C
	front end.

From-SVN: r60861
2003-01-03 23:13:09 +00:00
Jason Merrill 4e8dca1c3a fold-const.c (fold): Avoid NOP_EXPRs better.
* fold-const.c (fold) [COND_EXPR]: Avoid NOP_EXPRs better.

        * integrate.c (copy_decl_for_inlining): Don't clear the rtl for
        static/external decls.
cp/
        * call.c (build_conditional_expr): Stabilize lvalues properly.
        * cvt.c (ocp_convert): Don't build NOP_EXPRs of class type.
        * tree.c (lvalue_p_1): Don't allow sloppy NOP_EXPRs as lvalues.
        Don't allow CALL_EXPR or VA_ARG_EXPR, either.

        * call.c (convert_like_real): Call decl_constant_value for an
        IDENTITY_CONV even if there are no more conversions.

        * cvt.c (build_up_reference): Don't push unnamed temps.

        * decl2.c (do_namespace_alias): Namespace aliases are DECL_EXTERNAL.

        * dump.c (cp_dump_tree): Don't try to dump class-specific fields
        for a backend struct.

        * except.c (wrap_cleanups_r, build_throw): Make
        MUST_NOT_THROW_EXPRs void.
        * init.c (expand_default_init): Update to handle MUST_NOT_THROW_EXPR.

        * init.c (build_vec_delete_1): Pre-evaluate the base address.

        * init.c (get_temp_regvar): Simplify logic.

        * tree.c (cp_copy_res_decl_for_inlining): Only do debug tweaks if
        our replacement is a decl.

From-SVN: r60851
2003-01-03 15:04:38 -05:00
Matt Austern 9aad8f83a8 cp-tree.h (struct lang_type_class): add field for key method
* cp-tree.h (struct lang_type_class): add field for key method
        (cp_global_trees): rename dynamic_classes to keyed_classes
        (key_method): add definition
        * class.c (finish_struct_1): compute class's key method, and add
        the class to keyed_classes list if there is no key method.
        * decl.c (finish_function): add class to keyed_classes list if we
        see a definition of the class's key method.
        * pt.c (instantiate_class_template): add template specialization
        of a dynamic class to keyed_classes list.
        * decl2.c (key_method): remove
        (finish_file): iterate only through keyed_classes list when
        deciding whether to emit vtables, remove class from its list after
        we do the emission.

From-SVN: r60850
2003-01-03 19:48:55 +00:00
Nathan Sidwell 3cfabe60d4 class.c (modify_vtable_entry): Remove unused variable.
cp:
	* class.c (modify_vtable_entry): Remove unused variable.
	(get_vcall_index): Always expect a non-thunk.
	(update_vtable_entry_for_fn): Combine covariant adjustments, when
	overriding a thunk. Pass get_vcall_index a non-thunk.

	* decl2.c (finish_file): Mark undefined inlines as extern.
testsuite:
	* g++.dg/inherit/covariant8.C: New test.

From-SVN: r60710
2002-12-31 19:43:16 +00:00
Mark Mitchell afd9b9dd9d parse.y: Remove.
* parse.y: Remove.
	* spew.c: Likewise.
	* Make-lang.in (gt-cp-spew.h): Remove.
	* cp-tree.h (do_pending_lang_change): Remove.
	(do_identifier): Change prototype.
	(finish_id_expr): Remove.
	* decl.c (lookup_name_real): Remove yylex variable.
	* decl2.c (build_expr_from_tree): Adjust call to do_identifier.
	* lex.c (init_cpp_parse): Remove.
	(reduce_cmp): Likewise.
	(token_cmp): Likewise.
	(yychar): Likewise.
	(lastiddecl): Likewise.
	(token_count): Likewise.
	(reduce_count): Likewise.
	(yyhook): Likewise.
	(print_parse_statistics): Likewise.
	(do_pending_lang_change): Likewise.
	(do_identifier): Remove parsing parameter.
	* lex.h (lastiddecl): Remove.
	(looking_for_typename): Remove.
	(looking_for_template): Likewise.
	(pending_lang_change): Likewise.
	(yylex): Likewise.
	* semantics.c (finish_id_expr): Remove.

From-SVN: r60642
2002-12-30 19:02:11 +00:00
Nathanael Nerode 1c3139456d decl.c, [...]: GCC, not GNU CC.
* decl.c, decl2.c, decl.h:  GCC, not GNU CC.  This is the C++ front
	end, not the C front end.

From-SVN: r60636
2002-12-30 16:25:45 +00:00
Gabriel Dos Reis 848eed9249 Remove traditional C constructs 4/n.
* decl2.c (grok_method_quals, warn_if_unknown_interface,
	grok_x_components, cp_build_parm_decl, build_artificial_parm,
	maybe_retrofit_in_chrg, grokclassfn, grok_array_decl,
	delete_sanity, check_member_template, check_java_method,
	check_classfn, finish_static_data_member_decl, grokfield,
	grokbitfield, grokoptypename, grok_function_init,
	cplus_decl_attributes, constructor_name, defer_fn,
	build_anon_union_vars, finish_anon_union, coerce_new_type,
	coerce_delete_type, comdat_linkage, maybe_make_one_only,
	key_method, import_export_vtable, import_export_class,
	output_vtable_inherit, import_export_decl, import_export_tinfo,
	build_cleanup, get_guard, get_guard_bits, get_guard_cond,
	set_guard, start_objects, finish_objects,
	start_static_storage_duration_function,
	finish_static_storage_duration_function, get_priority_info,
	start_static_initialization_or_destruction,
	finish_static_initialization_or_destruction,
	do_static_initialization, do_static_destruction,
	prune_vars_needing_no_initialization, write_out_vars,
	reparse_decl_as_expr, finish_decl_parsing, namespace_ancestor,
	add_using_namespace, merge_functions, ambiguous_decl,
	lookup_using_namespace, lookup_using_namespace,
	qualified_lookup_using_namespace, set_decl_namespace,
	decl_namespace, current_decl_namespace, push_decl_namespace,
	pop_decl_namespace, push_scope, pop_scope, add_function,
	arg_assoc_namespace, arg_assoc_template_arg, arg_assoc,
	lookup_arg_dependent, do_namespace_alias,
	validate_nonmember_using_decl, do_nonmember_using_decl,
	do_toplevel_using_decl, do_local_using_decl,
	do_class_using_decl, do_using_directive, check_default_args,
	mark_used, handle_class_head): Use C90 prototypings.  Use booleans.
	* parser.c (cp_parser_class_head): Use booleanss.
	* decl.c (walk_globals, walk_vtables): Likewise.
	* cp-tree.h (walk_globals_pred, walk_globals_fn, walk_vtables,
	walk_globals): Change return type from 'int' to 'bool'.
	* rtti.c (init_rtti_processing, build_headof, throw_bad_cast
	throw_bad_typeid, get_tinfo_decl_dynamic, typeid_ok_p,
	build_typeid, tinfo_name, get_tinfo_decl, get_tinfo_ptr,
	get_typeid, ifnonnull, build_dynamic_cast_1, build_dynamic_cast,
	qualifier_flags, tinfo_base_init, generic_initializer,
	ptr_initializer, dfs_class_hint_mark, ptm_initializer,
	dfs_class_hint_unmark, class_hint_flags, class_initializer,
	typeinfo_in_lib_p, get_pseudo_ti_init, create_pseudo_type_info,
	get_pseudo_ti_desc, create_tinfo_types, emit_support_tinfos,
	unemitted_tinfo_decl_p, emit_tinfo_decl): Likewise.
	* repo.c (repo_compile_flags, repo_template_declared,
	repo_template_defined, repo_class_defined, repo_get_id,
	repo_template_used, repo_vtable_used, repo_inline_used,
	repo_tinfo_used, repo_template_instantiated, extract_string,
	open_repo_file, afgets, init_repo, reopen_repo_file_for_write,
	finish_repo): Likewise.
	* ptree.c (cxx_print_decl, cxx_print_type, cxx_print_identifier,
	cxx_print_xnode): Likewise..
	* cp-lang.c (ok_to_generate_alias_set_for_type, cxx_get_alias_set,
	cxx_warn_unused_global_decl, cp_expr_size): Likewise.
	* cxxfilt.c (demangle_it, print_demangler_list, usage,
	standard_symbol_characters, hp_symbol_characters, main, fatal):
	Likewise.
	(strip_underscore):  Change type from 'int' to 'bool'.
	(main): Use boolean constants.

From-SVN: r60601
2002-12-29 14:53:05 +00:00
Gabriel Dos Reis b746c5dc67 Remove traditional C constructs 3/n.
* cvt.c (cp_convert_to_pointer, convert_to_pointer_force,
	build_up_reference, warn_ref_binding, convert_to_reference,
	convert_from_reference, convert_lvalue, cp_convert, ocp_convert,
	convert_to_void, convert, convert_force, build_type_conversion,
	build_expr_type_conversion, type_promotes_to,
	perform_qualification_conversions): Use C90 prototyping style.
	* decl2.c (grok_array_decl): Use boolean constant.
	(delete_sanity): Likewise.
	* typeck.c (build_unary_op): Likewise.
	* semantics.c (finish_switch_cond): Likewise.
	* parser.c (cp_parser_direct_new_declarator): Likewise.
	* init.c (build_new): Likewise.

From-SVN: r60574
2002-12-28 14:38:38 +00:00
Mark Mitchell a723baf1eb Make-lang.in (po-generated): Remove parse.c.
* Make-lang.in (po-generated): Remove parse.c.
	(CXX_OBJS): Remove parse.o and spew.o.  Add parser.o.
	($(srcdir)/cp/parse.h): Remove target.
	($(srcdir)/cp/parse.c): Likewise.
	(gt-cp-parse.h): Likewise.
	(gt-cp-parser.h): New target.
	(c++.distclean): Do not remove parse.output.
	(c++.maintainer-clean): Do not remove parse.c or parse.h.
	(cp/spew.o): Remove target.
	(cp/lex.o): Adjust dependencies.
	(cp/pt.o): Likewise.
	(cp/parse.o): Likewise.
	(cp/TAGS): Do not mention parse.c.
	(cp/parser.o): New target.
	* NEWS: Mention the new parser.
	* call.c (build_scoped_method_call): Simplify.
	(build_method_call): Likewise.
	(build_new_function_call): Adjust calls to add_function_candidate
	and add_template_candidate.
	(build_new_op): Improve handling of erroroneous operands.
	(convert_default_arg): Remove circular argument processing.
	(name_as_c_string): New function.
	(build_new_method_call): Use it.
	(perform_implicit_conversion): Use error_operand_p.
	* class.c (finish_struct_anon): Use constructor_name_p.
	(check_field_decls): Likewise.
	(pop_nested_class): Use OVL_NEXT, not OVL_CHAIN.
	(resolve_address_of_overloaded_function): Likewise.
	(instantiate_type): Tweak pointer-to-member handling.
	(get_primary_binfo): Remove incorrect assertion.
	* config-lang.in (gtfiles): Add parser.c, remove parse.c.
	* cp-tree.h (DEFARG_TOKENS): New macro.
	(default_arg): New structure.
	(cp_tree_node_structure_enum): Add TS_CP_DEFAULT_ARG.
	(lang_tree_node): Add default_arg.
	(cp_tree_index): Add CPTI_TYPE_INFO_REF_TYPE.
	(type_info_ref_type): New macro.
	(saved_scope): Make processing_explicit_instantiation a boolean.
	(check_access): New field.
	(unparsed_text): Remove.
	(language_function): Remove unparsed_inlines.
	(error_operand_p): New macro.
	(lang_decl): Adjust pending_inline_info.
	(DEFARG_POINTER): Remove.
	(tag_types): Add typenames.
	(lookup_ualified_name): Declare.
	(lookup_name_real): Likewise.
	(shadow_tag): Adjust prototype.
	(get_scope_of_declarator): Declare it.
	(process_next_inline): Remove it.
	(check_for_missing_semicolon): Likewise.
	(maybe_get_template_decl_from_type_decl): Declare it.
	(finish_label_stmt): Adjust prototype.
	(finish_non_static_data_meber): Declare it.
	(finish_pseudo_destructor_call_expr): Rename to ...
	(finish_pseudo_destructor_expr): ... this.
	(finish_compound_literal): Declare it.
	(begin_inline_definitions): Remove it.
	(init_spew): Remove.
	(peekyylex): Likewise.
	(arbitrate_lookup): Likewise.
	(frob_opname): Likewise.
	(maybe_snarf_defarg): Likewise.
	(add_defarg_fn): Likewise.
	(do_pending_defargs): Likewise.
	(done_pending_defargs): Likewise.
	(unprocessed_defarg_fn): Likewise.
	(replace_defarg): Likewise.
	(end_input): Likewise.
	(get_overloaded_fn): Likewise.
	* cvt.c (convert_to_reference): Improve error handling.
	* decl.c (lookup_name_real): Do not declare it static.
	(maybe_push_to_top_level): Set check_access.
	(identifier_type_value): Adjust call to lookup_name_real.
	(lookup_qualified_name): New method.
	(lookup_name_real): Remove special-case parsing code.
	(lookup_name-nonclass): Adjust call to lookup_name_real.
	(lookup_name_namespace_only): Likewise.
	(lookup_name): Likewise.
	(check_tag_decl): Return the type declared.
	(shadow_tag): Likewise.
	(register_dtor_fn): Tweak check_access.
	(grokfndecl): Use constructor_name_p.
	(get_scope_of_declarator): New function.
	(grokdeclarator): Obscure tweaks for slightly different declarator
	representations.
	(start_method): Return error_mark_node to indicate failure.
	(cp_tree_node_structure_enum): Use TS_CP_DEFAULT_ARG for DEFAULT_ARGs.
	* decl2.c (constructor_name_full): Simplify.
	(constructor_name): Use it.
	(build_expr_from_tree): Adjust for changes to do new parser.
	(push_scope): Improve robustness.
	(validate_nonmember_using_decl): Process declarations, not names.
	(do_class_using_decl): Likewise.
	(handle_class_head): Do not mess with CLASSTYPE_DECLARED_CLASS
	here.
	* error.c (dump_expr): Handle IDENTIFIER_NODEs and BASELINKs.
	* expr.c (cxx_expand_expr): Handle BASELINKs.
	* init.c (member_init_ok_or_else): Issue more errors.
	(build_offset_ref): Tweak handling of FUNCTION_DECLs.
	* lex.c: Do not include parse.h.
	(yypring): Do not declare.
	(yylval): Likewise.
	(make_reference_declarator): Remove error-generating code.
	(rid_to_yy): Remove.
	(cxx_init): Do not call init_spew.
	(yypring): Remove.
	(check_for_missing_semicolon): Remove.
	* lex.h (got_scope): Remove.
	(got_object): Remove.
	* method.c (hack_identifier): Use finish_non_static_data_member.
	(implicitly_declare_fn): Adjust use of constructor_name.
	* parser.c: New file.
	* pt.c (parse.h): Do not include it.
	(maybe_get_template_decl_from_template): Do not declare it.
	(finish_member_template_decl): Tweak.
	(begin_explicit_instantiation): Adjust for
	processing_explicit_instantiation being boolean.
	(end_explicit_instantiation): Likewise.
	(maybe_process_partial_specialization): Tighten specialization
	test.
	(retrieve_local_specialization): Adjust ue of hash table.
	(eq_local_specializations): New function.
	(register_local_specialization): Likewise.
	(push_template_decl_real): Remove unnecessary test.
	(maybe_get_template_decl_from_type_decl): Don't make it static.
	(for_each_template_parm_r): Handle TYPEOF_TYPE.
	(tsubst_copy): Use retrieive_local_specialization to handle
	PARM_DECL.  Adjust handling of CONST_DECLs.  Handle BASELINKs.
	Handle COMPONENT_REFs with pseudo-destructor-expressions.
	Simplify handling of CALL_EXPR and METHOD_CALL_EXPR.
	(tsubst_expr): Pass decls, not names, to do_local_using_decl.
	(unify): Tweak handling of CONST_DECLs.
	(regenerate_decl_from_template): Use push_nested_class.
	(template_for_substitution): New funciton.
	(instantiate_decl): Use it.  Register parameters as local
	specializations.
	* rtti.c (init_rtti_processing): Set type_info_ref_type.
	(build_typeid): Use it.
	(get_typeid): Likeise.
	* search.c (accessible_p): Use check_access, not
	flag_access_control.
	(adjust_result_of_qualified_name_lookup): Pay attention to the
	context_class.
	* semantics.c (finish_asm_stmt): Adjust error handling.
	(finish_label_stmt): Return the statement.
	(finish_non_static_data_member): New function.
	(finish_class_expr): Handle BASELINKs.
	(finish_call_expr): Handle PSEUDO_DTOR_EXPR.
	(finish_object_call_expr): Simplify handling during templates.
	(finish_pseudo_destructor_call_expr): Rename to ...
	(finish_pseudo_dtor_expr): ... this.
	(finish_compound_literal): New function.
	(begin_inline_definitions): Remove.
	(finish_sizeof): Remove special template handling.
	* spew.c: Do not include parse.h.
	* tree.c (get_overloaded_fn): Remove.
	* typeck.c (build_class_member_access_expr): Handle
	PSEUDO_DTOR_EXPR.  Adjust handling of static member functions.
	(lookup_destructor): New function.
	(finish_class_member_access_expr): Use it.
	(convert_arguments): Simplify.
	(build_unary_op): Handle BASELINKs.

From-SVN: r60560
2002-12-28 08:03:42 +00:00
Nathan Sidwell eab5474f6d re PR c++/4803 (Inline function never defined)
cp:
	PR c++/4803
	* decl2.c (mark_used): Defer inline functions.
	(finish_file): Merge deferred_fns loops. Check all used
	inline functions have a definition.
	* method.c (make_thunk): Thunks are not inline.
testsuite:
	* g++.dg/warn/inline1.C: New test.
	* g++.old-deja/g++.brendan/crash64.C: Remove spurious inlines.
	* g++.old-deja/g++.jason/synth10.C: Likewise.
	* g++.old-deja/g++.mike/net31.C: Likewise.
	* g++.old-deja/g++.mike/p8786.C: Likewise.

From-SVN: r60521
2002-12-26 18:20:14 +00:00
Nathan Sidwell 3e14cd301c re PR c++/7964 (ICE in build_base_path)
cp:
	PR C++/7964
	* cp-tree.h (resolve_scoped_fn_name): Prototype.
	* call.c (resolve_scoped_fn_name): New function. Deal with
	more template expansion. Broken out of ...
	* parse.y (parse_finish_call_expr): ... here. Call it.
	* decl2.c (build_expr_from_tree, CALL_EXPR): Use
	resolve_scoped_fn_name and build_call_from_tree.
testsuite:
	* g++.dg/lookup/scoped3.C: New test.

From-SVN: r60483
2002-12-24 22:20:14 +00:00
Nathan Sidwell b9201622ae re PR c++/9053 (g++ confused about ambiguity of overloaded function templates)
cp:
        PR c++/9053
        * decl.c (duplicate_decls): Templates may be disambiguated by
        return type.

        PR c++/8702
        * decl2.c (check_classfn): Use lookup_fnfield_1. List all
        conversion operators on failure.
testsuite
        * g++.dg/lookup/decl1.C: New test.
        * g++.dg/lookup/decl2.C: New test.

From-SVN: r60482
2002-12-24 22:12:17 +00:00
Nathan Sidwell 081cebb27a re PR c++/8572 (ICE with external definition of conversion operator to internal class within template class)
cp:
	PR c++/8572
	* cp-tree.h (grokoptypename): Add SCOPE parameter.
	* decl2.c (grokoptypename): Add SCOPE parameter. tsubst the type
	if in a template scope.
	* parse.y (unoperator): Return the scope.
	(operator_name): Adjust grokoptypename call.
testsuite:
	* g++.dg/parse/conv_op1.C: New test.

From-SVN: r60416
2002-12-22 21:32:28 +00:00
Jason Merrill 0ca7178c84 Handle anonymous unions at the tree level.
C++ ABI change: Mangle anonymous unions using the name of their
        first named field (by depth-first search).  Should not cause
        binary compatibility problems, though, as the compiler previously
        didn't emit anything for affected unions.
        * cp-tree.def (ALIAS_DECL): New tree code.
        * decl2.c (build_anon_union_vars): Build ALIAS_DECLs.  Return the
        first field, not the largest.
        (finish_anon_union): Don't mess with RTL.  Do set DECL_ASSEMBLER_NAME,
        push the decl, and write it out at namespace scope.
        * decl.c (lookup_name_real): See through an ALIAS_DECL.
        (pushdecl): Add namespace bindings for ALIAS_DECLs.
        * rtti.c (unemitted_tinfo_decl_p): Don't try to look at the name
        of a decl which doesn't have one.
        * typeck.c (build_class_member_access_expr): Don't recurse if
        we already have the type we want.

From-SVN: r60314
2002-12-19 12:16:26 -05:00
Zack Weinberg 4977bab6ed Merge basic-improvements-branch to trunk
From-SVN: r60174
2002-12-16 18:23:00 +00:00