Commit Graph

181 Commits

Author SHA1 Message Date
Kaveh R. Ghazi bcb8072947 Warning fixes:
* Makefile.in (decl2.o): Depend on dwarf2out.h and dwarfout.h.
        * cp-tree.h: Add prototype for `maybe_print_template_context' and
        `maybe_make_one_only'.
        * decl.c (auto_function): Remove unused variable `decl'.
        * decl2.c: Include dwarf2out.h and dwarfout.h.
        * lex.c: Remove redundant declarations of `set_float_handler' and
        `asm_out_file'.

From-SVN: r20349
1998-06-08 17:52:39 +00:00
Martin v. Löwis 3e3f722c44 cp-tree.h (DECL_NAMESPACE_ALIAS, [...]): Declare.
* cp-tree.h (DECL_NAMESPACE_ALIAS, ORIGINAL_NAMESPACE): Declare.
	* decl.c (lookup_name_real): Add namespaces_only parameter.
	If set, return only NAMESPACE_DECLs.
	(select_decl): Likewise.
	(identifier_type_value): Give additional parameter.
	(lookup_name_nonclass): Likewise.
	(lookup_name): Likewise.
	(find_binding): Skip namespace aliases.
	(binding_for_name): Likewise.
	(push_namespace): Check for namespace aliases.
	(lookup_name_namespace_only): New function.
	(begin_only_namespace_names, end_only_namespace_names): New functions.
	* decl2.c (set_decl_namespace): Skip namespace aliases.
	(do_using_directive): Likewise.
	(do_namespace_alias): Produce namespace aliases, fix alias
	redeclaration.
	* error.c (dump_decl): Support SCOPE_REF.
	* parse.y (extdef): Wrap lookup with namespace_only for namespace
	aliases and using declarations.

From-SVN: r20236
1998-06-04 22:26:55 -04:00
Martin v. Löwis 0228fa7e4e decl2.c (do_toplevel_using_decl): When decl is a TYPE_DECL, treat it as using ::decl.
* decl2.c (do_toplevel_using_decl): When decl is a TYPE_DECL,
	treat it as using ::decl.

From-SVN: r20221
1998-06-03 22:13:29 -04:00
Martin v. Löwis 1813dd7bdd * decl2.c (arg_assoc_type): Process unknown_type_node and OFFSET_TYPE.
From-SVN: r20219
1998-06-03 21:35:57 -04:00
Jason Merrill 285baa062b error.c (dump_expr): Clean up NEW_EXPR case.
* error.c (dump_expr): Clean up NEW_EXPR case.
	* tree.c (mapcar): Support NEW_EXPR.
	* error.c (dump_expr): Support NEW_EXPR.
	* decl2.c (arg_assoc_type): Return 0 for LANG_TYPE.

From-SVN: r20218
1998-06-03 21:33:03 -04:00
Per Bothner eff71ab0ab cp-tree.h (TYPE_FOR_JAVA): New macro.
d
	* cp-tree.h (TYPE_FOR_JAVA):  New macro.
	* decl.c, cp-tree.h (java_byte_type_node, java_short_type_node,
	java_int_type_node, java_long_type_node, java_float_type_node,
	java_double_type_node, java_char_type_node, java_boolean_type_node):
	New "primitive" types, with predefined names __java_byte etc.
	(record_builtin_java_type):  New function.
	(init_decl_processing):  Make Java types with record_builtin_java_type.
	(pushtag, grokdeclarator):  Set TYPE_FOR_JAVA if in extern "JAVA".
	(xref_baseypes):  If base class was TYPE_FOR_JAVA, so is this class.
	(grokfndecl):  Call check_java_method for Java classes.
	* method.c (is_java_type):  Removed.  Replaced with TYPE_FOR_JAVA.
	(process_overload_item):  Match types against specific
	java_XX_type_node types, rather than using is_java_type.
	* class.c (finish_struct_1):  Don't add default copy constructor
	or operator= if TYPE_FOR_JAVA.
	(pop_lang_conext):  Restore strict_prototyp proper if Java.
	* decl2.c (acceptable_java_type, check_java_method):  New functions.
	* pt.c (instantiate_class_template):  Copy TYPE_FOR_JAVA from pattern.
	(tsubst):  Move common statement after if statement.
	* typeck.c (comptypes):  If strict, TYPE_FOR_JAVA must match.

From-SVN: r20174
1998-06-01 11:25:34 -07:00
Jason Merrill 711734a9c6 cp-tree.h (DECL_DESTRUCTOR_P): New macro.
* cp-tree.h (DECL_DESTRUCTOR_P): New macro.
	* method.c (build_destructor_name): New fn.
	* decl2.c (maybe_retrofit_in_chrg): Split out...
	(grokclassfn): From here.  Reorganize.
	* decl.c (grok_ctor_properties): Make sure ctors for types with
	vbases have the in_chrg parm.
	* pt.c (instantiate_class_template): Update
	TYPE_USES_VIRTUAL_BASECLASSES from tsubsted bases.  Don't call
	grok_*_properties.
	(tsubst): Call grok_ctor_properties and maybe_retrofit_in_chrg.
	* pt.c (instantiate_decl): Make test for whether or not static
	variables should be instantiated early match its comment.

From-SVN: r20136
1998-05-28 22:33:54 -04:00
Jason Merrill b7698cf042 decl.c (start_decl): Always pedwarn about vacuously redeclaring a member.
* decl.c (start_decl): Always pedwarn about vacuously redeclaring
	a member.
	(start_function): Call check_default_args.
	* decl2.c (grokfield): Don't call check_default_args.
	(check_default_args): Use cp_error_at.
	* lex.c (do_pending_defargs): Call check_default_args.
	* call.c (build_scoped_method_call): Make sure get_type_value returns
	something before we try to use its TYPE_MAIN_VARIANT.

From-SVN: r20113
1998-05-27 21:44:29 -04:00
Mark Mitchell 67ffc8124f decl2.c (build_anon_union_vars): Don't crash on empty sub-unions.
1998-05-25  Mark Mitchell  <mark@markmitchell.com>
	* decl2.c (build_anon_union_vars): Don't crash on empty sub-unions.
	* cp-tree.h (processing_template_parmlist): Declare.
	* decl.c (pushtag): Don't call push_template_decl when we
	shouldn't.
	* pt.c (processing_template_parmlist): New variable.
	(TMPL_ARGS_HAVE_MULTIPLE_LEVELS): New macro.
	(complete_template_args): Use it.
	(add_to_template_args): Likewise.
	(innermost_args): Likewise.
	(tsubst): Likewise.
	(begin_template_parm_list): Use processing_template_parmlist.
	(end_template_parm_list): Likewise.
	* cp-tree.h (ANON_UNION_TYPE_P): New macro.
	* decl.c (grokdeclarator): Use it.
	* decl2.c (grok_x_components): Likewise.
	* init.c (initializing_context): Likewise.
	* method.c (do_build_copy_constructor): Likewise.
	(do_build_assign_ref): Likewise.
	* search.c (compute_access): Likewise.
	* typeck.c (build_component_ref): Likewise.
	* decl.c (grokdeclarator): Don't give a cv-qualified version of an
	unnamed type a typedef name "for linkage purposes".
	* pt.c (lookup_template_class): Don't look at
	IDENTIFIER_CLASS_VALUE when there's no current_class_type.
	* method.c (build_overload_int): Handle error cases gracefully.
	* pt.c (instantiate_decl): Handle static member variables
	correctly.
	* pt.c (tsubst): Use the tsubst'd type when producing new
	TEMPLATE_PARM_INDEX nodes.

From-SVN: r20045
1998-05-25 10:28:16 +00:00
Jason Merrill 1139b3d870 cp-tree.def: Add SRCLOC.
* cp-tree.def: Add SRCLOC.
	* cp-tree.h: Add struct tree_srcloc and accessor macros.
	* tree.c (build_srcloc, build_srcloc_here): New fns.
	* pt.c (add_pending_template): Use build_srcloc_here.
	(push_tinst_level): Update last_template_error_tick before erroring.
	(instantiate_decl): Restore lineno and input_filename before
	calling add_pending_template.
	* decl2.c (finish_file): Set up lineno and input_filename for
	pending templates.

From-SVN: r19967
1998-05-22 22:18:33 -04:00
Jason Merrill b385c8412e decl2.c (maybe_make_one_only): New fn.
* decl2.c (maybe_make_one_only): New fn.
	(import_export_vtable): Use it.
	(import_export_decl): Likewise.
	* pt.c (mark_decl_instantiated): Likewise.

From-SVN: r19921
1998-05-21 01:42:51 -04:00
Mark Mitchell cb96daa2dc decl2.c (find_representative_member): Rename to ...
* decl2.c (find_representative_member): Rename to ...
	(build_anon_union_vars): New function.
	(finish_anon_union): Fix stupidity of previous change.

From-SVN: r19920
1998-05-21 00:48:49 +00:00
Mark Mitchell ce1b9eb9a8 decl2.c (find_representative_member): New function.
* decl2.c (find_representative_member): New function.
	(finish_anon_union): Use it.

From-SVN: r19910
1998-05-20 11:03:18 +00:00
Jason Merrill 961ec1a55f decl2.c (start_objects, [...]): Split out from...
* decl2.c (start_objects, finish_objects, do_dtors,
	do_ctors): Split out from...
	(finish_file): ...here.

From-SVN: r19904
1998-05-19 22:46:16 -04:00
Jason Merrill 88537ff2d0 decl2.c (get_sentry): Use end_temporary_allocation.
* decl2.c (get_sentry): Use end_temporary_allocation.
	Don't declare permanent_obstack.

From-SVN: r19858
1998-05-18 19:23:05 -04:00
Kaveh R. Ghazi 7dee3f36c6 Warning patches:
* Makefile.in (lex.o): Depend on output.h.
        * call.c (add_function_candidate): Remove unused variable `cand'.
        (add_conv_candidate): Likewise.
        (build_builtin_candidate): Likewise.
        * cp-tree.h: Add prototype for `types_overlap_p'.
        * decl.c (signal_catch): Mark parameter `sig' with ATTRIBUTE_UNUSED.
        * decl2.c (merge_functions): Remove unused variables `tmp' and
        `tempn'.
        * error.c (expr_as_string): Mark parameter `v' with ATTRIBUTE_UNUSED.
        (code_as_string): Likewise.
        (language_as_string): Likewise.
        (parm_as_string): Likewise.
        (op_as_string): Likewise.
        (assop_as_string): Likewise.
        (cv_as_string): Likewise.
        * lex.c: Include output.h.
        * pt.c (type_unification): Cast first argument of `bzero' to a char*.
        * search.c (dfs_no_overlap_yet): Mark parameter `t' with
        ATTRIBUTE_UNUSED.
        * tinfo.cc (__class_type_info::dcast): Change the type of variable
        `i' from int to size_t.
        * typeck.c (language_lvalue_valid): Mark parameter `exp' with
        ATTRIBUTE_UNUSED.

From-SVN: r19707
1998-05-13 10:00:46 +00:00
Jason Merrill 42c7b8075d class.c (finish_struct_1): Use OVL_CURRENT on TREE_VEC_ELT.
* class.c (finish_struct_1): Use OVL_CURRENT on TREE_VEC_ELT.
	* decl2.c (constructor_name_full): Likewise.
	* tree.c (mapcar): Add OVERLOAD support.
	* init.c (resolve_offset_ref): We must use basetype_path before we
	destroy it with a call to convert_pointer_to.

From-SVN: r19656
1998-05-10 18:53:45 -04:00
Martin v. Löwis 2c73f9f57a massive namespace patch
From-SVN: r19631
1998-05-07 22:06:26 -04:00
Jeff Law 38e012594e typo typo fixes fixes
From-SVN: r19601
1998-05-06 15:09:07 -06:00
Robert Lipe 54f92bfbb1 call.c, [...]: Add include of toplev.h.
Wed May  6 06:36:41 1998  Robert Lipe  <robertl@dgii.com>
        * cp/call.c, cp/class.c, cp/decl.c, cp/decl2.c,
        cp/errfn.c, cp/error.c, cp/except.c, cp/expr.c,
        cp/friend.c, cp/init.c, cp/lex.c, cp/method.c,
        cp/pt.c, cp/repo.c, cp/rtti.c, cp/search.c,
        cp/semantics.c, cp/sig.c, cp/tree.c, cp/typeck.c,
        cp/typeck2.c, cp/xref.c: Add include of toplev.h.

From-SVN: r19565
1998-05-06 05:01:35 +00:00
Brendan Kehoe 9ac1d79d9d * decl2.c (ambiguous_decl): Fix NAME parm to be a tree, not int.
From-SVN: r19466
1998-04-28 03:33:51 -04:00
Mark Mitchell 6757edfe65 cp-tree.h (CLASSTYPE_IS_TEMPLATE): New macro.
* cp-tree.h (CLASSTYPE_IS_TEMPLATE): New macro.
	(DECL_CLASS_TEMPLATE_P): Likewise.
	(DECL_PRIMARY_TEMPLATE): Likewise.
	(PRIMARY_TEMPLATE_P): Use it.
	(push_template_decl_real): New function.
	(redeclare_class_template): Take new template parameters as
	input.
	(is_specialization_of): New function.
	(comp_template_args): Declare.
	* decl.c (pushtag): Handle friend template classes.
	(xref_tag): Likewise.  Use new calling convention for
	redeclare_class_template.
	* decl2.c (grok_x_components): Handle friend templates.
	* friend.c (is_friend): Use is_specialization_of where
	appropriate.  Deal with friend class templates.
	(make_friend_class): Let a class template be friends with itself.
	* pt.c (comp_template_args): Remove declaration.
	(tsubst_friend_class): New function.
	(push_template_decl_real): New function.
	(push_template_decl): Use it.
	(redeclare_class_template): Adjust for new calling convention.
	(comp_template_args): Give it external linkage.
	(instantiate_class_type): Use tsubst_friend_class to deal
	with friend templates.
	* typeck.c (comptypes): Use comp_template_args, rather than
	expanding it inline.
	* parse.y (component_decl): Handle a nested template type
	like other component type declarations.

From-SVN: r19418
1998-04-26 16:30:11 +00:00
Mark Mitchell 61cd123468 * decl2.c (grokfield): Remangle the name of a member TYPE_DECL.
From-SVN: r19369
1998-04-21 22:08:05 +00:00
Mark Mitchell 1701f21e52 decl2.c (check_member_template): Set DECL_IGNORED for member class templates, too.
* decl2.c (check_member_template): Set DECL_IGNORED for member
	class templates, too.

From-SVN: r19368
1998-04-21 22:03:34 +00:00
Jason Merrill 9577319f92 decl2.c (lang_decode_option): -fnew-abi implies -fvtable-thunks.
* decl2.c (lang_decode_option): -fnew-abi implies -fvtable-thunks.
	* typeck.c (comp_target_types): Tweak pedantic case.
	(comp_target_parms): Tweak pedantic case.  Clean up somewhat.
	Return -1 or 1 instead of 1 or 2.
	(compparms): Remove STRICT handling.
	* typeck.c (comp_target_types): Handle references like pointers.
	(comp_target_parms): Note that return code from comp_target_types
	can be negative to indicate failure.

From-SVN: r19268
1998-04-17 11:29:46 -04:00
Jeffrey A Law 69ac77ce5e tree.c (avoid_overlap): Add prototype.
* tree.c (avoid_overlap): Add prototype.
        * spew.c (num_tokens): Add prototype.
        (nth_noken, add_token, consume_token, debug_yychar): Likewise.
        * search.c (dfs_check_overlap): Add prototype.
        (dfs_no_overlap_yet): Likewise.
        * pt.c (original_template): Add prototype.
        (inline_needs_template_parms): Likewise.
        (push_inline_template_parms_recursive): Likewise.
        (retrieve_specialization, register_specialization): Likewise.
        (print_candidates, reduce_template_parm_level): Likewise.
        (build_template_decl, mark_template_parm): Likewise.
        (tsubst_friend_function, get_bindings_real): Likewise.
        * method.c (start_squangling): Add prototype.
        (end_squangling, check_ktype, issue_ktype): Likewise.
        (build_overloaded_scope_ref, check_btype): Likewise.
        (build_mangled_template_parm_index): Likewise.
        * lex.c (init_cpp_parse): Add prototype.
        (handle_cp_pragma, handle_sysv_pragma): Likewise.
        (reduce_cmp, token_cmp): Likewise.
        * except.c (call_eh_info): Add prototype.
        (push_eh_info, get_eh_info, get_eh_value, get_eh_type): Likewise.
        (get_eh_caught, get_eh_handlers, do_pop_exception): Likewise.
        * decl2.c (is_namespace_ancestor): Add prototype.
        (namespace_ancestor, add_using_namespace): Likewise.
        (ambiguous_decl): Likewise.
        * decl.c (indent): Add prototype.
        * call.c (add_template_candidate_real): Add prototype.

From-SVN: r19259
1998-04-17 02:05:26 -06:00
Jason Merrill 2fcdec5719 * decl2.c (build_expr_from_tree): Just return a PMF.
From-SVN: r19256
1998-04-16 21:57:57 -04:00
Jason Merrill a59ca93678 call.c (build_call): Still evaluate the actual argument.
* call.c (build_call): Still evaluate the actual argument.
	* class.c (is_empty_class): Update for -fnew-abi.
	* decl2.c: -fnew-abi implies -fsquangle.
	* method.c (do_build_assign_ref): Don't do anything to copy
	an empty class.
	(do_build_copy_constructor): Likewise.
	* call.c (build_over_call): Likewise.

From-SVN: r19029
1998-04-06 23:48:22 -04:00
Jason Merrill 732dcb6f2a Implement empty base optimization.
* class.c (finish_struct_1): Add vbase fields earlier.  Set
	CLASSTYPE_SIZE of an empty base to 0.  Types with bases can be empty.
	* search.c (dfs_check_overlap, dfs_no_overlap_yet): New fns.
	(types_overlap_p): New fn.
	* tree.c (avoid_overlap): New fn.
	(build_base_fields): Use it to avoid overlapping empty bases.
	* cp-tree.h, decl2.c, lang-options.h: Add -fnew-abi.

From-SVN: r18978
1998-04-03 09:13:24 -05:00
Jason Merrill 0b41abe668 cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff.
* cp-tree.h: Lose CLASSTYPE_VBASE_SIZE, some unused stuff.
	* decl.c, decl2.c, pt.c, ptree.c, lex.c: Likewise.
	* class.c (duplicate_tag_error): Likewise.
	(finish_struct_1): Set CLASSTYPE_SIZE, CLASSTYPE_MODE, CLASSTYPE_ALIGN.
	* tree.c (layout_vbasetypes): Update from layout_record, remove
	var_size support, use CLASSTYPE_SIZE instead of CLASSTYPE_VBASE_SIZE.
	(layout_basetypes): Likewise.

From-SVN: r18965
1998-04-02 12:05:40 -05:00
Jeffrey A Law 8d052bc70c call.c: Include system.h.
* call.c: Include system.h.  Remove includes, declarations and
        defines provided by system.h.
        * class.c, cvt.c, decl.c, decl2.c, errfn.c error.c: Likewise.
        * except.c, expr.c friend.c, g++spec.c, init.c, input.c: Likewise.
        * lex.c, parse.y, pt.c, ptree.c repo.c rtti.c, search.c: Likewise.
        * semantics.c, sig.c, spew.c, tree.c, typeck.c: Likewise.
        * typeck2.c, xref.c: Likewise.
        * Makefile.in: Dependencies updated as appropriate.
        * Make-lang.in: Likewise.
system.h cutover from the cp subdir

From-SVN: r18917
1998-03-31 06:25:46 -07:00
Jason Merrill f94ae2f5c0 tree.c (member_p): New fn.
* tree.c (member_p): New fn.
	* decl2.c (finish_file): Only set DECL_STATIC_FUNCTION_P for
	initializing class members.
	* cp-tree.def (TEMPLATE_PARM_INDEX): Class 'x'.
	* ptree.c (lang_print_xnode): Handle TEMPLATE_PARM_INDEX.

From-SVN: r18909
1998-03-30 05:56:25 -05:00
Jason Merrill 97e7cbe4fb * decl2.c (constructor_name_full): Handle TYPENAME_TYPE.
From-SVN: r18814
1998-03-24 21:05:53 -05:00
Manfred Hollstein 56c5d8bf10 d
In gcc/:
	* bitmap.c (bitmap_element_allocate): Remove unused parameter;
	change callers accordingly.
	* cplus-dem.c (arm_special): Remove unused parameter work in prototype
	and definition; change all callers accordingly.
	* except.c (init_eh): Avoid assignment of unused return value of
	build_pointer_type; cast it to void, instead, and remove unused
	variable type.
	* gcc.c (lang_specific_driver): Define prototype only #ifdef
	LANG_SPECIFIC_DRIVER.
	(temp_names): Define only #ifdef MKTEMP_EACH_FILE.
	* genoutput.c (output_epilogue): Initialize next_name to 0.
	* real.c (efrexp): #if 0 prototype and function definition.
	(eremain): Likewise.
	(uditoe): Likewise.
	(ditoe): Likewise.
	(etoudi): Likewise.
	(etodi): Likewise.
	(esqrt): Likewise.
	* reload.c (push_secondary_reload): Define prototype only
	#ifdef HAVE_SECONDARY_RELOADS.
	* varasm.c (assemble_static_space): Define rounded only
	#ifndef ASM_OUTPUT_ALIGNED_LOCAL.
In gcc/cp/:
	* call.c (default_parm_conversions): Remove prototype definition.
	(build_method_call): Remove unused variable result.
	* cvt.c (ocp_convert): Remove unused variable conversion.
	* decl2.c (ambiguous_decl): Add explicit parameter definition for name.
	* except.c (do_unwind): #if 0 definition of unused variables fcall
	and next_pc.
	* expr.c (extract_scalar_init): #if 0 prototype and function definition.
	* init.c (expand_aggr_init_1): Remove unused variable init_type.
	(build_new_1): Remove unused variable t.
	* pt.c (instantiate_class_template): Remove unused variable newtag;
	cast called function return value to void.
	(do_decl_instantiation): Remove unused variables name and fn.
	* tree.c (get_type_decl): Add default return to shut up compiler from
	complaining control reaches end of non-void function.
	* typeck.c (build_x_conditional_expr): Remove unused variable rval.

From-SVN: r18498
1998-03-12 00:29:17 +00:00
Manfred Hollstein 8506650392 c-decl (finish_struct): Change type of min_align to unsigned.
d
gcc/ChangeLog:
	* c-decl (finish_struct): Change type of min_align to unsigned.
	* cplus-dem.c (demangle_function_name): Change type of variable i to size_t;
	remove unused variable len.
	* dwarf2out.c (reg_save): Add explicit cast of -1 to unsigned and a
	comment indicating this is proper behaviour.
	(reg_loc_descriptor): Remove redundant comparison of unsigned variable
	reg >= 0.
	(based_loc_descr): Likewise.
	* enquire.c (bitpattern): Change type of variable i to unsigned.
	* final.c (output_asm_insn): Don't cast insn_noperands to unsigned.
	* flow.c (life_analysis): Change type of variable i to size_t;
	remove unused variable insn.
	* gcc.c (translate_options): Change type of variables optlen, arglen and
	complen to size_t.
	(input_filename_length): Change type to size_t.
	(do_spec_1): Change type of variable bufsize to size_t.
	(main): Change type of variables i and j to size_t;
 	remove subblock local definition of variable i.
	(lookup_compiler): Change type of second argument to size_t;
	change type of variable i to size_t.
	* genemit.c (output_init_mov_optab): Change type of variable i to size_t.
	* genopinit.c (get_insn): Change type of variable pindex to size_t.
	* genrecog.c (add_to_sequence): Change type of variable i to size_t.
	* global.c (global_alloc): Change type of variable i to size_t.
	* regclass.c (init_reg_sets): Change type of variables i and j to unsigned.
	* stmt.c (expand_end_bindings): Change type of variable i to size_t.
	(expand_end_case): Change type of variable count to size_t.
	* toplev.c (main): Change type of variable j to size_t.
	(set_target_switch): Change type of variable j to size_t.
	(print_switch_values): Change type of variable j to size_t;
	remove unused variable flags.
	* varasm.c (assemble_variable): Change type of variable align to size_t.
	(const_hash_rtx): Change type of variable i to size_t.
gcc/cp/ChangeLog:
Sun Mar  8 17:13:38 1998  Manfred Hollstein  <manfred@s-direktnet.de>
	* decl2.c (lang_decode_option): Change j's type to size_t.
	* tree.c (layout_vbasetypes): record_align and desired_align are of
	type unsigned int; const_size and nonvirtual_const_size likewise.

From-SVN: r18490
1998-03-12 00:02:51 +00:00
Mark Mitchell af9c2d8a25 decl2.c (import_export_decl): Mark tinfo functions for cv-qualified versions of class types as...
Tue Mar 10 07:32:36 1998  Mark Mitchell  <mmitchell@usa.net>
	* decl2.c (import_export_decl): Mark tinfo functions for
	cv-qualified versions of class types as DECL_NOT_REALLY_EXTERN.

From-SVN: r18456
1998-03-10 07:32:11 +00:00
Jason Merrill 3c21589560 cvt.c, [...]: Clean up more old overloading code, old RTTI code, and some formatting quirks.
* cvt.c, decl.c, decl2.c, init.c, rtti.c, typeck.c, typeck2.c,
	cp-tree.h: Clean up more old overloading code, old RTTI code, and
	some formatting quirks.

From-SVN: r18391
1998-03-03 17:27:04 -05:00
Jason Merrill 277294d73b call.c, [...]: Remove support for -fno-ansi-overloading and overloading METHOD_CALL_EXPR.
* call.c, class.c, cp-tree.h, cvt.c, decl.c, init.c, lex.c,
	method.c, pt.c, ptree.c, typeck.c: Remove support for
	-fno-ansi-overloading and overloading METHOD_CALL_EXPR.
	* class.h: Remove.
	* Makefile.in: Adjust.

From-SVN: r18384
1998-03-02 22:24:44 -05:00
Jason Merrill 8d019cef1a Support partial specialization of member class templates.
* pt.c (get_class_bindings): Add outer_args parm.
	(most_specialized_class): Likewise.
	(instantiate_class_template): Pass it.
	(more_specialized_class): Likewise.
	(lookup_template_class): Get context from template if none
	was specified.
	(finish_member_template_decl): Don't do anything with a
	partial specialization.
	* decl2.c (check_member_template): Use IS_AGGR_TYPE instead of
	AGGREGATE_TYPE_P.
	* class.c (finish_struct): Member class templates have already been
	checked for name clashes.
	* decl.c (pushdecl_with_scope): Handle pushing at class level.

From-SVN: r18285
1998-02-27 07:15:17 -05:00
Jason Merrill 93cdc044ea pt.c (tsubst, [...]): Support member class templates.
* pt.c (tsubst, TEMPLATE_DECL): Support member class templates.
	(tsubst, *_PARM): Support multiple levels of template classes.
	(instantiate_class_template): Look up the pattern from the
	original template.
	(lookup_template_class): Handle getting a template for d1.
	(push_template_decl): Correct setting of 'primary'.
	(reduce_template_parm_level): Add 'levels' parm.
	(finish_member_template_decl): Support member class templates.
	(template_class_depth): Handle multiple levels.
	* parse.y (component_decl_1, fn.def2): Remove member template case.
	(component_decl): Add member template cases.
	* decl2.c (check_member_template): We now handle member template
	classes.
	* decl.c (pushtag): Handle member templates.
	* method.c (do_inline_function_hair): Don't touch
	IDENTIFIER_GLOBAL_VALUE.
	* init.c (build_offset_ref): If name isn't an identifier, just
	return it.
	* spew.c (yylex): Handle PTYPENAME like TYPENAME.
	* typeck.c (get_delta_difference): Do adjust for conversions to
	and from virtual base.

From-SVN: r18280
1998-02-26 21:27:38 -05:00
Jason Merrill 30394414d9 Partial implementation of namespaces.
* decl.c (push_namespace): Handle redeclaration error.
	* cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro.
	(IDENTIFIER_NAMESPACE_BINDINGS): New macro.
	(NAMESPACE_BINDING): New macro.
	(IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING.
	* *.c: Use them.
	* pt.c (push_template_decl): Use innermost_args.
	* decl.c (get_unique_name): Tweak from earlier in the name.
	* cp-tree.def: Add CPLUS_BINDING node.
	* cp-tree.h (tree_binding): new struct
	(BINDING_SCOPE, BINDING_VALUE): new macros
	(current_namespace, global_namespace): declare extern
	(struct lang_decl_flags): new field in_namespace
	(DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros
	(DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros
	(TREE_INDIRECT_USING): new macro
	* decl2.c (current_namespace, global_namespace): Declare.  The
	value is a NAMESPACE_DECL now, not a TREE_LIST.
	(is_namespace_ancestor, namespace_ancestor):new static functions.
	(add_using_namespace, ambiguous_decl): likewise.
	(lookup_using_namespace): new support function for lookup_name.
	(qualified_lookup_using_namespace): new support function for
	do_scoped_id and lookup_namespace_name
	(get_namespace_id): mark as obsolete.
	(current_namespace_id): Likewise.
	(do_namespace_alias): Implement.
	(do_using_directive): Implement as call to add_using_namespace.
	* decl.c (binding_for_name): new function.
	(push_namespace, pop_namespace): implement.
	(push_decl): don't install a FUNCTION_DECL in the global branch.
	(lookup_namespace_name): implement using qualified lookup.
	(lookup_name_real): For global scoping, lookup in
	global_namespace. For namespace scoping, lookup in given
	namespace. For unscoped lookup, iterate over namespace,
	considering using directives.
	(init_decl_processing): initialize global_namespace.
	(grokvardecl): Build assembler name as static name for globals.
	(grokdeclarator): Remove old namespace mangling.
	(xref_tag): When installing a global binding for the
	tag, make sure we have an identifier.
	* method.c (build_overload_nested_name): mangle namespaces.
	(build_qualified_name): Likewise.
	(build_decl_overload_real): Likewise.
	* lex.c (build_lang_decl): set namespace for new declaration to
	current_namespace.
	(do_scoped_id): find global names in global or current
	namespace, or using qualified namespace lookup, depending on
	context.
	* init.c (build_member_call): When scope is namespace, use
	build_x_function_call instead.
	(build_offset_ref): When scope is namespace, collapse processing
	to lookup_namespace_name instead.
	* error.c (dump_decl): Support NAMESPACE_DECL.
	* decl.c (pushdecl): Bind globals to current namespace.
	(push_overloaded_decl): Likewise.
	(lookup_tag): Likewise.
	(lookup_name_current_level): Likewise.
	(xref_tag): Likewise.
	(start_function): Likewise.
	* lex.c (do_identifier): Likewise.
	(identifier_typedecl_value): Likewise.
	(real_yylex): Likewise.
	* method.c (do_inline_function_hair): Likewise.
	* parse.y (unscoped): Likewise.
	* pt.c (check_explicit_specialization): Likewise.
	(lookup_template_class): Likewise.
	* rtti.c (call_void_fn): Likewise.
	* sig.c (build_sigtable): Likewise.
	* ptree.c (lang_print_xnode): New function.

From-SVN: r18227
1998-02-24 19:49:51 -05:00
Jason Merrill f84b4be9a7 Support for friend templates.
* typeck.c (build_x_function_call): Handle static member function
	templates like non-templates.  Handle friend templates like normal
	function templates.
	* pt.c (tsubst, *_PARM): Don't use orig_level.
	(get_bindings): Don't call add_to_template_args.
	(instantiate_template): Likewise.
	(tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate.
	* ptree.c (print_lang_type): Print index/level for template parms.
	* Make-lang.in (cc1plus): Note that cc1plus depends on
	cp/cp-tree.h and cp/cp-tree.def.
	* cp-tree.def (TEMPLATE_CONST_PARM): Remove.
	(TEMPLATE_PARM_INDEX): New tree code, used to indicate a
	position in a template parameter list.
	* cp-tree.h (template_parm_index): New structure, used as the tree
	structure for a TEMPLATE_PARM_INDEX.
	(TEMPLATE_PARM_IDX): New macro.
	(TEMPLATE_PARM_LEVEL): Likewise.
	(TEMPLATE_PARM_DESCENDANTS): Likewise.
	(TEMPLATE_PARM_ORIG_LEVEL): Likewise.
	(TEMPLATE_PARM_DECL): Likewise.
	(TEMPLATE_TYPE_PARM_INDEX): Likewise.
	(TEMPLATE_TYPE_ORIG_LEVEL): Likewise.
	(TEMPLATE_TYPE_DECL): Likewise.
	(TEMPLATE_CONST_IDX): Remove.
	(TEMPLATE_CONST_LEVEL): Likewise.
	(TEMPLATE_CONST_SET_INFO): Likewise.
	(TEMPLATE_TYPE_SET_INFO): Likewise.
	(TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX
	node.
	(TEMPLATE_TYPE_LEVEL): Likewise.
	* decl.c (decls_match): Call comp_template_parms, rather than
	expanding it inline.
	(duplicate_decls): If two template declarations are being merged,
	then their TEMPLATE_INFOs should be merged as well.
	(grokfndecl): Save template-id information when declaring a friend
	with explicit template arguments.  Pass arguments to
	check_explicit_specialization via correct convention; at some
	point check_explicit_specialization changed, but these call-sites
	did not.
	(grokdeclarator): Tidy up slightly.
	* decl2.c (check_classfn): Tidy up slightly.  Don't assume that
	two template functions with the same DECL_ASSEMBLER_NAME the same,
	since the names are not yet mangled.
	* error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of
	TEMPLATE_CONST_PARM.
	(dump_expr): Likewise.  Use the TEMPLATE_PARM_DECL to get at the
	decl for a non-type parameter, rather than printing `<tparm ...>'.
	* friend.c (is_friend): Handle TEMPLATE_DECL friends.
	(do_friend): Deal with template friends.
	* lex.c (do_pending_inlines): Call
	maybe_begin_member_template_processing, rather than
	conditionally calling begin_member_template_processing.
	(process_next_inline): Likewise.  Call
	maybe_end_member_template_processing, rather than
	conditionally calling end_member_template_processing.
	(do_pending_defargs): Likewise.
	(do_identifier): Use TEMPLATE_PARM_INDEX instead of
	TEMPLATE_CONST_PARM.
	* method.c (build_mangled_template_parm_index): New function.
	(build_overload_value): Use it.
	(build_overload_name): Likewise.
	* pt.c (finish_member_template_decl): Allow friend declarations.
	(template_class_depth): New function.
	(is_member_template): Rename, and modify, to become...
	(is_member_or_friend_template): New function.
	(end_member_template_processing): Rename, and modify, to become...
	(maybe_end_member_template_processing).
	(build_template_parm_index): New function.
	(reduce_template_parm_level): New function.
	(process_template_parm): Modify to use build_template_parm_index.
	(current_template_args): Change name to current_template_parms.
	(push_template_decl): Deal with friend templates.
	(uses_template_parms): Use TEMPLATE_PARM_INDEX instead of
	TEMPLATE_CONST_PARM.
	(tsubst_friend_function): New function.
	(instantiate_class_template): Generate the DECL_FRIENDLIST
	for a new instantiation by using tsubst_friend_function rather
	than just tsubst.
	(tsubst): Don't tsubst into a type which is a TEMPLATE_DECL.
	Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the
	appropriate new macros.  Use reduce_template_parm_level to
	generate lower-level template parameters.  Handle tsubst'ing into
	TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS.  Don't forget
	to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created
	templates.  Similarly for the template parameters for a new
	template.
	(tsubst_copy): Tidy up slightly.  Use TEMPLATE_PARM_INDEX instead
	of TEMPLATE_CONST_PARM.  Handle TYPE_DECLs by tsubsting into them.
	(unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM.
	(get_bindings): Call add_to_template_args if necessary.
	(instantiate_decl): Handle instantiations of friend templates.
	* search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a
	TEMPLATE_TYPE_PARM as a list of fields; it's not!
	* spew.c (yylex): Do a little manual constant propogation to
	clarify the code.

From-SVN: r18198
1998-02-22 22:17:44 -05:00
Mark Mitchell 3ac3d9eaf1 cp-tree.h (push_template_decl): Return the decl passed in, or an equivalent duplicate.
* cp-tree.h (push_template_decl): Return the decl passed in, or an
	equivalent duplicate.
	* decl.c (pushtag): Use the return value from push_template_decl.
	(duplicate_decls): When duplicating a template declaration, merge
	the DECL_TEMPLATE_RESULTs as well.
	(make_implicit_typename): Don't try to dive into typename types to
	find a context for making a new implicit typename.
	(start_decl): Use the return value from push_template_decl.
	(grokdeclarator): Complain about declarations list `const operator
	int'.  Since we don't correctly handle in-class initializations of
	non-static data members, complain about this (now illegal)
	practice.  Issue an error for initializations of non-const statics
	since that is illegal as well, and since we don't handle that case
	correctly either.
	(start_function): Use the return value from push_template_decl.
	(start_method): Likewise.
	* decl2.c (grokfield): Likewise.  Since the change to
	grokdeclarator ensures that all initialized fields are in fact
	static, remove a redundant test for TREE_PUBLIC.
	* parse.y (initlist): Disable labeled initializers since they do
	not work as per the documentation, and since they do not use the
	same syntax as the C front end.
	* pt.c (push_template_decl): Return the decl passed in, or an
	equivalent duplicate.
	(lookup_template_class): When searching in a nested context,
	use the right arguments.
	(uses_template_parms): Handle the DECL_INITIAL for a CONST_DECL.
	* typeck.c (build_component_ref): Assign the correct type to the
	result of build_vfn_ref.

From-SVN: r17852
1998-02-10 20:22:36 -05:00
Andrew Macleod 1d9ffce9c5 Add -fsquangle to option processing list.
From-SVN: r17829
1998-02-10 12:31:27 +00:00
Mark Mitchell 9c0d03672f cvt.c (ocp_convert): Obtain the constant values from constant decls even if...
* cvt.c (ocp_convert): Obtain the constant values from constant
	decls even if the destination type is the same as the type of the
	decl.
	* decl2.c (finish_file): Make sure that static inlines with
	definitions are not marked DECL_EXTERNAL before returning.

From-SVN: r17653
1998-02-03 18:55:27 -05:00
Mark Mitchell 8857f91e00 cp-tree.h (DECL_NONSTATIC_MEMBER_FUNCTION_P): New macro.
* cp-tree.h (DECL_NONSTATIC_MEMBER_FUNCTION_P): New macro.
	(revert_static_member_fn): Declare.
	* decl.c (revert_static_member_fn): Remove declaration.  Change
	linkage from internal to external.
	(cp_finish_decl): Deal with virtual functions in classes local to
	template functions.
	* decl2.c (finish_file): Don't forget to emit increment/decrement
	expressions in initializers for file-scope variables.
	* parse.y (typename_sub2): If the typename doesn't names a
	template, rather than a type, issue an error message.
	* pt.c (check_explicit_specialization): Handle specializations of
	static member functions.
	(coerce_template_parms): Handle offset references to lists of
	member functions.
	* search.c (note_debug_info_needed): Don't crash when handed a
	type which is being defined.
	* typeck.c (complete_type): Don't crash when handed NULL_TREE;
	that can happen with some illegal code.

From-SVN: r17598
1998-02-02 06:41:39 -05:00
Kaveh R. Ghazi a703fb388b Various fixes for -Wall problems from Kaveh. See ChangeLog for details.
From-SVN: r17586
1998-02-01 17:04:13 -07:00
J"orn Rennecke f5426d1e9b decl.c (init_decl_processing): Use set_sizetype.
* decl.c (init_decl_processing): Use set_sizetype.
        * decl2.c (sizetype): Don't declare.
        * typeck.c (c_sizeof): Convert result of *_DIV_EXPR to sizetype.
        (c_sizeof_nowarn, build_binary_op_nodefault): Likewise.
        (build_component_addr, unary_complex_lvalue): Likewise.
        * rtti.c (expand_class_desc): Likewise.
        * class.c (get_vfield_offset): Likewise.

From-SVN: r17576
1998-02-01 04:45:10 -07:00
Jason Merrill abff8e0691 class.c (instantiate_type): Don't just return a known type if it's wrong.
* class.c (instantiate_type): Don't just return a known type if
 	it's wrong.
	* class.c (instantiate_type): Remove handling of FUNCTION_DECL
	since that code could never be reached.
	* error.c (dump_decl): Avoid aborting in the midst of printing an
	error message about an illegal template declaration.
	* parse.y (structsp): Print an error message, rather than crashing,
	when a class-head does not name a class.
	* pt.c (convert_nontype_argument):  Allow REAL_TYPE and COMPLEX_TYPE
	template arguments as a g++ extension.
	* cp-tree.def (ALIGNOF_EXPR): New tree code.
	* decl2.c (grok_alignof): If processing_template_decl, just store
	the expression.
	* typeck.c (c_alignof): Likewise.
	* decl2.c (build_expr_from_tree): Handle ALIGNOF_EXPR.
	* error.c (dump_expr): Likewise.
	* pt.c (tsubst_copy): Likewise.
	* tree.c (cp_tree_equal): Likewise.
	* pt.c (uses_template_parms): Correctly determine whether or not a
	SIZEOF_EXPR/ALIGNOF_EXPR uses template parameters so that constant
	folding can be done.

From-SVN: r17545
1998-01-28 19:08:53 -05:00
Jason Merrill 86052cc3d8 cp-tree.h (grok_enum_decls): Remove type parameter.
* cp-tree.h (grok_enum_decls): Remove type parameter.
	* decl.c (grok_enum_decls): Likewise.
	* decl2.c (grok_x_components): Call grok_enum_decls
	unconditionally, since it will do nothing if there is no
	current_local_enum.  Use the new calling sequence.
	* pt.c (tsubst_enum): Use the new calling sequence for
	grok_enum_decls.
	* decl.c (start_function): Make member functions of local classes
	in extern inline functions have comdat linkage here...
	(grokdeclarator): Rather than here.
	* pt.c (convert_nontype_argument): Use decl_constant_value.

From-SVN: r17531
1998-01-28 06:43:39 -05:00