Commit Graph

647 Commits

Author SHA1 Message Date
Nathan Sidwell
96a1e32dcd call.c (convert_default_arg): Check for unprocessed DEFAULT_ARG.
cp:
	* call.c (convert_default_arg): Check for unprocessed
	DEFAULT_ARG.
	* cp-tree.h (replace_defarg): Move to spew.c.
	(maybe_snarf_defarg, add_defarg_fn, do_pending_defargs): Move to
	spew.c, which is where they really are.
	(done_pending_defargs): Declare.
	(unprocessed_defarg_fn): Declare.
	* decl.c (replace_defarg): Move to spew.c
	* parse.y (structsp): Call done_pending_defargs.
	* spew.c (defarg_fns): Rearrange list structure.
	(defarg_fnsdone): New static variable.
	(defarg_depfns): New static variable.
	(init_spew): Adjust.
	(add_defarg_fn): Store the type in TREE_TYPE.
	(do_pending_defargs): Detect and deal with ordering constraints
	and circularity.
	(done_pending_defargs): New function.
	(unprocessed_defarg_fn): New function.
	(replace_defarg): Moved from decl.c. Robustify. Don't save
	if circularity detected.
testsuite:
	* g++.old-deja/g++.other/defarg7.C: New test.
	* g++.old-deja/g++.other/defarg8.C: New test.

From-SVN: r38903
2001-01-11 12:29:20 +00:00
Mark Mitchell
cbd5937a3d c-common.h (CTI_VOID_LIST): Remove.
* c-common.h (CTI_VOID_LIST): Remove.
	(void_list_node): Likewise.
	* tree.h (TI_VOID_LIST_NODE): New enumeral.
	(void_list_node): New macro.
	* config/arm/arm.c (arm_init_builtins): Use void_list_node.
	* config/i386/i386.c (ix86_init_builtins): Likewise.
	* config/ia64a/ia64.c (ia64_init_builtins): Likewise.

	* class.c (finish_struct_1):  Remove last argument in call to
	make_decl_rtl; use make_function_rtl instead of make_decl_rtl.
	* decl.c (builtin_function): Likewise.
	(build_cp_library_fn): Likewise.
	(check_initializer): Likewise.
	(make_rtl_for_nonlocal_decl): Likewise.
	(cp_finish_decl): Likewise.
	(start_function): Likewise.
	* decl2.c (finish_anon_union): Likewise.
	* friend.c (do_friend): Likewise.
	* init.c (build_java_class_ref): Likewise.
	* method.c (make_thunk): Likewise.
	* pt.c (tsubst_friend_function): Likewise.
	* semantics.c (expand_body): Likewise.

From-SVN: r38887
2001-01-11 00:08:45 +00:00
Mark Mitchell
31d95fc6e6 cp-tree.h (DECL_CLONED_FUNCTION_P): Avoid wild reads by not looking at DECL_CLONED_FUNCTION for non-functions.
* cp-tree.h (DECL_CLONED_FUNCTION_P): Avoid wild reads by not
	looking at DECL_CLONED_FUNCTION for non-functions.

From-SVN: r38876
2001-01-10 19:55:03 +00:00
Joseph Myers
a7537031e6 invoke.texi: Document that -fcond-mismatch isn't supported for C++.
* invoke.texi: Document that -fcond-mismatch isn't supported for
	C++.

cp:
	* cp-tree.h (flag_cond_mismatch): Don't declare.
	* decl2.c (flag_cond_mismatch): Don't define.
	(lang_f_options): Remove cond-mismatch.
	(unsupported_options): Add cond-mismatch.

From-SVN: r38864
2001-01-10 10:57:17 +00:00
Neil Booth
ee811cfdfa c-lang.c (lang_hooks): Update.
* c-lang.c (lang_hooks): Update.
        (lang_decode_option): Remove.
        (lang_init_options): Rename c_init_options.
        * toplev.c (main): Use lang_hooks for lang_init_options
        and lang_decode_option.
        * toplev.h (lang_hooks): Add 2 new hooks.
        * tree.h: Remove lang_init_options and lang_decode_option.
        * cp/cp-tree.h (lang_decode_option): Rename cxx_decode_option.
        * cp/decl2.c: Similarly.
        * cp/lex.c (lang_init_options): Rename cxx_init_options.
        (lang_hooks): Update.
        * f/com.c (f_init, f_finish): Rename ffe_init, ffe_finish
        for consistency.
        (lang_init_options): Rename ffe_init_options.
        (lang_hooks): Update.
        (lang_decode_option): Remove.
        * java/lang.c (lang_init_options): Rename java_init_options.
        (lang_decode_option): Rename java_decode_option.
        (lang_hooks): Update.
        * objc/objc-act.c (lang_init_options): Rename objc_init_options.
        (lang_decode_option): Rename objc_decode_option.
        (lang_hooks): Update.

From-SVN: r38856
2001-01-10 07:51:11 +00:00
Neil Booth
13c61421ff c-lang.c (lang_hooks): Update.
* c-lang.c (lang_hooks): Update.
        (lang_init): Rename c_init.
        (lang_finish): Remove.
        * toplev.c (compile_file): Use lang_hooks for lang_init ()
        and lang_finish ().
        * toplev.h (lang_hooks): Add init () and finish ().
        * tree.h (lang_init, lang_finish): Remove.
        * cp/tree.h (lang_init, lang_finish): Remove.
        * cp/decl2.c (cxx_post_options, lang_hooks): Move to cp/lex.c.
        * cp/lex.c (cxx_init, cxx_finish, cxx_post_options,
        lang_hooks): New.
        (lang_init, lang_finish): Remove.
        * f/com.c (lang_init, lang_finish): Rename f_init, f_finish.
        (lang_hooks): Update.
        * java/lang.c (lang_init): Rename java_init.
        (lang_finish): Remove.
        (lang_hooks): Update.
        * objc/objc-act.c (lang_init): Rename objc_init.
        (lang_finish): Remove.
        (lang_hoooks): Update.

From-SVN: r38828
2001-01-09 10:54:01 +00:00
Nathan Sidwell
3febd12318 cp-tree.h (lang_decl_flags): Rename defined_in_class to initialized_in_class.
cp:
	* cp-tree.h (lang_decl_flags): Rename defined_in_class to
	initialized_in_class.
	(DECL_DEFINED_IN_CLASS_P): Rename to ...
	(DECL_INITIALIZED_IN_CLASS_P): ... here, to reflect true meaning.
	* decl.c (duplicate_decls): Preseve DECL_INITIALIZED_IN_CLASS_P.
	(cp_finish_decl): Adjust for DECL_INITIALIZED_IN_CLASS_P.
	* pt.c (check_default_tmpl_args): Adjust for
	DECL_INITIALIZED_IN_CLASS_P.
	(instantiate_class_template): Likewise.
	(instantiate_decl): Check DECL_INITIALIZED_IN_CLASS_P.

	* class.c (finish_struct): Constify saved_filename.
testsuite:
	* g++.old_deja/g++.pt/instantiate12.C: New test.

From-SVN: r38801
2001-01-08 14:41:03 +00:00
Joseph Myers
eaa7c03f50 c-common.c (SIZE_TYPE, WCHAR_TYPE): Define.
* c-common.c (SIZE_TYPE, WCHAR_TYPE): Define.
	(flag_short_double, flag_short_wchar): Define.
	(c_common_nodes_and_builtins): Create many tree nodes shared
	between C and C++ here instead of in cp/decl.c and ...
	* c-decl.c (init_decl_processing): ... here.
	(SIZE_TYPE, WCHAR_TYPE): Don't define.
	(flag_short_double, flag_short_wchar): Don't define.
	(record_builtin_type): New function.
	(build_void_list_node): New function.
	* c-common.h (flag_short_double, flag_short_wchar,
	record_builtin_type, build_void_list_node): Declare.

cp:
	* decl.c (SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE): Don't define.
	(record_builtin_type): Make non-static.
	(flag_short_double): Don't declare.
	(init_decl_processing): Remove the creation of many tree nodes now
	in c_common_nodes_and_builtins.
	(build_void_list_node): New function.
	* decl2.c (flag_short_double, flag_short_wchar): Don't define.
	* cp-tree.h (flag_short_wchar): Don't declare.

From-SVN: r38695
2001-01-04 23:53:54 +00:00
Nathan Sidwell
03378143ac Implement exceptions specifiers for implicit member functions.
cp:
	Implement exceptions specifiers for implicit member functions.
	* cp-tree.h (merge_exceptions_specifiers): Declare new function.
	* method.c (synthesize_exception_spec): New function.
	(locate_dtor, locate_ctor, locate_copy): New functions.
	(implicitly_declare_fn): Generate the exception spec too.
	* search.c (check_final_overrider): Check artificial functions
	too.
	* typeck2.c (merge_exception_specifiers): New function.
testsuite:
	* g++.old-deja/g++.eh/spec6.C: Remove remaining XFAIL.

From-SVN: r38659
2001-01-03 14:39:10 +00:00
Jason Merrill
f30efcb78a init.c (build_default_init): New fn.
* init.c (build_default_init): New fn.
        (perform_member_init): Split out from here.
        (build_new_1): Use it.  Simplify initialization logic.
        (build_vec_init): Take an array, rather than a pointer and maxindex.
        Speed up simple initializations.  Don't clean up if we're assigning.
        * cp-tree.h: Adjust.
        * decl2.c (do_static_initialization): Remove TREE_VEC case.
        * parse.y (new_initializer): Return void_zero_node for ().
        * typeck.c (build_modify_expr): Handle getting a CONSTRUCTOR.
        * typeck2.c (digest_init): Only complain about user-written
        CONSTRUCTORs.

From-SVN: r38643
2001-01-02 22:28:51 -05:00
Mark Mitchell
4890c2f43c class.c (invalidate_class_lookup_cache): Zero the previous_class_values.
* class.c (invalidate_class_lookup_cache): Zero the
	previous_class_values.
	* cp-tree.h (TMPL_PARMS_DEPTH): Use TREE_INT_CST_LOW, not
	TREE_INT_CST_HIGH.
	(CLASSTYPE_TEMPLATE_LEVEL): Likewise.
	* decl.c (free_bindings): New variable.
	(push_binding): Don't create a new binding if we have one on the
	free list.
	(pop_binding): Put old bindings on the free list.
	(init_decl_processing): Use size_int, not build_int_2.
	Register free_bindings as a GC root.
	(cp_make_fname_decl): Use size_int, not build_int_2.
	(push_inline_template_parms_recursive): Likewise.
	(end_template_parm_list): Likewise.
	(for_each_tempalte_parm): Do not use walk_tree_without_duplicates.
	(tsubst_template_parms): Use size_int, not build_int_2.
	(tsubst): Likewise.
	* rtti.c (get_vmi_pseudo_type_info): Likewise.

From-SVN: r38641
2001-01-03 00:24:04 +00:00
Jason Merrill
96d6c6107a tree.c (cp_valid_lang_attribute): Don't set CLASSTYPE_COM_INTERFACE for v3 ABI.
* tree.c (cp_valid_lang_attribute): Don't set CLASSTYPE_COM_INTERFACE
        for v3 ABI.

        * typeck.c (cp_truthvalue_conversion): New fn.
        * cvt.c (ocp_convert): Use it.

        * cp-tree.h: Lose c-common.c decls.

        * typeck.c (build_unary_op): Restore old &a.f diagnostic code.
        * cvt.c (convert_to_void): Use type_unknown_p.

From-SVN: r38636
2001-01-02 14:48:02 -05:00
Mark Mitchell
31a714f6d8 class.c (pushclass): Remove #if 0'd code.
* class.c (pushclass): Remove #if 0'd code.
	* cp-tree.h (overload_template_name): Remove.
	* decl.c (store_bindings): Simplify.
	(pop_from_top_level): Likewise.
	* pt.c (overload_template_name): Remove.
	(instantiate_decl): Don't call push_to_top_level if it's not
	needed.

From-SVN: r38530
2000-12-29 09:20:46 +00:00
Jason Merrill
8230f5e236 oops
From-SVN: r38465
2000-12-22 12:05:50 -05:00
Jason Merrill
477f6664a4 pt.c (tsubst_decl): A FUNCTION_DECL has DECL_RESULT, not DECL_TEMPLATE_RESULT.
* pt.c (tsubst_decl): A FUNCTION_DECL has DECL_RESULT, not
        DECL_TEMPLATE_RESULT.

        * search.c (lookup_field_r): Call lookup_fnfields_1, not
        lookup_fnfields_here.

        * parse.y (typename_sub2): Return the TYPE_DECL, not the type.

        * call.c (build_object_call): Also allow conversions that return
        reference to pointer to function.
        (add_conv_candidate): Handle totype being ref to ptr to fn.
        (build_field_call): Also allow members of type reference to function.
        Lose support for calling pointer to METHOD_TYPE fields.

        * error.c (dump_expr): Handle *_CAST_EXPR.

        * typeck2.c (build_scoped_ref): Always convert to the naming class.

        * tree.c (break_out_cleanups): Lose.
        * cp-tree.h: Remove prototype.
        * typeck.c (build_component_ref): Don't break_out_cleanups.
        (build_compound_expr): Likewise.
        * semantics.c (finish_expr_stmt): Likewise.

From-SVN: r38417
2000-12-21 12:50:10 -05:00
Richard Henderson
3e4d04a1ba cp-tree.h: Update declarations.
* cp-tree.h: Update declarations.
        * decl.c (finish_case_label): Return the new stmt node.
        * semantics.c (finish_goto_stmt): Likewise.
        (finish_expr_stmt, finish_return_stmt): Likewise.
        (finish_break_stmt, finish_continue_stmt): Likewise.
        (finish_asm_stmt): Likewise.
        * parse.y (already_scoped_stmt): Set STMT_LINENO.
        (compstmt, implicitly_scoped_stmt, stmt): Likewise.
        (simple_if, simple_stmt): Return the new stmt node.
        (save_lineno): New.

From-SVN: r38401
2000-12-20 10:16:47 -08:00
Joseph Myers
20d380b15d c-common.c (STD_C9L, ADJ_STD): Define.
* c-common.c (STD_C9L, ADJ_STD): Define.
	(printf_length_specs, scanf_length_specs): Mark "ll" as standard
	STD_C9L.
	(T99_LL): Rename to T9L_LL.
	(T99_ULL): Rename to T9L_ULL.
	(print_char_table, scan_char_table): Use T9L_LL and T9L_ULL
	instead of T99_LL and T99_ULL.
	(check_format_info_main): Use ADJ_STD on all format standard
	versions being compared.
	* c-common.h: Declare warn_long_long.
	* c-tree.h: Don't declare warn_long_long.

cp:
	* cp-tree.h: Don't declare warn_long_long.

testsuite:
	* gcc.dg/format-warnll-1.c: New test.

From-SVN: r38369
2000-12-18 23:50:58 +00:00
Nathan Sidwell
a11d04b523 cp-tree.h (sufficient_parms_p): Declare new function.
* cp-tree.h (sufficient_parms_p): Declare new function.
	* call.c (sufficient_parms_p): New function, broken out of ...
	(add_function_candidate): ... here. Use it.
	(add_conv_candidate): Use it.
	* decl.c (grok_ctor_properties): Use it.

From-SVN: r38111
2000-12-07 14:17:53 +00:00
Nathan Sidwell
cbb409451b cp-tree.h (IDENTIFIER_VIRTUAL_P): Document.
cp:
	* cp-tree.h (IDENTIFIER_VIRTUAL_P): Document.
	(get_matching_virtual): Remove.
	(look_for_overrides): Declare new function.
	* decl.c (grokfndecl): Don't set IDENTIFIER_VIRTUAL_P or
	DECL_VINDEX here.
	* class.c (check_for_override): Move base class iteration code
	to look_for_overrides.
	* search.c (next_baselink): Remove.
	(get_virtuals_named_this): Remove.
	(get_virtual_destructor): Remove.
	(tree_has_any_destructors_p): Remove.
	(struct gvnt_info): Remove.
	(check_final_overrider): Remove `virtual' from error messages.
	(get_matching_virtuals): Remove. Move functionality to ...
	(look_for_overrides): ... here, and ...
	(look_for_overrides_r): ... here. Set DECL_VIRTUAL_P, if found
	to be overriding.
testsuite:
	* g++.old-deja/g++.h/spec6.C: Remove some of the XFAILS.
	* g++.old-deja/g++.other/virtual10.C: New test.

From-SVN: r38040
2000-12-05 15:50:06 +00:00
Nathan Sidwell
76e57b4589 decl.c (grokfndecl): Undo COMPONENT_REF damage caused by bison parser ickiness.
cp:
	* decl.c (grokfndecl): Undo COMPONENT_REF damage caused by
	bison parser ickiness.
	* pt.c (tsubst_friend_function): Enter namespace scope when
	tsubsting the function name.
	* cp-tree.h (DECL_TI_TEMPLATE): Update comment to reflect reality.
testsuite:
	* g++.old-deja/g++.other/friend46.C: New test.

From-SVN: r37793
2000-11-27 12:53:38 +00:00
Nathan Sidwell
f98251686f cp-tree.h (binfo_from_vbase): Return the virtual base's binfo.
cp:
	* cp-tree.h (binfo_from_vbase): Return the virtual base's binfo.
	* cvt.c (cp_convert_to_pointer): Add force parameter.
	Allow conversions via virtual base if forced.
	(convert_to_pointer_force): Adjust call to cp_convert_to_pointer.
	(ocp_convert): Likewise.
	* search.c (binfo_from_vbase): Return the virtual base's binfo.
	* typeck.c (get_delta_difference): Adjust handling of virtual
	bases.
testsuite:
	* g++.old-deja/g++.other/ptrmem8.C: New test.

From-SVN: r37791
2000-11-27 10:55:32 +00:00
Neil Booth
a32f2771a5 c-common.c: Remove USE_CPPLIB conditional inclusions.
* c-common.c: Remove USE_CPPLIB conditional inclusions.
        * c-common.h: Similarly.
        * c-decl.c: Similarly.
        * c-lang.c: Similarly.
        * c-lex.c: Similarly.
        * c-parse.in: Similarly.
        * c-pragma.c: Similarly.
        * c-pragma.h: Similarly.
        * gcc.c: Similarly.
        * toplev.c: Similarly.
        * cp/cp-tree.h: Similarly.
        * cp/decl2.c: Similarly.
        * cp/lang-specs.h: Similarly.
        * cp/lex.c: Similarly.
        * cp/lex.h: Similarly.
        * cp/spew.c: Similarly.
        * java/lang-options.h: Similarly.
        * objc/lang-specs.h: Similarly.
        * objc/objc-act.c: Similarly.

        * configure.in: Remove configure option.
        * config.in: Regenerate.
        * configure: Regenerate.

From-SVN: r37742
2000-11-25 19:28:44 +00:00
Nathan Sidwell
5cce22b6c2 cp-tree.h (PARMLIST_ELLIPSIS_P): New macro.
cp:
	* cp-tree.h (PARMLIST_ELLIPSIS_P): New macro.
	* decl.c (grokdeclarator): Don't reject void parms here.
	(require_complete_types_for_parms): Simplify, use
	complete_type_or_else.
	(grokparms): Remove bitrot. Remove funcdef parm.
	Deal with ellipsis parm lists here.
	* semantics.c (finish_parmlist): Don't append void_list_node
	here. Set PARMLIST_ELLIPSIS_P.

testsuite:
	* g++.old-deja/g++.other/incomplete.C: Add more tests.
	* g++.old-deja/g++.pt/crash9.C: Mark new expected error.

From-SVN: r37517
2000-11-17 10:05:31 +00:00
Mark Mitchell
0a7394bc1a Makefile.in (C_AND_OBJC_OBJS): Add c-dump.o.
* Makefile.in (C_AND_OBJC_OBJS): Add c-dump.o.
	(c-dump.o): New target.
	* c-common.h (flag_dump_translation_unit): New variable.
	(C_TYPE_QUALS): New macro.
	(strip_array_types): New function.
	(DECL_C_BIT_FIELD): New macro.
	(SET_DECL_C_BIT_FIELD): Likewise.
	(CLEAR_DECL_C_BIT_FIELD): Likewise.
	(dump_info_p): New typedef.
	(dump_tree_fn): Likewise.
	(lang_dump_tree): New variable.
	(dump_node_to_file): New function.
	* c-common.c (flag_dump_translation_unit): Define it.
	(strip_array_types): New function.
	* c-decl.c (c_decode_option): Handle -fdump-translation-unit.
	* c-lang.c (finish_file): Call dump_node_to_file if
	flag_dump_translation_unit.
	* c-semantics.c (mark_rtl_for_local_static): Fix typo in comment.
	* c-tree.h (DECL_C_BIT_FIELD): Remove declaration.
	* c-dump.c: New file.

	* Make-lang.in (CXX_C_OBJS): Add c-dump.o.
	(dump.o): Update dependency list.
	* cp-tree.h (DECL_MAYBE_TEMPLATE): Remove.
	(flag_dump_translation_unit): Likewise.
	(CP_TYPE_QUALS): Adjust definition.
	(DECL_C_BIT_FIELD): Remove.
	(SET_DECL_C_BIT_FIELD): Likewise.
	(CLEAR_DECL_C_BIT_FIELD): Likewise.
	(add_maybe_template): Likewise.
	(strip_array_types): Likewise.
	(dump_node_to_file): Likewise.
	(cp_dump_tree): New function.
	* decl.c (init_decl_processing): Set lang_dump_tree.
	* decl2.c (flag_dump_translation_unit): Remove.
	* dump.c: Move most of it to ../c-dump.c.
	(cp_dump_tree): New function.
	* pt.c (add_maybe_template): Remove.
	* typeck.c (strip_array_types): Likewise.

From-SVN: r37358
2000-11-10 04:29:45 +00:00
Gabriel Dos Reis
761f08559a memtemp77.C (main): Adjust comparison against.
testsuite/
	* g++.old-deja/g++.pt/memtemp77.C (main): Adjust comparison against.
	__PRETTY_FUNCTION__

cp/
	* error.c: Move TFF_ macros into cp-tree.h.  Throughout, replace
	TS_* flags with corresponding TFF_*.  Adjust prototypes of
	functions (which used to take a tree_string_flags) to take an int.

	* cp-tree.h (enum tree_string_flags): Remove
	(TFF_PLAIN_IDENTIFIER, TFF_NAMESPACE_SCOPE, TFF_CLASS_SCOPE,
	TFF_CHASE_NAMESPACE_ALIAS, TFF_CHASE_TYPEDEF, TFF_DECL_SPECIFIERS,
	TFF_CLASS_KEY_OR_ENUM, TFF_RETURN_TYPE,
	TFF_FUNCTION_DEFAULT_ARGUMENTS, TFF_EXCEPTION_SPECIFICATION,
	TFF_TEMPLATE_HEADER, TFF_TEMPLATE_DEFAULT_ARGUMENTS,
	TFF_TEMPLATE_NAME, TFF_EXPR_IN_PARENS, TFF_SCOPE): New macros.
	(type_as_string, decl_as_string, expr_as_string,
	context_as_string): Adjust prototype.

	* class.c (dump_class_hierarchy_r): Use TFF_PLAIN_IDENTIFIER
	instead of TS_PLAIN.

	* pt.c (mangle_class_name_for_template): Use TFF_CHASE_TYPEDEF
	instead of TF_CHASE_TYPEDEFS. Use TFF_PLAIN_IDENTIFIER instead of
	plain `0'.

From-SVN: r37152
2000-10-31 08:43:17 +00:00
Mark Mitchell
ad50e811dc cp-tree.h (DECL_EXTERNAL_LINKAGE_P): New macro.
* cp-tree.h (DECL_EXTERNAL_LINKAGE_P): New macro.
	(linkage_kind): New enumeration.
	(decl_linkage): New function.
	* decl2.c (comdat_linkage): Extend comment.
	* error.c (dump_function_decl): Print the arguments used to
	instantiate a template, even when not printing the type of the
	function.
	* pt.c (convert_nontype_argument): Use DECL_EXTERNAL_LINKAGE_P,
	not TREE_PUBLIC, to test for external linkage.
	* tree.c (decl_linkage): New function.

From-SVN: r37150
2000-10-31 01:30:59 +00:00
Mark Mitchell
97ba1e3c39 cp-tree.h (DECL_ANTICIPATED): Don't require a FUNCTION_DECL.
* cp-tree.h (DECL_ANTICIPATED): Don't require a FUNCTION_DECL.
	* decl.c (select_decl): Don't return declarations that are
	DECL_ANTICIPATED.

From-SVN: r36953
2000-10-19 17:57:49 +00:00
Mark Mitchell
6bcedb4e1c c-common.h (flag_no_builtin): Declare.
* c-common.h (flag_no_builtin): Declare.
	(flag_no_nonansi_builtin): Likewise.
	(c_common_nodes_and_builtins): Change prototype.
	* c-common.c (flag_no_builtin): New variable.
	(flag_no_nonansi_builtin): Likewise.
	(c_common_nodes_and_builtins): Remove parameters.  Adjust
	accordingly.
	* c-decl.c (flag_no_builtin): Remove.
	(flag_no_nonansi_builtin): Likewise.
	(init_decl_processing): Adjust call to
	c_common_nodes_and_builtins.

	* cp-tree.h (cp_tree_index): Add CPTI_FAKE_STD.
	(fake_std_node): New macro.
	* decl.c (in_std): Rename to ...
	(in_fake_std): ... this.
	(flag_no_builtin): Remove.
	(flag_no_nonansi_builtin): Likewise.
	(walk_namespaces_r): Use fake_std_node.
	(push_namespace): Use std_identifier.
	(pop_namespace): Use in_fake_std.
	(lookup_name_real): Use fake_std_node.
	(init_decl_processing): When -fhonor-std, create the `std'
	namespace.  Don't create a dummy fake_std_node in that case.
	Adjust call to c_common_nodes_and_builtins.  Use std_identifier.
	(builtin_function): Put builtins whose names don't begin
	with `_' in the std namespace.
	* decl2.c (flag_no_builtin): Remove.
	(flag_no_nonansi_builtin): Likewise.
	(set_decl_namespace): Use fake_std_node.
	(validate_nonmember_using_decl): Likewise.
	(do_using_directive): Likewise.
	(handle_class_head): Likewise.
	* dump.c (dequeue_and_dump): Likewise.
	* except.c (init_exception_processing): Use std_identifier.
	* init.c (build_member_call): Use fake_std_node.
	* rtti.c (init_rtti_processing): Use std_identifier.

From-SVN: r36940
2000-10-18 18:59:04 +00:00
Mark Mitchell
67673f5c5b c-common.c (back_end_hook): New variable.
* c-common.c (back_end_hook): New variable.
	* c-common.h (back_end_hook): Declare it.
	* c-lang.c (finish_file): Use it.

	* emit-rtl.c (init_emit_once): Initialize the const_int_htab
	earlier.

	* cp-tree.h (back_end_hook): Remove declaration.
	* decl2.c (back_end_hook): Remove definition.

	* dump.c (dequeue_and_dump): Dump TREE_USED.

From-SVN: r36928
2000-10-18 05:45:37 +00:00
Richard Henderson
156ce2112e cp-tree.h (struct cp_language_function): Remove x_result_rtx.
* cp/cp-tree.h (struct cp_language_function): Remove x_result_rtx.
        (original_result_rtx): Remove.
        * cp/decl.c (save_function_data): Don't clear x_result_rtx.
        (mark_lang_function): Don't mark it either.
        * cp/expr.c (fixup_result_decl): Remove.
        * cp/semantics.c (genrtl_named_return_value): Frob the return decl
        before calling emit_local_var.
        (genrtl_finish_function): Don't call fixup_result_decl.
        Always emit the jump to return_label.

From-SVN: r36770
2000-10-06 18:46:42 -07:00
Nathan Sidwell
509fc2779a cp-tree.h (access_kind): Fix comment typo.
* cp-tree.h (access_kind): Fix comment typo.
	* decl2.c (grokfield): Fix diagnostic typo.
	* semantics.c (finish_template_type): Fix comment typo.
	(finish_qualified_object_call_expr): Likewise.

From-SVN: r36722
2000-10-05 08:41:44 +00:00
Andreas Jaeger
bb20cc46ae errfn.c: Move declaration of cp_printer and cp_printers to ...
* errfn.c: Move declaration of cp_printer and cp_printers to ...
        * cp-tree.h: ... here.

        * error.c: Remove declaration of cp_printer.

From-SVN: r36557
2000-09-21 05:43:14 +02:00
Kaveh R. Ghazi
3f80e6acb1 Makefile.in (c-common.o): Depend on diagnostic.h.
* Makefile.in (c-common.o): Depend on diagnostic.h.

	* c-common.c: Include diagnostic.h.
	(tfaff): Delete.
	(status_warning): New function.
	(check_format_info, maybe_read_dollar_number, check_format_types,
	finish_dollar_format_checking, check_function_format): Accept a
	`status' parameter.  All callers changed.

	* c-common.h (check_function_format): Accept a `status' parameter.

	* c-typeck.c: Update call to `check_function_format'.

cp:
	* cp-tree.h (check_function_format): Accept a `status' parameter.

	* call.c, typeck.c: Updates calls to `check_function_format'.

From-SVN: r36524
2000-09-19 03:26:11 +00:00
Mark Mitchell
8f17b5c5cb splay-tree.c (splay_tree_predecessor): Fix typo in comment.
* splay-tree.c (splay_tree_predecessor): Fix typo in comment.

	Convert the C front-end to use function-at-a-time mode.
	* c-common.h: Include splay-tree.h.
	(C_DECLARED_LABEL_FLAG): New macro.
	(struct language_function): Add x_scope_stmt_stack and
	x_function_name_declared_p.
	(RECHAIN_STMTS): Move definition.
	(lang_statment_code_p): Likewise.
	(lang_expand_stmt): Likewise.
	(lang_expand_decl_stmt): New variable.
	(lang_expand_function_end): Likewise.
	(current_scope_stmt_stack): New function.
	(add_decl_stmt): Likewise.
	(add_scope_stmt): Likewise.
	(mark_stmt_tree): Likewise.
	(struct c_lang_decl): New structure.
	(DECL_SAVED_TREE): Define.
	(c_mark_lang_decl): New function.
	(c_expand_start_cond): Change prototype.
	(c_finish_then): New function.
	(c_finish_else): Likewise.
	(current_function_name_declared): Remove.
	(set_current_function_name_declared): Likewise.
	(mark_c_language_function): Declare.
	(case_compare): Likewise.
	(c_add_case_label): Likewise.
	(c_expand_expr): Likewise.
	(c_safe_from_p): Likewise.
	* c-common.c (lang_expand_function_end): New variable.
	(struct if_elt): Add if_stmt.
	(c_expand_start_cond): Add the if-statement to the statement-tree,
	rather than generating RTL.
	(c_finish_then): New function.
	(c_expand_start_else): Don't generate RTL.
	(c_finish_else): New function.
	(c_expand_expr_stmt): Don't generate RTL.
	(statement_code_p): Add SCOPE_STMT.
	(case_compare): New function.
	(c_add_case_label): Likewise.
	(mark_stmt_tree): Likewise.
	(c_mark_lang_decl): Likewise.
	(mark_c_language_function): Likewise.
	(c_expand_expr): Likewise.
	(c_safe_from_p): Likewise.
	* c-decl.c (c_stmt_tree): New variable
	(c_scope_stmt_stack): Likewise.
	(c_function_name_declared_p): Likewise.
	(lang_expand_expr_stmt): Remove.
	(poplevel): Don't call output_inline_function for nested
	functions.
	(pushdecl): Don't set DECL_CONTEXT for a local declaration of an
	`extern' function.
	(redeclaration_error_message): Change means of computing whether
	or not a function is nested.
	(lookup_label): Don't call label_rtx.
	(init_decl_processing): Add more GC roots.
	(start_decl): Add DECL_STMTs to the statement-tree, rather than
	calling rest_of_decl_compilation.
	(finish_decl): Don't call expand_decl.
	(store_parm_decls): Begin the statement-tree, but don't generate
	RTL.
	(finish_function): Tie off the statement-tree.  Call c_expand_body
	if appropriate.
	(c_expand_body): New function.
	(push_c_function_context): Save more information.
	(pop_c_function_contxt): Likewise.
	(copy_lang_decl): Now that we use DECL_LANG_SPECIFIC, copy it.
	(lang_mark_tree): Mark it.
	(current_stmt_tree): Adjust.
	(current_scope_stmt_stack): New function.
	(do_case): Remove.
	(set_current_name_declared): Likewise.
	(c_begin_compound_stmt): Define.
	(c_expand_decl_stmt): Likewise.
	* c-lang.c: Include rtl.h and expr.h.
	(lang_init): Set more language-specific hooks.
	* c-lex.c: Include expr.h.
	* c-parse.in: Changes throughout to add statements to the
	statement-tree, rather than generating RTL after every statement.
	* c-semantics.c (lang_expand_decl_stmt): Define.
	(add_decl_stmt): New function.
	(add_scope_stmt): Likewise.
	(finish_stmt_tree): Tweak.
	(genrtl_expr_stmt): Likewise.
	(genrtl_decl_stmt): Handle local labels, and call
	lang_expand_decl_stmt if required.
	(genrtl_for_stmt): Fix line-number handling.
	(genrtl_case_label): Handle cleanups.
	(genrtl_asm_stmt): Don't call combine_strings.
	(genrtl_compound_stmt): Simplify.
	(expand_stmt): Handle SCOPE_STMTs.
	* c-tree.h (struct lang_decl): New structure.
	(C_DECLARED_LABEL_FLAG): Remove.
	(c_begin_compound_stmt): Declare.
	(c_expand_decl_stmt): Likewise.
	(c_expand_start_case): Rename to c_start_case.
	(c_finish_case): New function.
	* c-typeck.c (start_init): Tweak setting of
	constructor_incremental.
	(c_expand_asm_operands): Tweak error-handling.  Add to the
	statement-tree.
	(c_expand_return): Add to the statement-tree.
	(c_expand_start_case): Rename to ...
	(c_start_case): ... this.
	(struct c_switch): New type.
	(switch_stack): New variable.
	(do_case): Simplify.
	(c_finish_case): New function.
	* dependence.c: Include expr.h.
	(enum dependence_type): Change spelling of enumerals.
	(check_node_dependence): Adjust.
	* expr.h (lang_safe_from_p): Declare.
	(safe_from_p): Likewise.
	* expr.c (lang_safe_from_p): New variable.
	(safe_from_p): Give it external linkage.  Use lang_safe_from_p.
	* stmt.c (expand_expr_stmt): Avoid clobberring of last_expr_type.
	* toplev.c (rest_of_decl_compilation): Robustify.
	* tree.c (contains_placeholder_p): Likewise.
	* Makefile.in: Update dependencies.
	* objc/objc-act.h: Adjust calculation of value for dummy_tree_code.
	* objc/objc-act.c: Include rtl.h, expr.h, and c-common.h.
	(objc_expand_function_end): New function.
	(finish_method_def): Use it.
	(init_objc): Initialize more language-specific hooks.
	* objc/Make-lang.in: Update dependencies.

	* cp-tree.h (struct cp_language_function): Remove
	x_scope_stmt_stack and name_declared.
	(current_scope_stmt_stack): Remove.
	(function_name_declared_p): New macro.
	(struct lang_decl_flags): Use c_lang_decl as a base class.
	(context): Remove.
	(struct lang_decl): Replace saved_tree with context.
	(DECL_FRIEND_CONTEXT): Adjust accordingly.
	(SET_DECL_FRIEND_CONTEXT): Likewise.
	(DECL_VIRTUAL_CONTEXT): Likewise.
	(DECL_SAVED_TREE): Remove.
	(C_DECLARED_LABEL_FLAG): Likewise.
	(cplus_expand_expr_stmt): Don't declare.
	(add_decl_stmt): Likewise.
	(add_scope_stmt): Likewise.
	* decl.c (mark_stmt_tree): Remove.
	(case_compare): Likewise.
	(finish_case_label): Use c_add_case_label.
	(init_decl_processing): Set more language-specific hooks.
	(build_enumerator): Fix typo in comment.
	(cplus_expand_expr_stmt): Remove.
	(mark_lang_function): Use mark_c_language_function.
	(lang_mark_tree): Use c_mark_lang_decl.
	* decl2.c: Change order of inclusion.
	* except.c: Likewise.
	* expr.c (cplus_expand_expr): Remove handling of STMT_EXPR.  Fall
	back on c_expand_expr.
	* friend.c: Include expr.h.
	* init.c: Change order of inclusion.
	* Makefile.in: Update dependencies.
	* lex.h (free_lang_decl_chain): Remove.
	* optimize.c (maybe_clone_body): Use function_name_declared_p.
	* pt.c (build_template_decl): Don't copy DECL_VIRTUAL_CONTEXT if
	it doesn't exist.
	(instantiate_decl): Use function_name_declared_p.
	* semantics.c (lang_expand_expr_stmt): Remove.
	(set_current_function_name_declared): Likewise.
	(current_function_name_declared): Likewise.
	(begin_compound_stmt): Use function_name_declared_p.
	(add_decl_stmt): Remove.
	(setup_vtbl_ptr): Use function_name_declared_p.
	(add_scope_stmt): Remove.
	(current_scope_stmt_stack): New function.
	(cp_expand_stmt): Don't handle SCOPE_STMTs.
	(expand_body): Use function_name_declared_p.
	* tree.c (cp_statement_code_p): Don't include SCOPE_STMT.
	* typeck.c: Change order of includes.
	(convert_sequence): Remove.

From-SVN: r36464
2000-09-17 07:38:23 +00:00
Mark Mitchell
f444e36b2d c-common.h (genrtl_clear_out_block): Remove.
* c-common.h (genrtl_clear_out_block): Remove.
	* c-semantics.c (genrtl_clear_out_block): Remove.
	(genrtl_while_stmt): Don't call it.
	(genrtl_for_stmt): Likewise.

	* cp-tree.h (struct saved_scope): Remove x_function_parms.
	(current_function_parms): Don't define.
	(struct cp_language_function): Remove parms_stored.
	(current_function_just_assigned_this): Don't define.
	(current_function_parms_stored): Likewise.
	(static_ctors): Declare.
	(static_dtors): Likewise.
	(SF_EXPAND): Don't define.
	(expand_start_early_try_stmts): Remove declaration.
	(store_parm_decls): Likewise.
	* decl.c (static_ctors): Don't declare.
	(static_dtors): Likewise.
	(struct binding_level): Remove this_block.
	(poplevel): Remove dead code.
	(set_block): Likewise.
	(mark_binding_level): Don't mark this_block.
	(mark_saved_scope): Don't mark x_function_parms.
	(init_decl_processing): Don't add current_function_parms as a GC
	root.
	(check_function_type): Change prototype.
	(start_function): Remove RTL-generation code.
	(expand_start_early_try_stmts): Remove.
	(store_parm_decls): Give it internal linkage.  Remove
	RTL-generation code.
	(finish_function): Remove RTL-generation code.
	* decl2.c (static_ctors): Fix formatting.
	(static_dtors): Likewise.
	* method.c (use_thunk): Don't call store_parm_decls.
	(synthesize_method): Likewise.
	* optimize.c (maybe_clone_body): Likewise.
	* parse.y (fn.def2): Likewise.
	(.set_base_init): Likewise.
	(nodecls): Likewise.
	* pt.c (instantiate_decl): Likewise.
	* rtti.c (synthesize_tinfo_fn): Likewise.
	* semantics.c (genrtl_try_block): Simplify.
	(expand_body): Use genrtl_start_function and
	genrtl_finish_function.
	(genrtl_start_function): New function.
	(genrtl_finish_function): Likewise.

From-SVN: r36350
2000-09-12 06:46:00 +00:00
Nathan Sidwell
f2d71db623 cp-tree.h (frob_opname): Declare.
* cp-tree.h (frob_opname): Declare.
	* parse.y (saved_scopes): New static variable.
	(cp_parse_init): Adjust.
	(do_id): If lastiddecl is NULL, do do_identifier.
	(operator): Save scope information.
	(unoperator): new reduction. Restore scope information.
	(operator_name): Append unoperator. Call frob_opname.
	* spew.c (frob_opname): Define.

From-SVN: r36315
2000-09-11 14:19:53 +00:00
Mark Mitchell
56cb97339b c-common.h (add_stmt): Change prototype.
* c-common.h (add_stmt): Change prototype.
	(RECHAIN_STMTS): New macro.
	(CASE_LABEL_DECL): Likewise.
	(genrtl_case_label): Change prototype.
	(c_expand_start_case): Remove prototype.
	(build_case_label): Change prototype.
	(decl_constant_value): Declare.
	* c-common.c (check_case_value): Handle C++'s extensions to C
	semantics.
	* c-commnon.def (CASE_LABEL): Add room for the CASE_LABEL_DECL
	field.
	* c-parse.in (stmt): Adjust handling of return statements and case
	laels.
	* c-semantics.c (add_stmt): Return the new statement.
	(genrtl_return_stmt): Take the RETURN_STMT as input, not the
	returned expression.  Directly generate RTL, rather than calling
	c_expand_return.
	(genrtl_switch_stmt): Don't call c_expand_start_case.
	(build_case_label): Take the LABEL_DECL as input, too.
	(genrtl_case_label): Just call add_case_node.
	(expand_stmt): Adjust calls to genrtl_return_stmt and
	genrtl_case_label.
	* c-tree.h (c_expand_start_case): Declare.
	* c-typeck.c (decl_constant_value): Give it external linkage.
	(c_expand_return): Don't call expand_return or expand_null_return;
	use genrtl_return_stmt instead.
	* stmt.c (struct nesting): Remove num_ranges field.
	(add_case_node): Give it external linkage.
	(expand_start_case): Don't set num_ranges.
	(expand_start_case_dummy): Don't clear it.
	(pushcase): Rely on add_case_node to handle `default' labels.
	(add_case_node): Handle `default' labels.
	* tree.c (tree_int_cst_compare): New function.
	* tree.h (tree_int_cst_compare): Declare.
	(add_case_node): Likewise.

	* cp-tree.h (push_switch): Change prototype.
	(check_cp_case_value): Remove declaration.
	(decl_constant_value): Likewise.
	* decl.c (struct cp_switch): Add switch_stmt and cases.
	(case_compare): New function.
	(push_switch): Set switch_stmt.  Initialize cases.
	(pop_switch): Clean up cases.
	(define_case_label): Rename to ...
	(finish_case_label): ... this.  Do semantic analysis for case
	labels here.
	(start_function): Correct comment.
	* decl2.c (check_cp_case_value): Remove.
	* expr.c (do_case): Remove.
	* pt.c (tsubst_expr): Adjust call to finish_case_label.
	* semantics.c (genrtl_do_poplevel): Remove declaration.
	(RECHAIN_STMTS): Remove.
	(finish_break_stmt): Use build_break_stmt.
	(finish_continue_stmt): Use build_continue_stmt.
	(finish_switch_cond): Adjust condition here, rater than in
	c_expand_start_case.
	(finish_case_label): Remove.
	* typeck.c (c_expand_return): Remove.
	(c_expand_start_case): Likewise.

From-SVN: r36305
2000-09-10 21:34:41 +00:00
Mark Mitchell
54f7877c8b c-common.h (prep_stmt): Declare.
* c-common.h (prep_stmt): Declare.
	(lang_expand_stmt): Likewise.
	* c-decl.c (lang_expand_stmt): Remove.
	* c-semantics.c (lang_expand_stmt): Define.
	(prep_stmt): New function.
	(expand_stmt): Handle common statement types here.

	* cp-tree.h (init_cp_semantics): Declare.
	(genrtl_try_block): Don't declare.
	(genrtl_handler): Likewise.
	(genrtl_catch_block): Likewise.
	(genrtl_ctor_stmt): Likewise.
	(genrtl_subobject): Likewise.
	(genrtl_do_poplevel): Likewise.
	(genrtl_named_return_value): Likewise.
	* lex.c (init_parse): Call init_cp_semantics.
	* semantics.c (genrtl_try_block): Give it internal linkage.
	(genrtl_handler): Likewise.
	(genrtl_catch_block): Likewise.
	(genrtl_ctor_stmt): Likewise.
	(genrtl_subobject): Likewise.
	(genrtl_do_poplevel): Likewise.
	(genrtl_named_return_value): Likewise.
	(lang_expand_stmt): Rename to ...
	(cp_expand_stmt): ... this.  Only handle C++-specific nodes.
	(init_cp_semantics): Define.

From-SVN: r36229
2000-09-07 06:55:51 +00:00
Mark Mitchell
ae499ccea4 Move statement-tree facilities from C++ to C front-end.
* c-common.h (c_tree_index): Add CTI_VOID_ZERO.
	(void_zero_node): New macro.
	(struct stmt_tree_s): New type.
	(stmt_tree): New typedef.
	(struct language_function): New type.
	(last_tree): New macro.
	(last_expr_type): Likewise.
	(walk_tree_fn): New typedef.
	(current_stmt_tree): New function.
	(begin_stmt_tree): Likewise.
	(add_stmt): Likewise.
	(finish_stmt_tree): Likewise.
	(statement_code_p): Likewise.
	(lang_statement_code_p): New variable.
	(walk_stmt_tree): New function.
	(STMT_IS_FULL_EXPR_P): New macro.
	* c-common.c (lang_statement_code_p): New variable.
	(c_common_nodes_and_builtins): Initialize void_zero_node.
	(statement_code_p): New function.
	(walk_stmt_tree): Likewise.
	* c-decl.c (language_function): Rename to ...
	(c_language_function): ... this.  Include language_function.
	(push_c_function_context): Adjust accordingly.
	(pop_c_function_context): Likewise.
	(mark_c_function_context): Likewise.
	(current_stmt_tree): Define.
	* c-semantics.c (begin_stmt_tree): New function.
	(add_stmt): Likewise.
	(prune_unused_decls): Likewise.
	(finish_stmt_tree): Likewise.

	Move statement-tree facilities from C++ to C front-end.
	* cp-tree.h (cp_tree_index): Remove CPTI_VOID_ZERO.
	(void_zero_node): Remove.
	(stmt_tree): Likewise.
	(scope_chain): Adjust.
	(language_function): Rename to cp_language_function.
	(cp_function_chain): Adjust.
	(current_stmt_tree): Remove.
	(last_tree): Likewise.
	(last_expr_type): Likewise.
	(struct lang_decl): Adjust.
	(STMT_IS_FULL_EXPR_P): Remove.
	(add_tree): Remove.
	(begin_stmt_tree): Likewise.
	(finish_stmt_tree): Likewise.
	(walk_tree_fn): Likewise.
	(walk_stmt_tree): Likewise.
	* class.c (finish_struct): Replace use of add_tree with add_stmt.
	* decl.c (mark_stmt_tree): Adjust type.
	(init_decl_processing): Don't build void_zero_node.
	(initialize_local_var): Adjust usage of current_stmt_tree.
	(finish_enum): Use add_stmt, not add_tree.
	(save_function_data): Adjust use of language_function.
	(finish_constructor_body): Use add_stmt, not add_tree.
	(finish_destructor_body): Likewise.
	(push_cp_function_context): Adjust use of language_function.
	(pop_cp_function_context): Likewise.
	(mark_lang_function): Likewise.
	(mark_cp_function_context): Likewise.
	* init.c (build_aggr_init): Adjust use of current_stmt_tree.
	(build_vec_init): Likewise.
	* semantics.c (SET_LAST_STMT): Remove.
	(RECHAIN_STMTS): Don't use it.
	(stmts_are_full_exprs_p): Adjust use of current_stmt_tree.
	(current_stmt_tree): Define.
	(add_tree): Remove.
	(finish_goto_stmt): Use add_stmt, not add_tree.
	(finish_expr_stmt): Likewise.
	(begin_if_stmt): Likewise.
	(finish_then_clause): Likewise.
	(begin_while_stmt): Likewise.
	(begin_do_stmt): Likewise.
	(finish_return_stmt): Likewise.
	(begin_for_stmt): Likewise.
	(finish_break_stmt): Likewise.
	(finish_continue_stmt): Likewise.
	(begin_switch_stmt): Likewise.
	(finish_case_label): Likewise.
	(begin_try_block): Likewise.
	(begin_function_try_block): Likewise.
	(begin_handler): Likewise.
	(begin_catch_block): Likewise.
	(begin_compound_stmt): Likewise.
	(begin_asm_stmt): Likewise.
	(finish_asm_stmt): Likewise.
	(finish_label_stmt): Likewise.
	(add_decl_stmt): Likewise.
	(finish_subobject): Likewise.
	(finish_decl_cleanup): Likewise.
	(finish_named_return_value): Likewise.
	(setup_vtbl_ptr): Likewise.
	(add_scope_stmt): Likewise.
	(finish_stmt_expr): Likewise.
	(prune_unused_decls): Remove.
	(begin_stmt_tree): Likewise.
	(finish_stmt_tree): Likewise.
	(prep_stmt): Adjust use of current_stmt_tree.
	(lang_expand_stmt): Likewise.
	* tree.c (statement_code_p): Remove.
	(cp_statement_code_p): New function.
	(walk_stmt_tree): Remove.
	(init_tree): Set lang_statement_code_p.

From-SVN: r36221
2000-09-07 01:36:11 +00:00
Zack Weinberg
0e5921e8a0 Integrated preprocessor.
top level:
	* Makefile.in: Remove all references to c-parse.gperf,
	c-gperf.h, and c-parse.h.  Remove -d from yacc command line
	generating c-parse.c.  Update dependencies.
	* c-parse.gperf, c-gperf.h: Delete.

	* c-common.c: Don't define parse_options, cpp_token, yy_cur,
	yy_lim, or yy_get_token.  Don't define get_directive_line if
	USE_CPPLIB.
	* c-common.h: Add multiple include guard.  Define RID values
	for every keyword in C, C++, and Objective C.  Put all the
	modifiers first.
	(struct c_fileinfo, get_fileinfo, dump_time_statistics): New.
	* c-decl.c (c_decode_option): Handle -lang-objc here.
	(print_lang_identifier): Handle C_IS_RESERVED_WORD case.
	(grokdeclarator): Adjust for new RID scheme.
	(extract_interface_info): New stub.
	* c-lang.c: Don't declare yy_cur or parse_options.
	(lang_init_options): Call cpp_init.  Don't call
	cpp_options_init.
	(lang_init): Don't call check_newline if USE_CPPLIB.

	* c-lex.c: Don't include c-parse.h.  Do include timevar.h.
	Elide lots of unnecessary code if USE_CPPLIB.  Delete code
	rendered unnecessary by new architecture.  Move routines not
	shared with C++ to c-parse.in.  Maintain a local idea of the
	line number.    Handle C++ as well as C.
	[USE_CPPLIB]: Declare and register callbacks for #ident and
	for entering/leaving files.
	(init_c_lex, c_lex): Are now the entry points to this file.
	(check_newline): Break out directive handling to
	process_directive.
	(read_ucs, is_extended_char, utf8_extend_token): Moved here
	from C++ front end.
	(readescape, parse_float): Overhaul.
	(lex_number, lex_string, lex_charconst): Break out of c_lex
	(n'ee yylex).
	(get_fileinfo, update_header_times, dump_one_header,
	dump_time_statistics): New and/or moved here from C++.
	Support per-file data needed by C++ and per-header timing
	statistics (C++ only, at the moment).
	* c-lex.h: Update prototypes.  Add multiple include guard.
	* c-tree.h (struct lang_identifier): Add rid_code field.
	(C_IS_RESERVED_WORD, C_RID_CODE): New.

	* c-parse.in: Include c-pragma.h. Remove unnecesary calls to
	reinit_parse_for_function and/or position_after_white_space.
	(save_filename, save_lineno): Look ahead before saving.
	(label -> identifier ':'): Save file and line before shifting ':'.
	(reservedwords): No need to call get_identifier.
	(init_parse, finish_parse, yyerror, yylex, yyprint,
	make_pointer_declarator): Are now here for C/ObjC.
	(rid_to_yy): Conversion table from RID constants to Yacc codes.

	* c-pragma.c: Rewrite parsing logic to fit with cpplib's
	#pragma registry.  Provide dummy implementation of that
	interface if !USE_CPPLIB.
	* c-pragma.h: Update to match.

	* flags.h: Add multiple include guard.
	(flag_detailed_statistics): Moved here from C++.
	* toplev.c: Define flag_detailed_statistics.

	* gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case
	#if USE_CPPLIB.
	* timevar.def (TV_CPP, TV_LEX): New.
	* timevar.h: Add multiple include guard.

	* objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case
	#if USE_CPPLIB.
	* objc/objc-act.c: Don't mention yy_cur or parse_options.
	Initialize cpplib properly.  Force lineno to 0 after first
	call to check_newline.  Don't handle -lang-objc here.
	Move forget_protocol_qualifiers and remember_protocol_qualifiers here.

cp:
	* Make-lang.in, Makefile.in: Remove all references to input.c,
	gxx.gperf, and hash.h.  Add ../c-lex.o to C_OBJS.
	* gxx.gperf, hash.h, input.c: Delete.
	* lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is
	initialized properly.

	* class.c (fixup_pending_inline): Take a tree, not a
	struct pending_inline *.  All callers changed.
	(init_class_processing): Set RID_PUBLIC, RID_PRIVATE,
	RID_PROTECTED entries in ridpointers[] array here.
	* decl.c (duplicate_decls): Do not refer to struct
	pending_inline.
	(record_builtin_type, init_decl_processing): Use RID_MAX not
	CP_RID_MAX.
	(grokdeclarator): Use C_IS_RESERVED_WORD.
	* decl2.c (lang_decode_option): Ignore -lang-c++ for sake of
	cpplib.
	(grok_x_components): Do not inspect pending_inlines chain.

	* cp-tree.h (struct lang_identifier): Add rid_code entry.
	(C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New.
	(flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare.
	(DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME,
	TIME_IDENTIFIER_FILEINFO): Kill.
	Update prototypes.
	* lex.h: Expunge cp_rid.  Rewrite RIDBIT macros to use just a
	single 32-bit word.
	* parse.y: Call do_pending_inlines unconditionally.
	reinit_parse_for_method is now snarf_method.  fn.defpen is no
	longer necessary.  Remove unnecessary <itype> annotation on
	SCOPE.  Do not refer to end_of_file or struct pending_inline.
	* semantics.c (begin_inline_definitions): Call
	do_pending_inlines unconditionally.

	* lex.c: Remove all code now shared with C front end.
	Initialize cpplib properly if USE_CPPLIB.  Put reserved words
	into the get_identifier table.  Rewrite pragma handling to
	work with the registry.  Move code to save tokens for later
	processing to spew.c.

	* spew.c: Rewrite everything in terms of token streams instead
	of text.  Move routines here from lex.c / input.c as
	appropriate.  GC-mark trees hanging off the pending inlines
	chain.

testsuite:
	* g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on
	ERROR markers.
	* g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line.
	* gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail.
	* gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps.
	* gcc.dg/wtr-suffix-1.c: Correct error regexps.
	* gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c:
	Preprocess only.
	* gcc.dg/cpp/unc4.c: Adjust line number in dg-error line.
	* gcc.dg/noncompile/const-ll-1.c: Generalize error regexp.

From-SVN: r36216
2000-09-07 00:37:14 +00:00
Mark Mitchell
44835fdd5d extend.texi: Mark named return value extension as deprecated.
* extend.texi: Mark named return value extension as deprecated.

	* NEWS: Mention that the named return value extension has been
	deprecated.
	* cp-tree.h (original_result_rtx): Define.
	(TREE_REFERENCE_EXPR): Remove.
	(DECL_VPARENT): Likewise.
	(pushdecl_nonclass_level): Likewise.
	(store_return_init): Likewise.
	(reinit_lang_specific): Likewise.
	(genrtl_named_return_value): Change prototype.
	* decl.c (original_result_rtx): Remove.
	(cp_finish_decl): Don't build DECL_STMTs for RESULT_DECLs.
	Do not generate RTL for local variables here.
	(store_return_init): Remove.
	* semantics.c (genrtl_named_return_value): Simplify.  Fold in
	store_return_init.
	(finish_named_return_value): Adjust accordingly.  Warn that this
	extension is deprecated.
	(lang_expand_stmt): Adjust call to genrtl_named_return_value.

From-SVN: r36210
2000-09-06 21:25:02 +00:00
Zack Weinberg
11f53b6a08 tree.c (walk_tree): Expose tail recursion.
* tree.c (walk_tree): Expose tail recursion.
	(walk_stmt_tree): New function.
	* cp-tree.h: Prototype walk_stmt_tree.
	* semantics.c (prune_unused_decls): Operate on SCOPE_STMTs not
	the BLOCKs directly.  If a BLOCK has no variables after
	pruning, discard it.
	(finish_stmt_tree): Use walk_stmt_tree.  No need to save and
	restore the line number.

From-SVN: r36178
2000-09-06 05:52:51 +00:00
Mark Mitchell
ee94fce6ef Makefile.in (CXX_TREE_H): Add dependency on HTAB_H.
* Makefile.in (CXX_TREE_H): Add dependency on HTAB_H.
	(pt.o): Remove dependency on HTAB_H.
	* cp-tree.h: Include hashtab.h.
	(walk_tree): Change prototype.
	(walk_tree_without_duplicates): New function.
	* decl.c (check_default_argument): Use it.
	* optimize.c (remap_decl): Adjust calls to walk_tree.
	(copy_body): Likewise.
	(expand_calls_inline): Likewise.
	(calls_setjmp_p): Use walk_tree_without_duplicates.
	* pt.c: Don't include hashtab.h.
	(for_each_template_parm): Use walk_tree_without_duplicates.
	* semantics.c (finish-stmt_tree): Likewise.
	(expand_body): Likewise.
	* tree.c (walk_tree): Add additional parameter.
	(walk_tree_without_duplicates): New function.
	(count_trees): Use it.
	(verify_stmt_tree): Adjust call to walk_tree.
	(find_tree): Use walk_tree_without_duplicates.
	(no_linkage_check): Likewise.
	(break_out_target_exprs): Adjust call to walk_tree.
	(cp_unsave): Likewise.

From-SVN: r36155
2000-09-05 07:31:27 +00:00
Kriang Lerdsuwanakij
a1281f4503 cp-tree.def (BOUND_TEMPLATE_TEMPLATE_PARM): New tree code.
* cp-tree.def (BOUND_TEMPLATE_TEMPLATE_PARM): New tree code.
        (TEMPLATE_TEMPLATE_PARM): Adjust comment.
        * cp-tree.h (TYPE_BINFO): Adjust comment.
        (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise.
        (TEMPLATE_TYPE_PARM_INDEX): Likewise.
        (IS_AGGR_TYPE): Use BOUND_TEMPLATE_TEMPLATE_PARM instead.
        (TYPE_TEMPLATE_INFO): Likewise.
        (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): Likewise.
        * class.c (push_nested_class): Likewise.
        * decl.c (lookup_name_real): Likewise.
        (grokdeclarator): Likewise.
        (grok_op_properties): Likewise.
        (xref_tag): Likewise.
        (xref_basetypes): Likewise.
        * decl2.c (constructor_name_full): Likewise.
        (arg_assoc_template_arg): Add TEMPLATE_TEMPLATE_PARM case.
        (arg_assoc_type): Use BOUND_TEMPLATE_TEMPLATE_PARM instead.
        * error.c (dump_type): Split TEMPLATE_TEMPLATE_PARM case.
        (dump_type_prefix): Add BOUND_TEMPLATE_TEMPLATE_PARM.
        (dump_type_suffix): Likewise.
        * init.c (is_aggr_type): Use BOUND_TEMPLATE_TEMPLATE_PARM
        instead.
        (get_aggr_from_typedef): Likewise.
        * mangle.c (write_type): Split TEMPLATE_TEMPLATE_PARM case.
        (write_expression): Add BOUND_TEMPLATE_TEMPLATE_PARM.
        (write_template_parm): Likewise.
        (write_template_template_parm): Check tree code instead of
        using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
        * method.c (build_overload_nested_name): Add
        BOUND_TEMPLATE_TEMPLATE_PARM.
        (process_overload_item): Split TEMPLATE_TEMPLATE_PARM case.
        * parse.y (bad_parm): Add BOUND_TEMPLATE_TEMPLATE_PARM.
        * pt.c (convert_template_argument): Check tree code instead of
        using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
        (for_each_template_parm_r): Split TEMPLATE_TEMPLATE_PARM case.
        (for_each_template_parm): Adjust comment.
        (tsubst): Add BOUND_TEMPLATE_TEMPLATE_PARM.  Reorganize.
        (tsubst_copy): Add BOUND_TEMPLATE_TEMPLATE_PARM.
        (unify): Add BOUND_TEMPLATE_TEMPLATE_PARM.  Reorganize.  Use
        template_args_equal to compare template template parameter cases.
        * ptree.c (print_lang_type): Add BOUND_TEMPLATE_TEMPLATE_PARM.
        * search.c (lookup_field_1): Use BOUND_TEMPLATE_TEMPLATE_PARM
        instead.
        * tree.c (copy_template_template_parm): Decide whether to create
        a TEMPLATE_TEMPLATE_PARM or BOUND_TEMPLATE_TEMPLATE_PARM node.
        (walk_tree): Add BOUND_TEMPLATE_TEMPLATE_PARM.
        (copy_tree_r): Likewise.
        * typeck.c (comptypes): Likewise.  Check tree code instead of
        using TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.

From-SVN: r36149
2000-09-04 21:01:39 -04:00
Jason Merrill
495d26d6ce cp-tree.h (LOCAL_CLASS_P): Use decl_function_context.
* cp-tree.h (LOCAL_CLASS_P): Use decl_function_context.

        * tree.c (bot_manip): Check TREE_CONSTANT rather than
        !TREE_SIDE_EFFECTS.  Call break_out_target_exprs and
        build_target_expr_with_type for the non-AGGR_INIT_EXPR case.

        * decl.c (start_function): Always call make_function_rtl.

From-SVN: r36080
2000-08-30 19:43:53 -04:00
Jason Merrill
881c6935bf [multiple changes]
2000-08-28  Daniel Berlin  <dberlin@redhat.com>

        * dwarf2out.c (DIE_LABEL_PREFIX): Remove leading "__".
        (print_die): If we don't know the offset of the
        target die, try the symbol.  Add a trailing newline.
        (reverse_all_dies): New fn.
        (dwarf2out_finish): Call it.
        (break_out_includes): Reorganize for clarity.
        (add_sibling_attributes): Don't call reverse_die_lists.
        (output_comp_unit): Rename from output_comdat_comp_unit.  Use for
        primary CU, too.
        * flags.h: Add flag_eliminate_dwarf2_dups.
        * toplev.c (f_options): Support -feliminate-dwarf2-dups.

2000-08-28  Jason Merrill  <jason@redhat.com>

        * dwarf2.h (DW_TAG_GNU_BINCL, DW_TAG_GNU_EINCL): New tags.
        * dwarf2out.c: #include "md5.h".
        (DIE_LABEL_PREFIX): New macro.
        (dw_val_struct): Add 'external' flag to val_die_ref.
        (add_AT_die_ref, AT_ref): Adjust.
        (AT_ref_external, set_AT_ref_external): New fns.
        (build_abbrev_table): Call set_AT_ref_external.
        (value_format): Call AT_ref_external.
        (die_struct): Add die_symbol field.
        (new_die): Clear it.
        (dwarf_tag_name): Handle BINCL/EINCL.
        (dwarf2out_start_source_file): Add BINCL DIE.
        (dwarf2out_end_source_file): Add EINCL DIE.
        (push_new_compile_unit, pop_compile_unit, clear_die_sizes): New fns.
        (loc_checksum, attr_checksum, die_checksum): New fns.
        (is_type_die, is_comdat_die, is_symbol_die): New fns.
        (compute_section_prefix, assign_symbol_names): New fns.
        (gen_internal_sym, output_die_symbol, output_symbolic_ref): New fns.
        (output_die): Call output_die_symbol and AT_ref_external.
        (output_comdat_comp_unit): New fn, split out from...
        (dwarf2out_finish): ...here.  Also call add_sibling_attributes for
        secondary CUs.
        (output_pubnames, output_aranges): Abort if we see entries from
        secondary CUs.
        * toplev.h: Declare file_name_nondirectory.
        * toplev.c (file_name_nondirectory): New fn, moved from C++ frontend.
        (rest_of_type_compilation): Call dwarf2out_decl if at toplevel.
        (debug_start_source_file): Call dwarf2out_start_source_file
        regardless of debug verbosity.
        (debug_end_source_file): Similarly.
        * tree.h: Declare clean_symbol_name.
        * tree.c (clean_symbol_name): Split out from...
        (get_file_function_name_long): ...here.

        * dwarf2out.c (new_loc_descr): Use calloc.
        (splice_child_die): Remove the die from the right parent.
        (gen_struct_or_union_die): Don't add AT_name to a specification DIE.

gcc/cp:
2000-08-28  Jason Merrill  <jason@redhat.com>

        * lex.c (file_name_nondirectory): Move to toplev.c.

libiberty:
2000-08-28  Jason Merrill  <jason@redhat.com>

        * Makefile.in (REQUIRED_OFILES): Add md5.o.
        (CFILES): Add md5.c.
        * md5.c: New file.

include:
2000-08-28  Jason Merrill  <jason@redhat.com>

        * md5.h: New file.

gcc/cp:
2000-08-28  Jason Merrill  <jason@redhat.com>

        * cp-tree.h (LOCAL_CLASS_P): New macro.
        * class.c (finish_struct_1): Use it.

From-SVN: r36022
2000-08-28 20:29:29 -04:00
Greg McGary
7ec09bf79b * cp-tree.h (MAIN_NAME_P): Remove macro.
From-SVN: r35946
2000-08-24 20:11:54 +00:00
Mark Mitchell
94350948fb cp-tree.h (DECL_CLONED_FUNCTION_P): Check DECL_LANG_SPECIFIC.
* cp-tree.h (DECL_CLONED_FUNCTION_P): Check DECL_LANG_SPECIFIC.
	* mangle.c (write_function_type): Change prototype.
	(write_encoding): Don't mangle return types for
	constructors or destructors.
	(write_type): Adjust call to write_function_type.
	* pt.c (instantiate_template): Instantiate alternate entry points
	when instantiating the main function.

From-SVN: r35916
2000-08-23 17:12:23 +00:00
Gabriel Dos Reis
cb753e4921 Makefile.in (error.o): Depends on diagnostic.h
* Makefile.in (error.o): Depends on diagnostic.h

	* cp-tree.h (problematic_instantiation_changed,
	record_last_problematic_instantiation, current_instantiation,
	print_instantiation_context): Declare.
	(maybe_print_template_context): Remove.

	* decl.c (init_decl_processing): Set print_error_function to NULL.
	(lang_print_error_function): Remove, since we're using a new
	machinery.

	* error.c: #include diagnostic.h
	(function_category): New function.
	(cp_diagnostic_starter): Likewise.
	(cp_diagnostic_finalizer): Likewise.
	(cp_print_error_function): Likewise.
	(maybe_print_instantiation_context): Likewise.
	(print_instantiation_full_context): Likewise.
	(print_instantiation_partial_context): Likewise.
	(print_instantiation_context): Define.
	(init_error): Initialize diagnostic pager and finalizer.

	* pt.c (problematic_instantiation_changed): Define.
	(record_last_problematic_instantiation): Likewise.
	(current_instantiation): Likewise.
	(maybe_print_template_context): Remove.
	(print_template_context): Likewise.
	(current_tinst_level): Make static to reflect Brendan Kehoe's
	change of 1995-04-13.
	(push_tinst_level): Call print_instantiation_context.

From-SVN: r35893
2000-08-22 20:26:41 +00:00
Nathan Sidwell
19420d00dc cp-tree.h (PTRMEM_OK_P): New macro.
* cp-tree.h (PTRMEM_OK_P): New macro.
	(itf_ptrmem_ok): New enumeration value.
	* class.c (resolve_address_of_overloaded_function): Add PTRMEM
	argument. Diagnose implicit pointer to member.
	(instantiate_type): Don't diagnose implicit pointer to member
	here. Pass itf_ptrmem_ok if ok. Adjust calls to
	resolve_address_of_overloaded_function.
	* init.c (build_offset_ref): Set PTRMEM_OK_P.
	(resolve_offset_ref): Don't diagnose implicit pointer to member here.
	* semantics.c (finish_parenthesized_expr): Clear OFFSET_REFs here.
	* typeck.c (build_x_unary_op): Calculate PTRMEM_OK_P.
	(build_unary_op): Deal with single non-static member in
	microsoft-land.

From-SVN: r35777
2000-08-18 09:31:11 +00:00