87 Cygnus<->FSF merge

From-SVN: r12424
This commit is contained in:
Mike Stump 1996-07-11 01:13:25 +00:00
parent 0d78176b02
commit e92cc02916
27 changed files with 1633 additions and 692 deletions

View File

@ -1,3 +1,228 @@
Tue Jul 9 17:48:48 1996 Mike Stump <mrs@cygnus.com>
* decl.c (lookup_name_real): If we find mem in obj when parsing
`obj->mem', make sure we return the right value.
Tue Jul 9 16:11:28 1996 Bob Manson <manson@charmed.cygnus.com>
* search.c (get_base_distance): Call complete_type.
Tue Jul 9 12:46:34 1996 Mike Stump <mrs@cygnus.com>
* decl.c (store_bindings): Make static.
Mon Jul 8 16:42:31 1996 Jason Merrill <jason@yorick.cygnus.com>
* init.c (expand_aggr_init_1): Don't check type conversions if
NEW_OVER.
* cvt.c (z_candidate): Put back template field.
(add_function_candidate): Set it.
(add_template_candidate): Likewise.
(joust): Use it.
(compare_qual): Handle references and pointers to members.
(compare_ics): Handle reference bindings.
* decl.c (duplicate_decls): Propagate DECL_ONE_ONLY.
Mon Jul 8 16:18:56 1996 Bob Manson <manson@charmed.cygnus.com>
* call.c (compute_conversion_costs): Call complete_type.
* tree.c (vec_binfo_member): Use comptypes instead of comparing
pointers, so we can handle template parameters.
Fri Jul 5 16:51:53 1996 Bob Manson <manson@charmed.cygnus.com>
* cvt.c (cp_convert_to_pointer): We have to call complete_type
here; let's make it explicit instead of a side effect of an
error check.
Wed Jul 3 16:29:51 1996 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (z_candidate): Remove template field.
(reference_binding): Handle binding to temporary.
(implicit_conversion): Likewise.
(add_function_candidate): Handle artificial constructor parms.
Handle functions with too few parms.
(add_template_candidate): New function.
(build_user_type_conversion_1): Handle constructors.
(convert_like): Likewise.
(build_over_call): Likewise.
(build_new_function_call): Support templates.
(compare_ics): Fix reference, inheritance handling.
Mon Jul 1 22:58:18 1996 Bob Manson <manson@charmed.cygnus.com>
* decl.c: Add signed_size_zero_node.
(init_decl_processing): Build it.
* class.c (prepare_fresh_vtable): Use it instead of size_zero_node
when we're trying to make a negative delta.
Mon Jul 1 17:56:19 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
Stop doing this damn index==strchr variable name confusion.
* class.c (add_virtual_function): Change local var INDEX to be
named IDX.
(add_method): Likewise.
* lex.c (print_parse_statistics): Likewise.
* search.c (make_memoized_table_entry): Likewise.
(lookup_fnfields_here): Likewise.
(lookup_field): Likewise.
(lookup_fnfields): Likewise.
(get_baselinks): Likewise.
* sig.c (build_signature_table_constructor): Likewise.
(build_signature_method_call): Likewise.
* typeck.c (build_x_array_ref): Change INDEX parm to be named IDX.
(get_member_function_from_ptrfunc): Likewise.
(build_ptrmemfunc): Change local var INDEX to be IDX.
(c_expand_start_case): Likewise.
Sat Jun 29 14:05:46 1996 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (cp_convert_to_pointer): Move user-defined type conversion
handling to before extraction of TYPE_PTRMEMFUNC_FN_TYPE.
(convert_to_reference): Use build_type_conversion to convert to
the reference type directly.
(standard_conversion): Fix void* case, non-conversions.
(reference_binding): Fix expr == 0 case, non-conversions.
(convert_like): Support REF_BIND.
(compare_qual): Split out from compare_ics.
(compare_ics): Use it, handle icses with only a qual_conv.
* init.c (expand_vec_init): Don't crash if decl is NULL.
Fri Jun 28 11:52:51 1996 Stan Shebs <shebs@andros.cygnus.com>
* mpw-config.in: New file, configury for Mac MPW.
* mpw-make.sed: New file, makefile editing for MPW.
Thu Jun 27 15:18:30 1996 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (instantiate_class_template): Call repo_template_used.
* search.c (lookup_conversions): Only lookup conversions in
complete types.
Thu Jun 27 12:59:53 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* cp-tree.def: Renamed from tree.def, to avoid confusion with
gcc's tree.def.
* cp-tree.h, lex.c: Include cp-tree.def.
* Makefile.in (CXX_TREE_H): Reference cp-tree.def.
Wed Jun 26 18:29:47 1996 Bob Manson <manson@charmed.cygnus.com>
* init.c (build_vec_delete_1): Call complete_type.
Mon Jun 24 17:17:32 1996 Mike Stump <mrs@cygnus.com>
* except.c (start_anon_func): Make sure anonymous functions are
never external.
Fri Jun 21 15:10:58 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (finish_function): If function_depth > 1, set nested.
* decl2.c (grokbitfield): Revert Bob's change.
* class.c (finish_struct_1): Fix handling of named bitfield widths.
Thu Jun 20 23:35:38 1996 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (add_pending_template): Handle types.
(lookup_template_class): With -fexternal-templates, just add the class
to pending_templates instead of instantiating it now.
* decl2.c (finish_file): Handle types in pending_templates.
Thu Jun 20 14:08:40 1996 Bob Manson <manson@charmed.cygnus.com>
* decl2.c (grokbitfield): Handle constant decls appropriately.
Give an appropriate error message now instead of spewing core
later.
Thu Jun 20 13:01:51 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c: Don't turn on thunks by default for now.
Wed Jun 19 11:37:04 1996 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (complete_type): Handle error_mark_node.
(common_type, OFFSET_TYPE): Handle template_type_parms.
Tue Jun 18 10:02:15 1996 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (instantiate_decl): If at_eof, call import_export_decl
regardless of DECL_INLINE.
* typeck.c (mark_addressable): Set TREE_ADDRESSABLE on CONSTRUCTORs.
* class.c (finish_struct_bits): Copy TYPE_SIZE.
* rtti.c (build_dynamic_cast): Support templates.
* tree.def: Support DYNAMIC_CAST_EXPR.
* pt.c (tsubst_copy): Likewise.
* decl2.c (build_expr_from_tree): Likewise.
Mon Jun 17 15:23:36 1996 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (build_static_cast): Support templates.
(build_const_cast): Likewise.
* tree.def: Support CONST/STATIC_CAST_EXPR.
* pt.c (tsubst_copy): Likewise.
* decl2.c (build_expr_from_tree): Likewise.
Sun Jun 16 12:33:57 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (finish_vtable_vardecl): Don't trust
TREE_SYMBOL_REFERENCED for vtables of local classes.
Fri Jun 14 18:13:36 1996 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (tsubst_copy): Handle operator T.
Wed Jun 12 17:52:40 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
* init.c (build_delete): Move creation of PARMS inside test of
TYPE_HAS_DESTRUCTOR, since it's never used outside of that block.
Tue Jun 11 15:09:18 1996 Bob Manson <manson@charmed.cygnus.com>
* typeck.c (build_conditional_expr): Don't assume that
the arguments to ?: are always pointers or records.
Tue Jun 11 13:56:23 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (import_export_decl): Still emit static/weak/comdat
copies of inline template functions with -fno-implicit-templates.
Tue Jun 11 11:42:13 1996 Bob Manson <manson@charmed.cygnus.com>
* init.c (build_delete): Determine the complete basetype
path to the destructor we're calling.
Fri Jun 7 15:30:10 1996 Bob Manson <manson@charmed.cygnus.com>
* decl.c (build_enumerator): Always copy the INTEGER_CST used to
initialize the enum, because we really and truly don't know where
it came from.
(start_enum): Don't copy integer_zero_node because
build_enumerator will do it.
Fri Jun 7 11:11:09 1996 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (finish_function): Do access control on base destructors.
* pt.c (tsubst, case FUNCTION_DECL): Set up
IDENTIFIER_GLOBAL_VALUE for member functions so pushdecl doesn't
hose us.
Fri Jun 7 10:37:33 1996 Mike Stump <mrs@cygnus.com>
* cvt.c (build_up_reference): If we have already extended the
lifetime of the temporary, don't try it again.
* typeck.c (c_expand_return): Don't try and convert the return
value twice when we want a reference, once is enough.
Sat May 11 04:33:50 1996 Doug Evans <dje@canuck.cygnus.com>
* decl2.c (finish_vtable_vardecl): Surround DECL_ONE_ONLY with ifdef.
@ -2215,8 +2440,6 @@ Mon Jan 15 08:45:01 1996 Jeffrey A Law (law@cygnus.com)
* tree.c (layout_basetypes): Call build_lang_field_decl instead
of build_lang_decl if first arg is a FIELD_DECL.
(tree_copy_lang_decl_for_deferred_output): Reverse test for when
to copy DECL_MAIN_VARIANT and DECL_CHAIN.
Thu Jan 11 14:55:07 1996 Brendan Kehoe <brendan@lisa.cygnus.com>
@ -2335,11 +2558,6 @@ Sun Dec 17 21:13:23 1995 Rusty Russell <rusty@adelaide.maptek.com.au>
* init.c (expand_member_init): warning for base init after members.
Sun Dec 17 22:06:56 1995 Jeffrey A Law (law@cygnus.com)
* tree.c (tree_copy_lang_decl_for_deferred_output): Handle
CONST_DECLs correctly.
Fri Dec 15 15:32:18 1995 Jason Merrill <jason@yorick.cygnus.com>
* cvt.c (build_expr_type_conversion): Don't convert to a reference
@ -2531,14 +2749,6 @@ Mon Nov 13 15:45:34 1995 Mike Stump <mrs@cygnus.com>
(emit_base_init): Ditto.
(expand_aggr_vbase_init_1): Ditto.
Fri Nov 10 09:19:31 1995 Jeffrey A Law (law@cygnus.com)
* tree.c (tree_copy_lang_decl_for_deferred_output): Handle
copying of DECL_ARGUMENTS field.
(tree_copy_lang_type_for_deferred_output): Handle disgusting
re-use of TYPE_LANG_SPECIFIC for pointer to member function
type nodes.
Fri Nov 10 09:18:09 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
* decl.c (push_namespace): Rewrite to use build_lang_decl, so we
@ -2595,11 +2805,6 @@ Tue Oct 31 11:56:55 1995 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (grokclassfn): Tweak __in_chrg attributes.
Thu Oct 26 20:58:59 1995 Jeffrey A Law (law@cygnus.com)
* cp/tree.c (tree_copy_lang_decl_for_deferred_output): Handle
FIELD_DECLs and VAR_DECLs correctly.
Thu Oct 26 16:45:58 1995 Brendan Kehoe <brendan@lisa.cygnus.com>
* errfn.c: Include stdio.h.
@ -2726,15 +2931,6 @@ Fri Oct 6 14:44:27 1995 Mike Stump <mrs@cygnus.com>
* typeck.c (mark_addressable): Add missing call to
assemble_external.
Wed Oct 4 22:05:23 1995 Jeff Law (law@hurl.cygnus.com
* cp/decl.c (deplicate_decls): Merge in deferred output
status for variables.
* cp/tree.c (tree_copy_lang_decl_for_deferred_output): New
function to copy the g++ specific parts of a DECL node.
(tree_copy_lang_type_for_deferred_output): Similarly for
TYPE nodes.
Wed Oct 4 15:06:39 1995 Mike Stump <mrs@cygnus.com>
* decl.c (store_parm_decls): Make sure the unwinder start comes

View File

@ -187,7 +187,7 @@ RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
$(srcdir)/../machmode.h $(srcdir)/../machmode.def
TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
$(srcdir)/../machmode.h $(srcdir)/../machmode.def
CXX_TREE_H = $(TREE_H) cp-tree.h tree.def
CXX_TREE_H = $(TREE_H) cp-tree.h cp-tree.def
PARSE_H = $(srcdir)/parse.h
PARSE_C = $(srcdir)/parse.c

View File

@ -21,7 +21,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* High-level class interface. */
/* High-level class interface. */
#include "config.h"
#include "tree.h"
@ -42,6 +42,7 @@ extern tree ctor_label, dtor_label;
/* Compute the ease with which a conversion can be performed
between an expected and the given type. */
static struct harshness_code convert_harshness PROTO((register tree, register tree, tree));
#define EVIL_RETURN(ARG) ((ARG).code = EVIL_CODE, (ARG))
@ -52,6 +53,7 @@ static struct harshness_code convert_harshness PROTO((register tree, register tr
/* Ordering function for overload resolution. Compare two candidates
by gross quality. */
int
rank_for_overload (x, y)
struct candidate *x, *y;
@ -79,6 +81,7 @@ rank_for_overload (x, y)
}
/* Compare two candidates, argument by argument. */
int
rank_for_ideal (x, y)
struct candidate *x, *y;
@ -108,6 +111,7 @@ rank_for_ideal (x, y)
/* TYPE is the type we wish to convert to. PARM is the parameter
we have to work with. We use a somewhat arbitrary cost function
to measure this conversion. */
static struct harshness_code
convert_harshness (type, parmtype, parm)
register tree type, parmtype;
@ -315,7 +319,7 @@ convert_harshness (type, parmtype, parm)
if (h2.distance)
{
/* This only works for pointers and references. */
/* This only works for pointers and references. */
if (TREE_CODE (TREE_VALUE (p1)) != POINTER_TYPE
&& TREE_CODE (TREE_VALUE (p1)) != REFERENCE_TYPE)
return EVIL_RETURN (h);
@ -947,8 +951,8 @@ compute_conversion_costs (function, tta_in, cp, arglen)
if (formal_type != error_mark_node
&& actual_type != error_mark_node)
{
formal_type = TYPE_MAIN_VARIANT (formal_type);
actual_type = TYPE_MAIN_VARIANT (actual_type);
formal_type = complete_type (TYPE_MAIN_VARIANT (formal_type));
actual_type = complete_type (TYPE_MAIN_VARIANT (actual_type));
if (TYPE_HAS_CONSTRUCTOR (formal_type))
{
@ -1000,7 +1004,7 @@ compute_conversion_costs (function, tta_in, cp, arglen)
}
/* Const member functions get a small penalty because defaulting
to const is less useful than defaulting to non-const. */
to const is less useful than defaulting to non-const. */
/* This is bogus, it does not correspond to anything in the ARM.
This code will be fixed when this entire section is rewritten
to conform to the ARM. (mrs) */
@ -1041,6 +1045,7 @@ compute_conversion_costs (function, tta_in, cp, arglen)
/* Subroutine of ideal_candidate. See if X or Y is a better match
than the other. */
static int
strictly_better (x, y)
unsigned short x, y;
@ -1135,6 +1140,7 @@ ideal_candidate (candidates, n_candidates, len)
/* Assume that if the class referred to is not in the
current class hierarchy, that it may be remote.
PARENT is assumed to be of aggregate type here. */
static int
may_be_remote (parent)
tree parent;
@ -1180,6 +1186,7 @@ build_vfield_ref (datum, type)
/* Build a call to a member of an object. I.e., one that overloads
operator ()(), or is a pointer-to-function or pointer-to-method. */
static tree
build_field_call (basetype_path, instance_ptr, name, parms)
tree basetype_path, instance_ptr, name, parms;
@ -1314,6 +1321,7 @@ find_scoped_type (type, inner_name, inner_types)
is a chain of nested type names (held together by SCOPE_REFs);
OUTER_TYPE is the type we know to enclose INNER_TYPES.
Returns NULL_TREE if there is an error. */
tree
resolve_scope_to_name (outer_type, inner_stuff)
tree outer_type, inner_stuff;
@ -1400,6 +1408,7 @@ resolve_scope_to_name (outer_type, inner_stuff)
/* Build a method call of the form `EXP->SCOPES::NAME (PARMS)'.
This is how virtual function calls are avoided. */
tree
build_scoped_method_call (exp, basetype, name, parms)
tree exp, basetype, name, parms;
@ -1523,6 +1532,7 @@ print_n_candidates (candidates, n)
/* We want the address of a function or method. We avoid creating a
pointer-to-member function. */
tree
build_addr_func (function)
tree function;
@ -1558,6 +1568,7 @@ build_addr_func (function)
/* Build a CALL_EXPR, we can handle FUNCTION_TYPEs, METHOD_TYPEs, or
POINTER_TYPE to those. Note, pointer to member function types
(TYPE_PTRMEMFUNC_P) must be handled by our callers. */
tree
build_call (function, result_type, parms)
tree function, result_type, parms;
@ -1647,6 +1658,7 @@ default_parm_conversions (parms, last)
Note that NAME may refer to an instance variable name. If
`operator()()' is defined for the type of that field, then we return
that result. */
tree
build_method_call (instance, name, parms, basetype_path, flags)
tree instance, name, parms, basetype_path;
@ -1697,7 +1709,7 @@ build_method_call (instance, name, parms, basetype_path, flags)
}
/* This is the logic that magically deletes the second argument to
operator delete, if it is not needed. */
operator delete, if it is not needed. */
if (name == ansi_opname[(int) DELETE_EXPR] && list_length (parms)==2)
{
tree save_last = TREE_CHAIN (parms);
@ -1707,7 +1719,7 @@ build_method_call (instance, name, parms, basetype_path, flags)
result = build_method_call (instance, name, parms, basetype_path,
(LOOKUP_SPECULATIVELY|flags)
&~LOOKUP_COMPLAIN);
/* If it finds a match, return it. */
/* If it finds a match, return it. */
if (result)
return build_method_call (instance, name, parms, basetype_path, flags);
/* If it doesn't work, two argument delete must work */
@ -1789,7 +1801,7 @@ build_method_call (instance, name, parms, basetype_path, flags)
if (basetype != NULL_TREE)
;
/* call to a constructor... */
/* call to a constructor... */
else if (basetype_path)
{
basetype = BINFO_TYPE (basetype_path);
@ -2224,7 +2236,7 @@ build_method_call (instance, name, parms, basetype_path, flags)
cp->function = function;
cp->basetypes = basetype_path;
/* Don't allow non-converting constructors to convert. */
/* Don't allow non-converting constructors to convert. */
if (flags & LOOKUP_ONLYCONVERTING
&& DECL_LANG_SPECIFIC (function)
&& DECL_NONCONVERTING_P (function))
@ -2881,6 +2893,7 @@ build_overload_call_real (fnname, parms, flags, final_cp, require_complete)
}
/* This requires a complete type on the result of the call. */
tree
build_overload_call (fnname, parms, flags)
tree fnname, parms;

View File

@ -20,7 +20,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* High-level class interface. */
/* High-level class interface. */
#include "config.h"
#include "tree.h"
@ -37,7 +37,7 @@ Boston, MA 02111-1307, USA. */
extern struct obstack permanent_obstack;
/* This is how we tell when two virtual member functions are really the
same. */
same. */
#define SAME_FN(FN1DECL, FN2DECL) (DECL_ASSEMBLER_NAME (FN1DECL) == DECL_ASSEMBLER_NAME (FN2DECL))
extern void set_class_shadows PROTO ((tree));
@ -120,6 +120,7 @@ int n_inner_fields_searched = 0;
#endif
/* Virtual baseclass things. */
tree
build_vbase_pointer (exp, type)
tree exp, type;
@ -132,7 +133,8 @@ build_vbase_pointer (exp, type)
}
/* Is the type of the EXPR, the complete type of the object?
If we are going to be wrong, we must be conservative, and return 0. */
If we are going to be wrong, we must be conservative, and return 0. */
int
complete_type_p (expr)
tree expr;
@ -153,20 +155,20 @@ complete_type_p (expr)
case CALL_EXPR:
if (! TREE_HAS_CONSTRUCTOR (expr))
break;
/* fall through... */
/* fall through... */
case VAR_DECL:
case FIELD_DECL:
if (TREE_CODE (TREE_TYPE (expr)) == ARRAY_TYPE
&& IS_AGGR_TYPE (TREE_TYPE (TREE_TYPE (expr)))
&& TYPE_MAIN_VARIANT (TREE_TYPE (expr)) == type)
return 1;
/* fall through... */
/* fall through... */
case TARGET_EXPR:
case PARM_DECL:
if (IS_AGGR_TYPE (TREE_TYPE (expr))
&& TYPE_MAIN_VARIANT (TREE_TYPE (expr)) == type)
return 1;
/* fall through... */
/* fall through... */
case PLUS_EXPR:
default:
break;
@ -184,6 +186,7 @@ complete_type_p (expr)
TYPE is the type we want this path to have on exit.
ALIAS_THIS is non-zero if EXPR in an expression involving `this'. */
tree
build_vbase_path (code, type, expr, path, alias_this)
enum tree_code code;
@ -206,7 +209,7 @@ build_vbase_path (code, type, expr, path, alias_this)
to the type we want. Until that is done, or until we can
recognize when that is, we cannot do the short cut logic. (mrs) */
/* Do this, until we can undo any previous conversions. See net35.C
for a testcase. */
for a testcase. */
fixed_type_p = complete_type_p (expr);
if (!fixed_type_p && TREE_SIDE_EFFECTS (expr))
@ -243,7 +246,7 @@ build_vbase_path (code, type, expr, path, alias_this)
tree ind;
/* We already check for ambiguous things in the caller, just
find a path. */
find a path. */
if (last)
{
tree binfo = get_binfo (last, TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (nonnull_expr))), 0);
@ -359,8 +362,8 @@ build_vbase_path (code, type, expr, path, alias_this)
/* Virtual function things. */
/* Virtual functions to be dealt with after laying out our base
classes. We do all overrides after we layout virtual base classes.
*/
classes. We do all overrides after we layout virtual base classes. */
static tree pending_hard_virtuals;
/* Build an entry in the virtual function table.
@ -368,6 +371,7 @@ static tree pending_hard_virtuals;
PFN is an ADDR_EXPR containing a pointer to the virtual function.
Note that the index (DELTA2) in the virtual function table
is always 0. */
tree
build_vtable_entry (delta, pfn)
tree delta, pfn;
@ -426,6 +430,7 @@ build_vtable_entry (delta, pfn)
virtual function vtable element corresponding to INDEX. There are
many special cases for INSTANCE which we take care of here, mainly
to avoid creating extra tree nodes when we don't have to. */
tree
build_vtbl_ref (instance, idx)
tree instance, idx;
@ -491,6 +496,7 @@ build_vtbl_ref (instance, idx)
virtual function corresponding to INDEX. There are many special
cases for INSTANCE which we take care of here, mainly to avoid
creating extra tree nodes when we don't have to. */
tree
build_vfn_ref (ptr_to_instptr, instance, idx)
tree *ptr_to_instptr, instance;
@ -522,6 +528,7 @@ build_vfn_ref (ptr_to_instptr, instance, idx)
/* Return the name of the virtual function table (as an IDENTIFIER_NODE)
for the given TYPE. */
static tree
get_vtable_name (type)
tree type;
@ -545,6 +552,7 @@ get_vtable_name (type)
}
/* Return the offset to the main vtable for a given base BINFO. */
tree
get_vfield_offset (binfo)
tree binfo;
@ -561,6 +569,7 @@ get_vfield_offset (binfo)
that far. The shortened search is useful because the this pointer
on method calling is expected to point to a DECL_CONTEXT (fndecl)
object, and not a baseclass of it. */
static tree
get_derived_offset (binfo, type)
tree binfo, type;
@ -581,6 +590,7 @@ get_derived_offset (binfo, type)
}
/* Update the rtti info for this class. */
static void
set_rtti_entry (virtuals, offset, type)
tree virtuals, offset, type;
@ -612,6 +622,7 @@ set_rtti_entry (virtuals, offset, type)
If BINFO is non-NULL, build the vtable starting with the initial
approximation that it is the same as the one which is the head of
the association list. */
static tree
build_vtable (binfo, type)
tree binfo, type;
@ -691,8 +702,8 @@ build_vtable (binfo, type)
Make sure to use the DECL_ASSEMBLER_NAME of the TYPE_NAME of the
type, as template have DECL_NAMEs like: X<int>, whereas the
DECL_ASSEMBLER_NAME is set to be something the assembler can handle.
*/
DECL_ASSEMBLER_NAME is set to be something the assembler can handle. */
static tree
build_type_pathname (format, parent, type)
char *format;
@ -734,6 +745,8 @@ build_type_pathname (format, parent, type)
return id;
}
extern tree signed_size_zero_node;
/* Give TYPE a new virtual function table which is initialized
with a skeleton-copy of its original initialization. The only
entry that changes is the `delta' entry, so we can really
@ -743,6 +756,7 @@ build_type_pathname (format, parent, type)
be needed.
BINFO is the type association which provided TYPE for FOR_TYPE. */
static void
prepare_fresh_vtable (binfo, for_type)
tree binfo, for_type;
@ -787,7 +801,7 @@ prepare_fresh_vtable (binfo, for_type)
offset = BINFO_OFFSET (binfo);
set_rtti_entry (BINFO_VIRTUALS (binfo),
size_binop (MINUS_EXPR, size_zero_node, offset),
size_binop (MINUS_EXPR, signed_size_zero_node, offset),
for_type);
#ifdef GATHER_STATISTICS
@ -810,6 +824,7 @@ prepare_fresh_vtable (binfo, for_type)
contains BASE_FNDECL. VIRTUALS is the virtual function table's
initializer. We can run off the end, when dealing with virtual
destructors in MI situations, return NULL_TREE in that case. */
static tree
get_vtable_entry (virtuals, base_fndecl)
tree virtuals, base_fndecl;
@ -850,7 +865,7 @@ modify_vtable_entry (old_entry_in_list, new_entry, fndecl)
TREE_VALUE (old_entry_in_list) = new_entry;
/* Now assign virtual dispatch information, if unset. */
/* We can dispatch this, through any overridden base function. */
/* We can dispatch this, through any overridden base function. */
if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
{
DECL_VINDEX (fndecl) = DECL_VINDEX (base_fndecl);
@ -860,6 +875,7 @@ modify_vtable_entry (old_entry_in_list, new_entry, fndecl)
/* Access the virtual function table entry i. VIRTUALS is the virtual
function table's initializer. */
static tree
get_vtable_entry_n (virtuals, n)
tree virtuals;
@ -880,12 +896,13 @@ get_vtable_entry_n (virtuals, n)
HAS_VIRTUAL keeps track of how many virtuals there are in our main
vtable for the type, and we build upon the PENDING_VIRTUALS list
and return it. */
static tree
add_virtual_function (pending_virtuals, has_virtual, fndecl, t)
tree pending_virtuals;
int *has_virtual;
tree fndecl;
tree t; /* Structure type. */
tree t; /* Structure type. */
{
/* FUNCTION_TYPEs and OFFSET_TYPEs no longer freely
convert to void *. Make such a conversion here. */
@ -922,21 +939,21 @@ add_virtual_function (pending_virtuals, has_virtual, fndecl, t)
/* Build a new INT_CST for this DECL_VINDEX. */
{
static tree index_table[256];
tree index;
tree idx;
/* We skip a slot for the offset/tdesc entry. */
int i = ++(*has_virtual);
if (i >= 256 || index_table[i] == 0)
{
index = build_int_2 (i, 0);
idx = build_int_2 (i, 0);
if (i < 256)
index_table[i] = index;
index_table[i] = idx;
}
else
index = index_table[i];
idx = index_table[i];
/* Now assign virtual dispatch information. */
DECL_VINDEX (fndecl) = index;
/* Now assign virtual dispatch information. */
DECL_VINDEX (fndecl) = idx;
DECL_CONTEXT (fndecl) = t;
}
entry = build_vtable_entry (integer_zero_node, vfn);
@ -963,6 +980,7 @@ extern struct obstack *current_obstack;
FIELDS is the entry in the METHOD_VEC vector entry of the class type where
the method should be added. */
void
add_method (type, fields, method)
tree type, *fields, method;
@ -1027,12 +1045,12 @@ add_method (type, fields, method)
METHOD_VEC always has a slot for such entries. */
if (TYPE_IDENTIFIER (type) == DECL_NAME (decl))
{
int index = !!DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl));
/* TREE_VEC_ELT (method_vec, index) = decl; */
if (decl != TREE_VEC_ELT (method_vec, index))
int idx = !!DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl));
/* TREE_VEC_ELT (method_vec, idx) = decl; */
if (decl != TREE_VEC_ELT (method_vec, idx))
{
DECL_CHAIN (decl) = TREE_VEC_ELT (method_vec, index);
TREE_VEC_ELT (method_vec, index) = decl;
DECL_CHAIN (decl) = TREE_VEC_ELT (method_vec, idx);
TREE_VEC_ELT (method_vec, idx) = decl;
}
}
else
@ -1110,6 +1128,7 @@ add_method (type, fields, method)
Note that anonymous fields which are not of UNION_TYPE are
not duplicates, they are just anonymous fields. This happens
when we have unnamed bitfields, for example. */
static tree
delete_duplicate_fields_1 (field, fields)
tree field, fields;
@ -1197,6 +1216,7 @@ delete_duplicate_fields (fields)
/* Change the access of FDECL to ACCESS in T.
Return 1 if change was legit, otherwise return 0. */
static int
alter_access (t, fdecl, access)
tree t;
@ -1257,7 +1277,7 @@ maybe_fixup_vptrs (for_type, binfo, base_init_list)
: VF_BASETYPE_VALUE (vfields);
tree base_binfo = get_binfo (basetype, for_type, 0);
/* Punt until this is implemented. */
/* Punt until this is implemented. */
if (1 /* BINFO_MODIFIED (base_binfo) */)
{
tree base_offset = get_vfield_offset (base_binfo);
@ -1527,7 +1547,7 @@ finish_base_struct (t, b, t_binfo)
if (TYPE_VIRTUAL_P (basetype))
{
/* Remember that the baseclass has virtual members. */
/* Remember that the baseclass has virtual members. */
b->base_has_virtual = 1;
/* Ensure that this is set from at least a virtual base
@ -1686,6 +1706,7 @@ typecode_p (type, code)
/* Set memoizing fields and bits of T (and its variants) for later use.
MAX_HAS_VIRTUAL is the largest size of any T's virtual function tables. */
static void
finish_struct_bits (t, max_has_virtual)
tree t;
@ -1711,6 +1732,7 @@ finish_struct_bits (t, max_has_virtual)
TYPE_MIN_VALUE (variants) = TYPE_MIN_VALUE (t);
TYPE_MAX_VALUE (variants) = TYPE_MAX_VALUE (t);
TYPE_FIELDS (variants) = TYPE_FIELDS (t);
TYPE_SIZE (variants) = TYPE_SIZE (t);
variants = TYPE_NEXT_VARIANT (variants);
}
@ -1729,7 +1751,7 @@ finish_struct_bits (t, max_has_virtual)
if (might_have_abstract_virtuals)
{
/* We use error_mark_node from override_one_vtable to signal
an artificial abstract. */
an artificial abstract. */
if (CLASSTYPE_ABSTRACT_VIRTUALS (t) == error_mark_node)
CLASSTYPE_ABSTRACT_VIRTUALS (t) = NULL_TREE;
CLASSTYPE_ABSTRACT_VIRTUALS (t) = get_abstract_virtuals (t);
@ -1784,6 +1806,7 @@ finish_struct_bits (t, max_has_virtual)
/* Add FNDECL to the method_vec growing on the class_obstack. Used by
finish_struct_methods. Note, FNDECL cannot be a constructor or
destructor, those cases are handled by the caller. */
static void
grow_method (fndecl, method_vec_ptr)
tree fndecl;
@ -2032,7 +2055,7 @@ finish_struct_methods (t, fn_fields, nonprivate_method)
return method_vec;
}
/* Emit error when a duplicate definition of a type is seen. Patch up. */
/* Emit error when a duplicate definition of a type is seen. Patch up. */
void
duplicate_tag_error (t)
@ -2046,12 +2069,11 @@ duplicate_tag_error (t)
/* All of the component_decl's were TREE_CHAINed together in the parser.
finish_struct_methods walks these chains and assembles all methods with
the same base name into DECL_CHAINs. Now we don't need the parser chains
anymore, so we unravel them.
*/
/*
* This used to be in finish_struct, but it turns out that the
* TREE_CHAIN is used by dbxout_type_methods and perhaps some other things...
*/
anymore, so we unravel them. */
/* This used to be in finish_struct, but it turns out that the
TREE_CHAIN is used by dbxout_type_methods and perhaps some other
things... */
if (CLASSTYPE_METHOD_VEC (t))
{
tree method_vec = CLASSTYPE_METHOD_VEC (t);
@ -2094,7 +2116,8 @@ duplicate_tag_error (t)
TYPE_CONTEXT (t) = NULL_TREE;
}
/* finish up all new vtables. */
/* finish up all new vtables. */
static void
finish_vtbls (binfo, do_self, t)
tree binfo;
@ -2139,11 +2162,12 @@ finish_vtbls (binfo, do_self, t)
/* True if we should override the given BASE_FNDECL with the given
FNDECL. */
static int
overrides (fndecl, base_fndecl)
tree fndecl, base_fndecl;
{
/* Destructors have special names. */
/* Destructors have special names. */
if (DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (base_fndecl)) &&
DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (fndecl)))
return 1;
@ -2215,6 +2239,7 @@ get_class_offset_1 (parent, binfo, context, t, fndecl)
/* Get the offset to the CONTEXT subobject that is related to the
given BINFO. */
static tree
get_class_offset (context, t, binfo, fndecl)
tree context, t, binfo, fndecl;
@ -2240,7 +2265,7 @@ get_class_offset (context, t, binfo, fndecl)
}
/* Ok, not found in the less derived binfos, now check the more
derived binfos. */
derived binfos. */
offset = get_class_offset_1 (first_binfo, TYPE_BINFO (t), context, t, fndecl);
if (offset==0 || TREE_CODE (offset) != INTEGER_CST)
my_friendly_abort (999); /* we have to find it. */
@ -2248,6 +2273,7 @@ get_class_offset (context, t, binfo, fndecl)
}
/* Skip RTTI information at the front of the virtual list. */
unsigned HOST_WIDE_INT
skip_rtti_stuff (virtuals)
tree *virtuals;
@ -2357,7 +2383,8 @@ modify_one_vtable (binfo, t, fndecl, pfn)
}
}
/* These are the ones that are not through virtual base classes. */
/* These are the ones that are not through virtual base classes. */
static void
modify_all_direct_vtables (binfo, do_self, t, fndecl, pfn)
tree binfo;
@ -2384,6 +2411,7 @@ modify_all_direct_vtables (binfo, do_self, t, fndecl, pfn)
}
/* Fixup all the delta entries in this one vtable that need updating. */
static void
fixup_vtable_deltas1 (binfo, t)
tree binfo, t;
@ -2458,6 +2486,7 @@ fixup_vtable_deltas1 (binfo, t)
This happens when we have non-overridden virtual functions from a
virtual base class, that are at a different offset, in the new
hierarchy, because the layout of the virtual bases has changed. */
static void
fixup_vtable_deltas (binfo, init_self, t)
tree binfo;
@ -2482,7 +2511,8 @@ fixup_vtable_deltas (binfo, init_self, t)
}
}
/* These are the ones that are through virtual base classes. */
/* These are the ones that are through virtual base classes. */
static void
modify_all_indirect_vtables (binfo, do_self, via_virtual, t, fndecl, pfn)
tree binfo;
@ -2517,7 +2547,7 @@ modify_all_vtables (t, fndecl, vfn)
tree t, fndecl, vfn;
{
/* Do these first, so that we will make use of any non-virtual class's
vtable, over a virtual classes vtable. */
vtable, over a virtual classes vtable. */
modify_all_direct_vtables (TYPE_BINFO (t), 1, t, fndecl, vfn);
if (TYPE_USES_VIRTUAL_BASECLASSES (t))
modify_all_indirect_vtables (TYPE_BINFO (t), 1, 0, t, fndecl, vfn);
@ -2525,6 +2555,7 @@ modify_all_vtables (t, fndecl, vfn)
/* Here, we already know that they match in every respect.
All we have to check is where they had their declarations. */
static int
strictly_overrides (fndecl1, fndecl2)
tree fndecl1, fndecl2;
@ -2549,6 +2580,7 @@ strictly_overrides (fndecl1, fndecl2)
then it is ill-formed. (mrs)
We take special care to reuse a vtable, if we can. */
static void
override_one_vtable (binfo, old, t)
tree binfo, old, t;
@ -2558,7 +2590,7 @@ override_one_vtable (binfo, old, t)
enum { REUSE_NEW, REUSE_OLD, UNDECIDED, NEITHER } choose = UNDECIDED;
/* If we have already committed to modifying it, then don't try and
reuse another vtable. */
reuse another vtable. */
if (BINFO_NEW_VTABLE_MARKED (binfo))
choose = NEITHER;
@ -2573,10 +2605,10 @@ override_one_vtable (binfo, old, t)
old_fndecl = FNADDR_FROM_VTABLE_ENTRY (old_fndecl);
fndecl = TREE_OPERAND (fndecl, 0);
old_fndecl = TREE_OPERAND (old_fndecl, 0);
/* First check to see if they are the same. */
/* First check to see if they are the same. */
if (DECL_ASSEMBLER_NAME (fndecl) == DECL_ASSEMBLER_NAME (old_fndecl))
{
/* No need to do anything. */
/* No need to do anything. */
}
else if (strictly_overrides (fndecl, old_fndecl))
{
@ -2631,7 +2663,7 @@ override_one_vtable (binfo, old, t)
fndecl = copy_node (fndecl);
copy_lang_decl (fndecl);
DECL_ABSTRACT_VIRTUAL_P (fndecl) = 1;
/* Make sure we search for it later. */
/* Make sure we search for it later. */
if (! CLASSTYPE_ABSTRACT_VIRTUALS (t))
CLASSTYPE_ABSTRACT_VIRTUALS (t) = error_mark_node;
@ -2639,7 +2671,7 @@ override_one_vtable (binfo, old, t)
TREE_CONSTANT (vfn) = 1;
/* We can use integer_zero_node, as we will will core dump
if this is used anyway. */
if this is used anyway. */
TREE_VALUE (virtuals) = build_vtable_entry (integer_zero_node, vfn);
}
}
@ -2647,7 +2679,7 @@ override_one_vtable (binfo, old, t)
old_virtuals = TREE_CHAIN (old_virtuals);
}
/* Let's reuse the old vtable. */
/* Let's reuse the old vtable. */
if (choose == REUSE_OLD)
{
BINFO_VTABLE (binfo) = BINFO_VTABLE (old);
@ -2658,6 +2690,7 @@ override_one_vtable (binfo, old, t)
/* Merge in overrides for virtual bases.
BINFO is the hierarchy we want to modify, and OLD has the potential
overrides. */
static void
merge_overrides (binfo, old, do_self, t)
tree binfo, old;
@ -2688,6 +2721,7 @@ merge_overrides (binfo, old, do_self, t)
/* Get the base virtual function declarations in T that are either
overridden or hidden by FNDECL as a list. We set TREE_PURPOSE with
the overrider/hider. */
tree
get_basefndecls (fndecl, t)
tree fndecl, t;
@ -2725,6 +2759,7 @@ get_basefndecls (fndecl, t)
/* Mark the functions that have been hidden with their overriders.
Since we start out with all functions already marked with a hider,
no need to mark functions that are just hidden. */
void
mark_overriders (fndecl, base_fndecls)
tree fndecl, base_fndecls;
@ -2781,7 +2816,7 @@ check_for_override (decl, ctype)
virtualp = 1;
{
/* The argument types may have changed... */
/* The argument types may have changed... */
tree type = TREE_TYPE (decl);
tree argtypes = TYPE_ARG_TYPES (type);
tree base_variant = TREE_TYPE (TREE_VALUE (argtypes));
@ -2811,6 +2846,7 @@ check_for_override (decl, ctype)
/* Warn about hidden virtual functions that are not overridden in t.
We know that constructors and destructors don't apply. */
void
warn_hidden (t)
tree t;
@ -2881,6 +2917,7 @@ warn_hidden (t)
/* Check for things that are invalid. There are probably plenty of other
things we should check for also. */
static void
finish_struct_anon (t)
tree t;
@ -3080,7 +3117,7 @@ finish_struct_1 (t, attributes, warn_anon)
fields = chainon (vf, fields);
first_vfn_base_index = finish_base_struct (t, &base_info, t_binfo);
/* Remember where we got our vfield from. */
/* Remember where we got our vfield from. */
CLASSTYPE_VFIELD_PARENT (t) = first_vfn_base_index;
has_virtual = base_info.has_virtual;
max_has_virtual = base_info.max_has_virtual;
@ -3222,7 +3259,7 @@ finish_struct_1 (t, attributes, warn_anon)
continue;
/* If we've gotten this far, it's a data member, possibly static,
or an enumerator. */
or an enumerator. */
DECL_FIELD_CONTEXT (x) = t;
@ -3413,14 +3450,10 @@ finish_struct_1 (t, attributes, warn_anon)
cp_warning_at ("`%D' is too small to hold all values of `%#T'",
x, TREE_TYPE (x));
}
}
/* Process valid field width. */
if (DECL_INITIAL (x))
{
register int width = TREE_INT_CST_LOW (DECL_INITIAL (x));
if (width == 0)
if (DECL_INITIAL (x) == NULL_TREE)
;
else if (width == 0)
{
#ifdef EMPTY_FIELD_BOUNDARY
DECL_ALIGN (x) = MAX (DECL_ALIGN (x), EMPTY_FIELD_BOUNDARY);
@ -3547,7 +3580,7 @@ finish_struct_1 (t, attributes, warn_anon)
TYPE_NEEDS_DESTRUCTOR (t) = 0;
else
{
/* Link dtor onto end of fn_fields. */
/* Link dtor onto end of fn_fields. */
TREE_CHAIN (dtor) = fn_fields;
fn_fields = dtor;
@ -3713,7 +3746,7 @@ finish_struct_1 (t, attributes, warn_anon)
ptr_type_node);
/* If you change any of the below, take a look at all the
other VFIELD_BASEs and VTABLE_BASEs in the code, and change
them too. */
them too. */
DECL_ASSEMBLER_NAME (vfield) = get_identifier (VFIELD_BASE);
CLASSTYPE_VFIELD (t) = vfield;
DECL_VIRTUAL_P (vfield) = 1;
@ -3806,7 +3839,7 @@ finish_struct_1 (t, attributes, warn_anon)
TYPE_MODE (pseudo_basetype) = TYPE_MODE (t);
TYPE_ALIGN (pseudo_basetype) = CLASSTYPE_ALIGN (t);
DECL_ALIGN (base_layout_decl) = TYPE_ALIGN (pseudo_basetype);
/* Don't re-use old size. */
/* Don't re-use old size. */
DECL_SIZE (base_layout_decl) = NULL_TREE;
}
@ -4086,7 +4119,7 @@ finish_struct_1 (t, attributes, warn_anon)
if (CLASSTYPE_VSIZE (t) != 0)
{
#if 0
/* This is now done above. */
/* This is now done above. */
if (DECL_FIELD_CONTEXT (vfield) != t)
{
tree binfo = get_binfo (DECL_FIELD_CONTEXT (vfield), t, 0);
@ -4105,7 +4138,7 @@ finish_struct_1 (t, attributes, warn_anon)
}
#endif
/* In addition to this one, all the other vfields should be listed. */
/* In addition to this one, all the other vfields should be listed. */
/* Before that can be done, we have to have FIELD_DECLs for them, and
a place to find them. */
TYPE_NONCOPIED_PARTS (t) = build_tree_list (default_conversion (TYPE_BINFO_VTABLE (t)), vfield);
@ -4280,7 +4313,7 @@ finish_struct (t, list_of_fieldlists, attributes, warn_anon)
DECL_CLASS_CONTEXT (x) = t;
if (last_x)
TREE_CHAIN (last_x) = TREE_CHAIN (x);
/* Link x onto end of TYPE_METHODS. */
/* Link x onto end of TYPE_METHODS. */
*tail = x;
tail = &TREE_CHAIN (x);
continue;
@ -4380,6 +4413,7 @@ finish_struct (t, list_of_fieldlists, attributes, warn_anon)
*NONNULL is set iff INSTANCE can be known to be nonnull, regardless
of our knowledge of its type. */
int
resolves_to_fixed_type_p (instance, nonnull)
tree instance;
@ -4453,7 +4487,7 @@ resolves_to_fixed_type_p (instance, nonnull)
*nonnull = 1;
return 1;
}
/* fall through... */
/* fall through... */
case TARGET_EXPR:
case PARM_DECL:
if (IS_AGGR_TYPE (TREE_TYPE (instance)))
@ -4636,6 +4670,7 @@ pushclass (type, modify)
previously, that is the one popped to. The flag MODIFY tells whether
the current scope declarations needs to be modified as a result of
popping to the previous scope. 0 is used for class definitions. */
void
popclass (modify)
int modify;
@ -4762,6 +4797,7 @@ push_lang_context (name)
}
/* Get out of the current language scope. */
void
pop_lang_context ()
{
@ -4789,6 +4825,7 @@ root_lang_context_p ()
This function is used in build_modify_expr, convert_arguments,
build_c_cast, and compute_conversion_costs. */
tree
instantiate_type (lhstype, rhs, complain)
tree lhstype, rhs;
@ -5230,6 +5267,7 @@ instantiate_type (lhstype, rhs, complain)
this may have to look back through base types to find the
ultimate field name. (For single inheritance, these could
all be the same name. Who knows for multiple inheritance). */
static tree
get_vfield_name (type)
tree type;

View File

@ -80,7 +80,7 @@ struct candidate
int h_len; /* The length of the harshness vector. */
tree function; /* A FUNCTION_DECL */
tree basetypes; /* The path to function. */
tree basetypes; /* The path to function. */
tree arg; /* first parm to function. */
/* Indexed by argument number, encodes evil, user, d_to_b, and easy

View File

@ -242,12 +242,12 @@ extern int warn_cast_qual;
extern int warn_traditional;
/* Warn about *printf or *scanf format/argument anomalies. */
/* Warn about *printf or *scanf format/argument anomalies. */
extern int warn_format;
/* Nonzero means warn about non virtual destructors in classes that have
virtual functions. */
virtual functions. */
extern int warn_nonvdtor;
@ -276,7 +276,7 @@ extern int write_virtuals;
/* True for more efficient but incompatible (not not fully tested)
vtable implementation (using thunks).
0 is old behavior; 1 is new behavior. */
0 is old behavior; 1 is new behavior. */
extern int flag_vtable_thunks;
/* INTERFACE_ONLY nonzero means that we are in an "interface"
@ -313,7 +313,7 @@ extern int flag_default_inline;
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
enum cplus_tree_code {
__DUMMY = LAST_AND_UNUSED_TREE_CODE,
#include "tree.def"
#include "cp-tree.def"
LAST_CPLUS_TREE_CODE
};
#undef DEFTREECODE
@ -697,7 +697,7 @@ struct lang_type
which our VFIELD is based, -1 otherwise. If this class has no base
classes, this is not used.
In D : B1, B2, PARENT would be 0, if D's vtable came from B1,
1, if D's vtable came from B2. */
1, if D's vtable came from B2. */
#define CLASSTYPE_VFIELD_PARENT(NODE) (TYPE_LANG_SPECIFIC(NODE)->vfield_parent)
/* Remove when done merging. */
@ -916,7 +916,7 @@ struct lang_type
this type can raise. */
#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
/* The binding level associated with the namespace. */
/* The binding level associated with the namespace. */
#define NAMESPACE_LEVEL(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.level)
struct lang_decl_flags
@ -1070,7 +1070,7 @@ struct lang_decl
#endif
/* In a VAR_DECL for a variable declared in a for statement,
this is the shadowed (local) variable. */
this is the shadowed (local) variable. */
#define DECL_SHADOWED_FOR_VAR(NODE) DECL_RESULT(NODE)
/* Points back to the decl which caused this lang_decl to be allocated. */
@ -1081,7 +1081,7 @@ struct lang_decl
squirreled away. */
#define DECL_PENDING_INLINE_INFO(NODE) (DECL_LANG_SPECIFIC(NODE)->pending_inline_info)
/* True if on the saved_inlines (see decl2.c) list. */
/* True if on the saved_inlines (see decl2.c) list. */
#define DECL_SAVED_INLINE(DECL) \
(DECL_LANG_SPECIFIC(DECL)->decl_flags.saved_inline)
@ -1162,7 +1162,7 @@ struct lang_decl
extern int flag_new_for_scope;
/* This flag is true of a local VAR_DECL if it was declared in a for
statement, but we are no longer in the scope of the for. */
statement, but we are no longer in the scope of the for. */
#define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (NODE)
/* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
@ -1266,18 +1266,18 @@ extern int flag_new_for_scope;
(TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
/* Nonzero for _TYPE node means that this type is a pointer to member
function type. */
function type. */
#define TYPE_PTRMEMFUNC_P(NODE) (TREE_CODE(NODE) == RECORD_TYPE && TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
#define TYPE_PTRMEMFUNC_FLAG(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.ptrmemfunc_flag)
/* Get the POINTER_TYPE to the METHOD_TYPE associated with this
pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
before using this macro. */
before using this macro. */
#define TYPE_PTRMEMFUNC_FN_TYPE(NODE) (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (NODE)))))))
/* These are use to manipulate the the canonical RECORD_TYPE from the
hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
#define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE))
#define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE)))
/* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P. */
/* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P. */
#define DELTA2_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, NULL_TREE, 0), delta2_identifier, NULL_TREE, 0))
#define PFN_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, NULL_TREE, 0), pfn_identifier, NULL_TREE, 0))
@ -1352,8 +1352,7 @@ extern int flag_new_for_scope;
0=normal declaration, e.g. int min (int, int);
1=implicit template instantiation
2=explicit template specialization, e.g. int min<int> (int, int);
3=explicit template instantiation, e.g. template int min<int> (int, int);
*/
3=explicit template instantiation, e.g. template int min<int> (int, int); */
#define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC(NODE)->decl_flags.use_template)
#define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
@ -1465,7 +1464,7 @@ extern char *get_directive_line STDIO_PROTO((FILE *));
and, if so, perhaps change them both back to their original type. */
extern tree shorten_compare PROTO((tree *, tree *, tree *, enum tree_code *));
/* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
or validate its data type for an `if' or `while' statement or ?..: exp. */
or validate its data type for an `if' or `while' statement or ?..: exp. */
extern tree truthvalue_conversion PROTO((tree));
extern tree type_for_mode PROTO((enum machine_mode, int));
extern tree type_for_size PROTO((unsigned, int));
@ -1506,7 +1505,7 @@ extern tree unknown_type_node;
extern tree opaque_type_node, signature_type_node;
/* Node for "pointer to (virtual) function".
This may be distinct from ptr_type_node so gdb can distinguish them. */
This may be distinct from ptr_type_node so gdb can distinguish them. */
#define vfunc_ptr_type_node \
(flag_vtable_thunks ? vtable_entry_type : ptr_type_node)
@ -1736,7 +1735,7 @@ extern int current_function_parms_stored;
can have. These are sensible combinations of {public,private,protected}
cross {virtual,non-virtual}. */
/* in class.c. */
/* in class.c. */
extern tree access_default_node; /* 0 */
extern tree access_public_node; /* 1 */
extern tree access_protected_node; /* 2 */

File diff suppressed because it is too large Load Diff

View File

@ -229,7 +229,7 @@ static tree int_ftype_cptr_cptr_sizet;
tree vtable_entry_type;
tree delta_type_node;
#if 0
/* Old rtti stuff. */
/* Old rtti stuff. */
tree __baselist_desc_type_node;
tree __i_desc_type_node, __m_desc_type_node;
tree __t_desc_array_type, __i_desc_array_type, __m_desc_array_type;
@ -295,7 +295,7 @@ tree base_init_expr;
parameter for destructors. */
tree this_identifier, in_charge_identifier;
tree ctor_identifier, dtor_identifier;
/* Used in pointer to member functions, in vtables, and in sigtables. */
/* Used in pointer to member functions, in vtables, and in sigtables. */
tree pfn_identifier, index_identifier, delta_identifier, delta2_identifier;
tree pfn_or_delta2_identifier, tag_identifier;
tree vt_off_identifier;
@ -438,7 +438,7 @@ extern int flag_no_nonansi_builtin;
extern int flag_ansi;
/* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes)
objects. */
objects. */
extern int flag_huge_objects;
/* Nonzero if we want to conserve space in the .o files. We do this
@ -473,8 +473,13 @@ extern int spew_debug;
when entering another class scope (i.e. a cache miss). */
extern tree previous_class_values;
/* A expression of value 0 with the same precision as a sizetype
node, but signed. */
tree signed_size_zero_node;
/* Allocate a level of searching. */
struct stack_level *
push_decl_level (stack, obstack)
struct stack_level *stack;
@ -487,24 +492,22 @@ push_decl_level (stack, obstack)
}
/* For each binding contour we allocate a binding_level structure
* which records the names defined in that contour.
* Contours include:
* 0) the global one
* 1) one for each function definition,
* where internal declarations of the parameters appear.
* 2) one for each compound statement,
* to record its declarations.
*
* The current meaning of a name can be found by searching the levels from
* the current one out to the global one.
*
* Off to the side, may be the class_binding_level. This exists
* only to catch class-local declarations. It is otherwise
* nonexistent.
*
* Also there may be binding levels that catch cleanups that
* must be run when exceptions occur.
*/
which records the names defined in that contour.
Contours include:
0) the global one
1) one for each function definition,
where internal declarations of the parameters appear.
2) one for each compound statement,
to record its declarations.
The current meaning of a name can be found by searching the levels
from the current one out to the global one.
Off to the side, may be the class_binding_level. This exists only
to catch class-local declarations. It is otherwise nonexistent.
Also there may be binding levels that catch cleanups that must be
run when exceptions occur. */
/* Note that the information in the `names' component of the global contour
is duplicated in the IDENTIFIER_GLOBAL_VALUEs of all identifiers. */
@ -512,19 +515,18 @@ push_decl_level (stack, obstack)
struct binding_level
{
/* A chain of _DECL nodes for all variables, constants, functions,
* and typedef types. These are in the reverse of the order supplied.
*/
and typedef types. These are in the reverse of the order
supplied. */
tree names;
/* A list of structure, union and enum definitions,
* for looking up tag names.
* It is a chain of TREE_LIST nodes, each of whose TREE_PURPOSE is a name,
* or NULL_TREE; and whose TREE_VALUE is a RECORD_TYPE, UNION_TYPE,
* or ENUMERAL_TYPE node.
*
* C++: the TREE_VALUE nodes can be simple types for component_bindings.
*
*/
/* A list of structure, union and enum definitions, for looking up
tag names.
It is a chain of TREE_LIST nodes, each of whose TREE_PURPOSE is a name,
or NULL_TREE; and whose TREE_VALUE is a RECORD_TYPE, UNION_TYPE,
or ENUMERAL_TYPE node.
C++: the TREE_VALUE nodes can be simple types for
component_bindings. */
tree tags;
/* For each level, a list of shadowed outer-level local definitions
@ -557,7 +559,7 @@ struct binding_level
/* List of VAR_DECLS saved from a previous for statement.
These would be dead in ANSI-conforming code, but might
be referenced in traditional code. */
be referenced in traditional code. */
tree dead_vars_from_for;
/* 1 for the level that holds the parameters of a function.
@ -586,7 +588,7 @@ struct binding_level
unsigned namespace_p : 1;
/* True if this level is that of a for-statement where we need to
worry about ambiguous (traditional or ANSI) scope rules. */
worry about ambiguous (traditional or ANSI) scope rules. */
unsigned is_for_scope : 1;
/* Two bits left for this word. */
@ -685,7 +687,7 @@ pop_binding_level ()
if (global_binding_level)
{
/* cannot pop a level, if there are none left to pop. */
/* cannot pop a level, if there are none left to pop. */
if (current_binding_level == global_binding_level)
my_friendly_abort (123);
}
@ -729,7 +731,7 @@ suspend_binding_level ()
if (global_binding_level)
{
/* cannot suspend a level, if there are none left to suspend. */
/* cannot suspend a level, if there are none left to suspend. */
if (current_binding_level == global_binding_level)
my_friendly_abort (123);
}
@ -764,7 +766,7 @@ resume_binding_level (b)
if (class_binding_level)
{
#if 1
/* These are here because we cannot deal with shadows yet. */
/* These are here because we cannot deal with shadows yet. */
sorry ("cannot resume a namespace inside class");
return;
#else
@ -775,7 +777,7 @@ resume_binding_level (b)
else
{
#if 1
/* These are here because we cannot deal with shadows yet. */
/* These are here because we cannot deal with shadows yet. */
if (b->level_chain != current_binding_level)
{
sorry ("cannot resume a namespace inside a different namespace");
@ -1096,7 +1098,7 @@ poplevel (keep, reverse, functionbody)
}
/* Save declarations made in a 'for' statement so we can support pre-ANSI
'for' scoping semantics. */
'for' scoping semantics. */
for (link = current_binding_level->shadowed; link; link = TREE_CHAIN (link))
{
@ -1106,7 +1108,7 @@ poplevel (keep, reverse, functionbody)
if (decl && DECL_DEAD_FOR_LOCAL (decl))
{
/* In this case keep the dead for-decl visible,
but remember what (if anything) it shadowed. */
but remember what (if anything) it shadowed. */
DECL_SHADOWED_FOR_VAR (decl) = TREE_VALUE (link);
TREE_CHAIN (decl) = outer->dead_vars_from_for;
outer->dead_vars_from_for = decl;
@ -1115,7 +1117,7 @@ poplevel (keep, reverse, functionbody)
IDENTIFIER_LOCAL_VALUE (id) = TREE_VALUE (link);
}
}
else /* Not special for scope. */
else /* Not special for scope. */
{
for (link = decls; link; link = TREE_CHAIN (link))
{
@ -1152,7 +1154,7 @@ poplevel (keep, reverse, functionbody)
In this case, we want remove the binding for i#3, restoring
that of i#2. Then we want to remove the binding for i#2,
and restore that of i#1. */
and restore that of i#1. */
link = current_binding_level->dead_vars_from_for;
for (; link != NULL_TREE; link = TREE_CHAIN (link))
@ -1272,6 +1274,7 @@ poplevel (keep, reverse, functionbody)
}
/* Resume a binding level for a namespace. */
void
resume_level (b)
struct binding_level *b;
@ -1337,6 +1340,7 @@ insert_block (block)
}
/* Add BLOCK to the current list of blocks for this binding contour. */
void
add_block_current_level (block)
tree block;
@ -1356,6 +1360,7 @@ set_block (block)
}
/* Do a pushlevel for class declarations. */
void
pushlevel_class ()
{
@ -1397,6 +1402,7 @@ pushlevel_class ()
/* ...and a poplevel for class declarations. FORCE is used to force
clearing out of CLASS_VALUEs after a class definition. */
tree
poplevel_class (force)
int force;
@ -1613,6 +1619,7 @@ extern char * first_global_object_name;
/* Get a unique name for each call to this routine for unnamed namespaces.
Mostly copied from get_file_function_name. */
static tree
get_unique_name ()
{
@ -1641,7 +1648,7 @@ get_unique_name ()
#ifndef NO_DOLLAR_IN_LABEL /* this for `$'; unlikely, but... -- kr */
|| *p == '$'
#endif
#ifndef NO_DOT_IN_LABEL /* this for `.'; unlikely, but... */
#ifndef NO_DOT_IN_LABEL /* this for `.'; unlikely, but... */
|| *p == '.'
#endif
|| (*p >= 'A' && *p <= 'Z')
@ -1654,6 +1661,7 @@ get_unique_name ()
/* Push into the scope of the NAME namespace. If NAME is NULL_TREE, then we
select a name that is unique to this compilation unit. */
void
push_namespace (name)
tree name;
@ -1672,7 +1680,7 @@ push_namespace (name)
d = build_lang_decl (NAMESPACE_DECL, name, void_type_node);
/* Mark them as external, so redeclaration_error_message doesn't think
they are duplicates. */
they are duplicates. */
DECL_EXTERNAL (d) = 1;
d = pushdecl (d);
@ -1687,7 +1695,7 @@ push_namespace (name)
else
resume_level (NAMESPACE_LEVEL (d));
/* This code is just is bit old now... */
/* This code is just is bit old now... */
current_namespace = tree_cons (NULL_TREE, name, current_namespace);
buf = (char *) alloca (4 + (old_id ? IDENTIFIER_LENGTH (old_id) : 0)
+ IDENTIFIER_LENGTH (name));
@ -1697,6 +1705,7 @@ push_namespace (name)
}
/* Pop from the scope of the current namespace. */
void
pop_namespace ()
{
@ -1704,7 +1713,7 @@ pop_namespace ()
tree decls, link;
current_namespace = TREE_CHAIN (current_namespace);
/* Just in case we get out of sync. */
/* Just in case we get out of sync. */
if (! namespace_bindings_p ())
poplevel (0, 0, 0);
@ -1765,7 +1774,7 @@ struct saved_scope {
};
static struct saved_scope *current_saved_scope;
tree
static tree
store_bindings (names, old_bindings)
tree names, old_bindings;
{
@ -1947,7 +1956,7 @@ pop_from_top_level ()
Note that the definition may really be just a forward reference.
In that case, the TYPE_SIZE will be a NULL_TREE.
C++ gratuitously puts all these tags in the name space. */
C++ gratuitously puts all these tags in the name space. */
/* When setting the IDENTIFIER_TYPE_VALUE field of an identifier ID,
record the shadowed value for this binding contour. TYPE is
@ -1968,7 +1977,7 @@ set_identifier_type_value_with_scope (id, type, b)
SET_IDENTIFIER_TYPE_VALUE (id, type);
}
/* As set_identifier_type_value_with_scope, but using inner_binding_level. */
/* As set_identifier_type_value_with_scope, but using inner_binding_level. */
void
set_identifier_type_value (id, type)
@ -1981,6 +1990,7 @@ set_identifier_type_value (id, type)
/* Pop off extraneous binding levels left over due to syntax errors.
We don't pop past namespaces, as they might be valid. */
void
pop_everything ()
{
@ -2002,7 +2012,7 @@ pop_everything ()
/* Push a tag name NAME for struct/class/union/enum type TYPE.
Normally put into into the inner-most non-tag-transparent scope,
but if GLOBALIZE is true, put it in the inner-most non-class scope.
The latter is needed for implicit declarations. */
The latter is needed for implicit declarations. */
void
pushtag (name, type, globalize)
@ -2054,7 +2064,7 @@ pushtag (name, type, globalize)
/* Mark the TYPE_DECL node we created just above as an
gratuitous one. We need to do this so that dwarfout.c
will understand that it is not supposed to output a
TAG_typedef DIE for it. */
TAG_typedef DIE for it. */
DECL_IGNORED_P (d) = 1;
}
#endif /* DWARF_DEBUGGING_INFO */
@ -2090,7 +2100,7 @@ pushtag (name, type, globalize)
/* Mark the TYPE_DECL node we created just above as an
gratuitous one. We need to do this so that dwarfout.c
will understand that it is not supposed to output a
TAG_typedef DIE for it. */
TAG_typedef DIE for it. */
DECL_IGNORED_P (d) = 1;
}
#endif /* DWARF_DEBUGGING_INFO */
@ -2142,10 +2152,12 @@ pushtag (name, type, globalize)
}
/* Counter used to create anonymous type names. */
static int anon_cnt = 0;
/* Return an IDENTIFIER which can be used as a name for
anonymous structs and unions. */
tree
make_anon_name ()
{
@ -2157,6 +2169,7 @@ make_anon_name ()
/* Clear the TREE_PURPOSE slot of tags which have anonymous typenames.
This keeps dbxout from getting confused. */
void
clear_anon_tags ()
{
@ -2191,6 +2204,7 @@ clear_anon_tags ()
For C++, we must compare the parameter list so that `int' can match
`int&' in a parameter position, but `int&' is not confused with
`const int&'. */
int
decls_match (newdecl, olddecl)
tree newdecl, olddecl;
@ -2460,7 +2474,7 @@ duplicate_decls (newdecl, olddecl)
{
/* The name of a class template may not be declared to refer to
any other template, class, function, object, namespace, value,
or type in the same scope. */
or type in the same scope. */
if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == TYPE_DECL
|| TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL)
{
@ -2613,7 +2627,7 @@ duplicate_decls (newdecl, olddecl)
warn about it. */
warn_extern_redeclared_static (newdecl, olddecl);
/* We have committed to returning 1 at this point. */
/* We have committed to returning 1 at this point. */
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
/* Now that functions must hold information normally held
@ -2779,6 +2793,9 @@ duplicate_decls (newdecl, olddecl)
/* Merge the storage class information. */
DECL_WEAK (newdecl) |= DECL_WEAK (olddecl);
#ifdef DECL_ONE_ONLY
DECL_ONE_ONLY (newdecl) |= DECL_ONE_ONLY (olddecl);
#endif
TREE_PUBLIC (newdecl) = TREE_PUBLIC (olddecl);
TREE_STATIC (olddecl) = TREE_STATIC (newdecl) |= TREE_STATIC (olddecl);
if (! DECL_EXTERNAL (olddecl))
@ -2965,7 +2982,7 @@ pushdecl (x)
DECL_CONTEXT (x) = 0;
/* Type are looked up using the DECL_NAME, as that is what the rest of the
compiler wants to use. */
compiler wants to use. */
if (TREE_CODE (x) == TYPE_DECL || TREE_CODE (x) == VAR_DECL
|| TREE_CODE (x) == NAMESPACE_DECL)
name = DECL_NAME (x);
@ -2990,7 +3007,7 @@ pushdecl (x)
{
#if 0
/* This is turned off until I have time to do it right (bpk). */
/* With the code below that uses it... */
/* With the code below that uses it... */
file = DECL_SOURCE_FILE (t);
line = DECL_SOURCE_LINE (t);
#endif
@ -2999,7 +3016,7 @@ pushdecl (x)
if (DECL_CONTEXT (t) == NULL_TREE)
fatal ("parse errors have confused me too much");
/* Check for duplicate params. */
/* Check for duplicate params. */
if (duplicate_decls (x, t))
return t;
}
@ -3348,6 +3365,7 @@ pushdecl_with_scope (x, level)
/* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL,
if appropriate. */
tree
pushdecl_top_level (x)
tree x;
@ -3391,6 +3409,7 @@ pushdecl_top_level (x)
/* Like push_overloaded_decl, only it places X in GLOBAL_BINDING_LEVEL,
if appropriate. */
void
push_overloaded_decl_top_level (x, forget)
tree x;
@ -3404,6 +3423,7 @@ push_overloaded_decl_top_level (x, forget)
}
/* Make the declaration of X appear in CLASS scope. */
tree
pushdecl_class_level (x)
tree x;
@ -3446,6 +3466,7 @@ pushdecl_class_level (x)
/* This function is used to push the mangled decls for nested types into
the appropriate scope. Previously pushdecl_top_level was used, but that
is incorrect for members of local classes. */
void
pushdecl_nonclass_level (x)
tree x;
@ -3465,6 +3486,7 @@ pushdecl_nonclass_level (x)
/* Make the declaration(s) of X appear in CLASS scope
under the name NAME. */
void
push_class_level_binding (name, x)
tree name;
@ -3485,6 +3507,7 @@ push_class_level_binding (name, x)
/* Tell caller how to interpret a TREE_LIST which contains
chains of FUNCTION_DECLS. */
int
overloaded_globals_p (list)
tree list;
@ -3513,6 +3536,7 @@ overloaded_globals_p (list)
The value returned may be a previous declaration if we guessed wrong
about what language DECL should belong to (C or C++). Otherwise,
it's always DECL (and never something that's not a _DECL). */
tree
push_overloaded_decl (decl, forgettable)
tree decl;
@ -3945,6 +3969,7 @@ pop_switch ()
/* Same, but for CASE labels. If DECL is NULL_TREE, it's the default. */
/* XXX Note decl is never actually used. (bpk) */
void
define_case_label (decl)
tree decl;
@ -4193,6 +4218,7 @@ lookup_tag_reverse (type, name)
/* Given type TYPE which was not declared in C++ language context,
attempt to find a name by which it is referred. */
tree
typedecl_for_tag (tag)
tree tag;
@ -4220,6 +4246,7 @@ typedecl_for_tag (tag)
/* Lookup TYPE in CONTEXT (a chain of nested types or a FUNCTION_DECL).
Return the type value, or NULL_TREE if not found. */
static tree
lookup_nested_type (type, context)
tree type;
@ -4260,6 +4287,7 @@ lookup_nested_type (type, context)
}
/* Look up NAME in the NAMESPACE. */
tree
lookup_namespace_name (namespace, name)
tree namespace, name;
@ -4374,7 +4402,7 @@ lookup_name_real (name, prefer_type, nonclass)
}
else if (! IS_AGGR_TYPE (type)
|| TREE_CODE (type) == TEMPLATE_TYPE_PARM)
/* Someone else will give an error about this if needed. */
/* Someone else will give an error about this if needed. */
val = NULL_TREE;
else if (TYPE_BEING_DEFINED (type))
{
@ -4416,7 +4444,7 @@ lookup_name_real (name, prefer_type, nonclass)
}
#endif
if (got_scope)
if (got_scope || val)
goto done;
/* This special lookup only applies to types. */
@ -4638,6 +4666,7 @@ record_builtin_type (rid_index, name, type)
/* Push overloaded decl, in global scope, with one argument so it
can be used as a callback from define_function. */
static void
push_overloaded_decl_1 (x)
tree x;
@ -4705,13 +4734,13 @@ init_decl_processing ()
/* Because most segmentation signals can be traced back into user
code, catch them and at least give the user a chance of working
around compiler bugs. */
around compiler bugs. */
signal (SIGSEGV, signal_catch);
/* We will also catch aborts in the back-end through signal_catch and
give the user a chance to see where the error might be, and to defeat
aborts in the back-end when there have been errors previously in their
code. */
code. */
#ifdef SIGIOT
signal (SIGIOT, signal_catch);
#endif
@ -4876,6 +4905,9 @@ init_decl_processing ()
size_zero_node = size_int (0);
size_one_node = size_int (1);
signed_size_zero_node = build_int_2 (0, 0);
TREE_TYPE (signed_size_zero_node) = make_signed_type (TYPE_PRECISION (sizetype));
void_type_node = make_node (VOID_TYPE);
record_builtin_type (RID_VOID, NULL_PTR, void_type_node);
layout_type (void_type_node); /* Uses integer_zero_node. */
@ -5205,7 +5237,7 @@ init_decl_processing ()
TYPE_MODE (unknown_type_node) = TYPE_MODE (void_type_node);
/* Indirecting an UNKNOWN_TYPE node yields an UNKNOWN_TYPE node. */
TREE_TYPE (unknown_type_node) = unknown_type_node;
/* Looking up TYPE_POINTER_TO and TYPE_REFERENCE_TO yield the same result. */
/* Looking up TYPE_POINTER_TO and TYPE_REFERENCE_TO yield the same result. */
TYPE_POINTER_TO (unknown_type_node) = unknown_type_node;
TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node;
@ -5214,7 +5246,7 @@ init_decl_processing ()
TYPE_MAIN_VARIANT (opaque_type_node) = opaque_type_node;
record_builtin_type (RID_MAX, 0, opaque_type_node);
/* This is special for C++ so functions can be overloaded. */
/* This is special for C++ so functions can be overloaded. */
wchar_type_node
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (WCHAR_TYPE)));
wchar_type_size = TYPE_PRECISION (wchar_type_node);
@ -5478,7 +5510,7 @@ init_decl_processing ()
init_function_format_info ();
}
/* initialize type descriptor type node of various rtti type. */
/* initialize type descriptor type node of various rtti type. */
int
init_type_desc()
@ -5737,7 +5769,7 @@ start_decl (declarator, declspecs, initialized, raises)
int init_written = initialized;
#endif
/* This should only be done once on the top most decl. */
/* This should only be done once on the top most decl. */
if (have_extern_spec && !used_extern_spec)
{
declspecs = decl_tree_cons (NULL_TREE, get_identifier ("extern"),
@ -6017,8 +6049,10 @@ start_decl_1 (decl)
/* Handle initialization of references.
These three arguments from from `cp_finish_decl', and have the
same meaning here that they do there. */
/* quotes on semantics can be found in ARM 8.4.3. */
same meaning here that they do there.
Quotes on semantics can be found in ARM 8.4.3. */
static void
grok_reference_init (decl, type, init, cleanupp)
tree decl, type, init;
@ -6661,7 +6695,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
current_binding_level.
Otherwise, we need to preserve the temp slot for decl
to last into the outer binding level. */
to last into the outer binding level. */
int handling_dead_for_vars = 0;
tree link = outer->names;
@ -6792,6 +6826,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
}
/* This is here for a midend callback from c-common.c */
void
finish_decl (decl, init, asmspec_tree)
tree decl, init;
@ -6822,7 +6857,7 @@ expand_static_init (decl, init)
tree old_cleanups;
int old_temp_level;
/* Remember this information until end of file. */
/* Remember this information until end of file. */
push_obstacks (&permanent_obstack, &permanent_obstack);
/* Emit code to perform this initialization but once. */
@ -6859,7 +6894,7 @@ expand_static_init (decl, init)
if (Atexit == 0)
{
tree atexit_fndecl, PFV, pfvlist;
/* Remember this information until end of file. */
/* Remember this information until end of file. */
push_obstacks (&permanent_obstack, &permanent_obstack);
PFV = build_pointer_type (build_function_type
(void_type_node, void_list_node));
@ -6894,7 +6929,7 @@ expand_static_init (decl, init)
TREE_STATIC (static_aggregates) = 1;
}
/* Resume old (possibly temporary) allocation. */
/* Resume old (possibly temporary) allocation. */
pop_obstacks ();
}
else
@ -6993,6 +7028,7 @@ complete_array_type (type, initial_value, do_default)
/* Return zero if something is declared to be a member of type
CTYPE when in the context of CUR_TYPE. STRING is the error
message to print in that case. Otherwise, quietly return 1. */
static int
member_function_or_else (ctype, cur_type, string)
tree ctype, cur_type;
@ -7010,6 +7046,7 @@ member_function_or_else (ctype, cur_type, string)
/* Generate errors possibly applicable for a given set of specifiers.
This is for ARM $7.1.2. */
static void
bad_specifiers (object, type, virtualp, quals, inlinep, friendp, raises)
tree object;
@ -7040,6 +7077,7 @@ bad_specifiers (object, type, virtualp, quals, inlinep, friendp, raises)
RAISES is a list of exceptions that this function can raise.
CHECK is 1 if we must find this method in CTYPE, 0 if we should
not look, and -1 if we should not call `grokclassfn' at all. */
static tree
grokfndecl (ctype, type, declarator, virtualp, flags, quals,
raises, attrlist, check, publicp, inlinep, funcdef_flag)
@ -7285,7 +7323,7 @@ grokvardecl (type, declarator, specbits, initialized, constp)
return decl;
}
/* Create a canonical pointer to member function type. */
/* Create a canonical pointer to member function type. */
tree
build_ptrmemfunc_type (type)
@ -7314,7 +7352,7 @@ build_ptrmemfunc_type (type)
t = make_lang_type (RECORD_TYPE);
/* Let the front-end know this is a pointer to member function. */
/* Let the front-end know this is a pointer to member function. */
TYPE_PTRMEMFUNC_FLAG (t) = 1;
/* and not really an aggregate. */
IS_AGGR_TYPE (t) = 0;
@ -7334,7 +7372,7 @@ build_ptrmemfunc_type (type)
TYPE_SET_PTRMEMFUNC_TYPE (type, t);
/* Seems to be wanted. */
/* Seems to be wanted. */
CLASSTYPE_GOT_SEMICOLON (t) = 1;
return t;
}
@ -7666,7 +7704,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
dname = DECL_NAME (decl);
name = IDENTIFIER_POINTER (dname);
/* Avoid giving two errors for this. */
/* Avoid giving two errors for this. */
IDENTIFIER_CLASS_VALUE (dname) = NULL_TREE;
declspecs = temp_tree_cons (NULL_TREE, integer_type_node,
@ -7775,7 +7813,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
}
goto found;
}
/* C++ aggregate types. */
/* C++ aggregate types. */
if (IDENTIFIER_HAS_TYPE_VALUE (id))
{
if (type)
@ -7805,7 +7843,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
}
}
}
/* C++ aggregate types. */
/* C++ aggregate types. */
else if (TREE_CODE (id) == TYPE_DECL)
{
if (type)
@ -8515,7 +8553,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
return void_type_node;
}
}
else /* it's a constructor. */
else /* it's a constructor. */
{
if (explicitp == 1)
explicitp = 2;
@ -9128,7 +9166,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
if (TREE_CODE (type) == ARRAY_TYPE)
{
/* Transfer const-ness of array into that of type pointed to. */
/* Transfer const-ness of array into that of type pointed to. */
type = build_pointer_type
(cp_build_type_variant (TREE_TYPE (type), constp, volatilep));
volatilep = constp = 0;
@ -9484,7 +9522,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
if (TREE_CODE (type) == ARRAY_TYPE)
{
/* Transfer const-ness of array into that of type pointed to. */
/* Transfer const-ness of array into that of type
pointed to. */
type = build_pointer_type
(cp_build_type_variant (TREE_TYPE (type), constp, volatilep));
volatilep = constp = 0;
@ -9558,6 +9597,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, raises, attrli
An empty exprlist is a parmlist. An exprlist which
contains only identifiers at the global level
is a parmlist. Otherwise, it is an exprlist. */
int
parmlist_is_exprlist (exprs)
tree exprs;
@ -9584,6 +9624,7 @@ parmlist_is_exprlist (exprs)
be complete.
C++: also subroutine of `start_function'. */
static void
require_complete_types_for_parms (parms)
tree parms;
@ -9811,7 +9852,7 @@ grokparms (first_parm, funcdef_flag)
argument expressions.'' dpANSI C++ 8.2.6 */
/* If extern int i; within a function is not
considered a local variable, then this code is
wrong. */
wrong. */
cp_error ("local variable `%D' may not be used as a default argument", init);
any_error = 1;
}
@ -9879,6 +9920,7 @@ grokparms (first_parm, funcdef_flag)
`grok_op_properties' takes notice of the various forms of
operator= which are defined, as well as what sorts of type conversion
may apply. Both functions take a FUNCTION_DECL as an argument. */
int
grok_ctor_properties (ctype, decl)
tree ctype, decl;
@ -9934,6 +9976,7 @@ grok_ctor_properties (ctype, decl)
}
/* An operator with this name can be either unary or binary. */
static int
ambi_op_p (name)
tree name;
@ -9947,6 +9990,7 @@ ambi_op_p (name)
}
/* An operator with this name can only be unary. */
static int
unary_op_p (name)
tree name;
@ -9958,6 +10002,7 @@ unary_op_p (name)
}
/* Do a little sanity-checking on how they declared their operator. */
void
grok_op_properties (decl, virtualp, friendp)
tree decl;
@ -10256,9 +10301,11 @@ xref_tag (code_type_node, name, binfo, globalize)
if (t && TYPE_CONTEXT (t) && got_type)
ref = t;
else
/* If we know we are defining this tag, only look it up in this scope
* and don't try to find it as a type. */
ref = lookup_tag (code, name, b, 1);
{
/* If we know we are defining this tag, only look it up in
this scope and don't try to find it as a type. */
ref = lookup_tag (code, name, b, 1);
}
}
else
{
@ -10565,9 +10612,8 @@ start_enum (name)
current_local_enum = NULL_TREE;
/* We copy this value because enumerated type constants
are really of the type of the enumerator, not integer_type_node. */
enum_next_value = copy_node (integer_zero_node);
/* We don't copy this value because build_enumerator needs to do it. */
enum_next_value = integer_zero_node;
enum_overflow = 0;
GNU_xref_decl (current_function_decl, enumtype);
@ -10684,8 +10730,6 @@ build_enumerator (name, value)
tree name, value;
{
tree decl, result;
/* Change this to zero if we find VALUE is not shareable. */
int shareable = 1;
/* Remove no-op casts from the value. */
if (value)
@ -10697,10 +10741,7 @@ build_enumerator (name, value)
if (value != NULL_TREE)
{
if (TREE_READONLY_DECL_P (value))
{
value = decl_constant_value (value);
shareable = 0;
}
value = decl_constant_value (value);
if (TREE_CODE (value) == INTEGER_CST)
{
@ -10714,9 +10755,6 @@ build_enumerator (name, value)
}
}
/* The order of things is reversed here so that we
can check for possible sharing of enum values,
to keep that from happening. */
/* Default based on previous value. */
if (value == NULL_TREE && ! current_template_parms)
{
@ -10729,18 +10767,10 @@ build_enumerator (name, value)
if (value)
STRIP_TYPE_NOPS (value);
/* Make up for hacks in lex.c. */
if (value == integer_zero_node)
value = build_int_2 (0, 0);
else if (value == integer_one_node)
value = build_int_2 (1, 0);
else if (TREE_CODE (value) == INTEGER_CST
&& (shareable == 0
|| TREE_CODE (TREE_TYPE (value)) == ENUMERAL_TYPE))
{
value = copy_node (value);
TREE_TYPE (value) = integer_type_node;
}
/* We have to always copy here; not all INTEGER_CSTs are unshared,
and there's no wedding ring. Look at size_int()...*/
value = copy_node (value);
TREE_TYPE (value) = integer_type_node;
}
/* C++ associates enums with global, function, or class declarations. */
@ -10774,9 +10804,6 @@ build_enumerator (name, value)
enum_next_value = build_binary_op_nodefault (PLUS_EXPR, value,
integer_one_node, PLUS_EXPR);
enum_overflow = tree_int_cst_lt (enum_next_value, value);
if (enum_next_value == integer_one_node)
enum_next_value = copy_node (enum_next_value);
}
result = saveable_tree_cons (name, decl, NULL_TREE);
@ -10849,7 +10876,7 @@ start_function (declspecs, declarator, raises, attrs, pre_parsed_p)
my_friendly_assert (TREE_VALUE (void_list_node) == void_type_node, 160);
my_friendly_assert (TREE_CHAIN (void_list_node) == NULL_TREE, 161);
/* Assume, until we see it does. */
/* Assume, until we see it does. */
current_function_returns_value = 0;
current_function_returns_null = 0;
warn_about_return_type = 0;
@ -10867,7 +10894,7 @@ start_function (declspecs, declarator, raises, attrs, pre_parsed_p)
clear_temp_name ();
/* This should only be done once on the top most decl. */
/* This should only be done once on the top most decl. */
if (have_extern_spec && !used_extern_spec)
{
declspecs = decl_tree_cons (NULL_TREE, get_identifier ("extern"), declspecs);
@ -11386,6 +11413,7 @@ store_parm_decls ()
/* Bind a name and initialization to the return value of
the current function. */
void
store_return_init (return_id, init)
tree return_id, init;
@ -11450,7 +11478,10 @@ store_return_init (return_id, init)
C++: CALL_POPLEVEL is non-zero if an extra call to poplevel
(and expand_end_bindings) must be made to take care of the binding
contour for the base initializers. This is only relevant for
constructors. */
constructors.
NESTED is nonzero if we were in the middle of compiling another function
when we started on this one. */
void
finish_function (lineno, call_poplevel, nested)
@ -11470,6 +11501,9 @@ finish_function (lineno, call_poplevel, nested)
if (fndecl == NULL_TREE)
return;
if (! nested && function_depth > 1)
nested = 1;
fntype = TREE_TYPE (fndecl);
/* TREE_READONLY (fndecl) = 1;
@ -11567,10 +11601,10 @@ finish_function (lineno, call_poplevel, nested)
if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)
|| TYPE_GETS_REG_DELETE (current_class_type))
exprstmt = build_delete (current_class_type, current_class_ref, integer_zero_node,
LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR, 0);
LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL, 0);
else
exprstmt = build_delete (current_class_type, current_class_ref, in_charge_node,
LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR, 0);
LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL, 0);
/* If we did not assign to this, then `this' is non-zero at
the end of a destructor. As a special optimization, don't
@ -11602,9 +11636,13 @@ finish_function (lineno, call_poplevel, nested)
if (TYPE_NEEDS_DESTRUCTOR (BINFO_TYPE (vbases)))
{
tree ptr = convert_pointer_to_vbase (BINFO_TYPE (vbases), current_class_ptr);
expand_expr_stmt (build_delete (build_pointer_type (BINFO_TYPE (vbases)),
ptr, integer_zero_node,
LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_HAS_IN_CHARGE, 0));
expand_expr_stmt
(build_delete
(build_pointer_type (BINFO_TYPE (vbases)),
ptr, integer_zero_node,
(LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR
|LOOKUP_HAS_IN_CHARGE|LOOKUP_NORMAL),
0));
}
vbases = TREE_CHAIN (vbases);
}
@ -12025,6 +12063,7 @@ finish_function (lineno, call_poplevel, nested)
DO NOT MAKE ANY CHANGES TO THIS CODE WITHOUT MAKING CORRESPONDING
CHANGES TO CODE IN `grokfield'. */
tree
start_method (declspecs, declarator, raises)
tree declarator, declspecs, raises;
@ -12242,6 +12281,7 @@ hack_incomplete_structures (type)
Don't build these on the momentary obstack; they must live
the life of the binding contour. */
tree
maybe_build_cleanup (decl)
tree decl;
@ -12292,9 +12332,8 @@ maybe_build_cleanup (decl)
expressions are combined with other, type-providing, expressions,
leaving only orphan expressions, such as:
&class::bar; / / takes its address, but does nothing with it.
&class::bar; / / takes its address, but does nothing with it. */
*/
void
cplus_expand_expr_stmt (exp)
tree exp;

View File

@ -56,7 +56,7 @@ tree pending_vtables;
tree pending_statics;
/* A list of functions which were declared inline, but which we
may need to emit outline anyway. */
may need to emit outline anyway. */
static tree saved_inlines;
/* Used to help generate temporary names which are unique within
@ -131,7 +131,7 @@ int flag_ansi;
int flag_implement_inlines = 1;
/* Nonzero means do emit exported implementations of templates, instead of
multiple static copies in each file that needs a definition. */
multiple static copies in each file that needs a definition. */
int flag_external_templates;
@ -155,13 +155,9 @@ int warn_implicit = 1;
int warn_ctor_dtor_privacy = 1;
/* True if we want to implement vtables using "thunks".
The default is off by default, on if explicitly supported. */
The default is off by default, on if explicitly supported. */
#ifdef ASM_OUTPUT_MI_THUNK
int flag_vtable_thunks = 1;
#else
int flag_vtable_thunks;
#endif
/* True if we want to deal with repository information. */
@ -214,7 +210,7 @@ int warn_missing_braces;
int warn_sign_compare;
/* Warn about *printf or *scanf format/argument anomalies. */
/* Warn about *printf or *scanf format/argument anomalies. */
int warn_format;
@ -236,7 +232,7 @@ int warn_parentheses;
int warn_overloaded_virtual;
/* Non-zero means warn when declaring a class that has a non virtual
destructor, when it really ought to have a virtual one. */
destructor, when it really ought to have a virtual one. */
int warn_nonvdtor;
/* Non-zero means warn when a function is declared extern and later inline. */
@ -345,7 +341,7 @@ extern int flag_gnu_xref;
int flag_assume_nonnull_objects = 1;
/* Nonzero if we want to support huge (> 2^(sizeof(short)*8-1) bytes)
objects. */
objects. */
int flag_huge_objects;
@ -628,6 +624,7 @@ lang_decode_option (p)
/* Incorporate `const' and `volatile' qualifiers for member functions.
FUNCTION is a TYPE_DECL or a FUNCTION_DECL.
QUALS is a list of qualifiers. */
tree
grok_method_quals (ctype, function, quals)
tree ctype, function, quals;
@ -675,11 +672,12 @@ grok_method_quals (ctype, function, quals)
return ctype;
}
#if 0 /* Not used. */
#if 0 /* Not used. */
/* This routine replaces cryptic DECL_NAMEs with readable DECL_NAMEs.
It leaves DECL_ASSEMBLER_NAMEs with the correct value. */
/* This does not yet work with user defined conversion operators
It should. */
static void
substitute_nice_name (decl)
tree decl;
@ -697,6 +695,7 @@ substitute_nice_name (decl)
/* Warn when -fexternal-templates is used and #pragma
interface/implementation is not used all the times it should be,
inform the user. */
void
warn_if_unknown_interface (decl)
tree decl;
@ -727,6 +726,7 @@ warn_if_unknown_interface (decl)
}
/* A subroutine of the parser, to handle a component list. */
tree
grok_x_components (specs, components)
tree specs, components;
@ -1004,6 +1004,7 @@ grokclassfn (ctype, cname, function, flags, quals)
}
/* Work on the expr used by alignof (this is only called by the parser). */
tree
grok_alignof (expr)
tree expr;
@ -1047,6 +1048,7 @@ grok_alignof (expr)
/* Create an ARRAY_REF, checking for the user doing things backwards
along the way. */
tree
grok_array_decl (array_expr, index_exp)
tree array_expr, index_exp;
@ -1120,6 +1122,7 @@ grok_array_decl (array_expr, index_exp)
for doing an array delete. If DOING_VEC is 2, they gave us the
array size as an argument to delete.
Implements ARM $5.3.4. This is called from the parser. */
tree
delete_sanity (exp, size, doing_vec, use_global_delete)
tree exp, size;
@ -1263,9 +1266,9 @@ check_classfn (ctype, function)
return fndecl;
#if 0
/* This doesn't work for static member functions that are
pretending to be methods. */
pretending to be methods. */
/* We have to do more extensive argument checking here, as
the name may have been changed by asm("new_name"). */
the name may have been changed by asm("new_name"). */
if (decls_match (function, fndecl))
return fndecl;
#else
@ -1275,7 +1278,7 @@ check_classfn (ctype, function)
tree p2 = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
/* Get rid of the this parameter on functions that become
static. */
static. */
if (DECL_STATIC_FUNCTION_P (fndecl)
&& TREE_CODE (TREE_TYPE (function)) == METHOD_TYPE)
p1 = TREE_CHAIN (p1);
@ -1643,6 +1646,7 @@ grokbitfield (declarator, declspecs, width)
buried in DECLSPECS. Find the declarator, and
return something that looks like it came from
GROKFIELD. */
tree
groktypefield (declspecs, parmlist)
tree declspecs;
@ -1899,7 +1903,7 @@ grok_function_init (decl, init)
#if 0
/* Mark this function as being "defined". */
DECL_INITIAL (decl) = error_mark_node;
/* pure virtual destructors must be defined. */
/* pure virtual destructors must be defined. */
/* pure virtual needs to be defined (as abort) only when put in
vtbl. For wellformed call, it should be itself. pr4737 */
if (!DESTRUCTOR_NAME_P (DECL_ASSEMBLER_NAME (decl)))
@ -1971,6 +1975,7 @@ cplus_decl_attributes (decl, attributes, prefix_attributes)
specified class. Argument can be RECORD_TYPE, TYPE_DECL, or
IDENTIFIER_NODE. When given a template, this routine doesn't
lose the specialization. */
tree
constructor_name_full (thing)
tree thing;
@ -1997,6 +2002,7 @@ constructor_name_full (thing)
specified class. Argument can be RECORD_TYPE, TYPE_DECL, or
IDENTIFIER_NODE. When given a template, return the plain
unspecialized name. */
tree
constructor_name (thing)
tree thing;
@ -2012,6 +2018,7 @@ constructor_name (thing)
/* Cache the value of this class's main virtual function table pointer
in a register variable. This will save one indirection if a
more than one virtual function call is made this function. */
void
setup_vtbl_ptr ()
{
@ -2030,6 +2037,7 @@ setup_vtbl_ptr ()
}
/* Record the existence of an addressable inline function. */
void
mark_inline_for_output (decl)
tree decl;
@ -2118,6 +2126,7 @@ get_temp_name (type, staticp)
It is not entered into current_binding_level, because
that breaks things when it comes time to do final cleanups
(which take place "outside" the binding contour of the function). */
tree
get_temp_regvar (type, init)
tree type, init;
@ -2143,6 +2152,7 @@ get_temp_regvar (type, init)
/* Make the macro TEMP_NAME_P available to units which do not
include c-tree.h. */
int
temp_name_p (decl)
tree decl;
@ -2156,6 +2166,7 @@ temp_name_p (decl)
union is an anonymous union, we arrange for that
as well. PUBLIC_P is nonzero if this union is
not declared static. */
void
finish_anon_union (anon_union_decl)
tree anon_union_decl;
@ -2240,6 +2251,7 @@ finish_anon_union (anon_union_decl)
TYPE is the type of the table entry.
INIT is all the elements in the table.
PUBLICP is non-zero if this table should be given external access. */
tree
finish_table (name, type, init, publicp)
tree name, type, init;
@ -2316,6 +2328,7 @@ finish_table (name, type, init, publicp)
used in FIELDS.
It is given the same alignment as ALIGN_TYPE. */
void
finish_builtin_type (type, name, fields, len, align_type)
tree type;
@ -2601,7 +2614,8 @@ finish_vtable_vardecl (prev, vars)
&& ! DECL_ONE_ONLY (vars)
#endif
)
|| TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars)))
|| TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (vars))
|| (hack_decl_function_context (vars) && TREE_USED (vars)))
&& ! TREE_ASM_WRITTEN (vars))
{
/* Write it out. */
@ -2747,7 +2761,8 @@ import_export_decl (decl)
if (DECL_TEMPLATE_INSTANTIATION (decl))
{
DECL_NOT_REALLY_EXTERN (decl) = 1;
if (DECL_IMPLICIT_INSTANTIATION (decl) && flag_implicit_templates)
if (DECL_IMPLICIT_INSTANTIATION (decl)
&& (flag_implicit_templates || DECL_THIS_INLINE (decl)))
{
if (TREE_CODE (decl) == FUNCTION_DECL)
{
@ -2922,7 +2937,15 @@ finish_file ()
for (fnname = pending_templates; fnname; fnname = TREE_CHAIN (fnname))
{
tree decl = TREE_VALUE (fnname);
instantiate_decl (decl);
if (TREE_CODE_CLASS (TREE_CODE (decl)) == 't')
{
instantiate_class_template (decl);
if (CLASSTYPE_TEMPLATE_INSTANTIATION (decl))
for (vars = TYPE_METHODS (decl); vars; vars = TREE_CHAIN (vars))
instantiate_decl (vars);
}
else
instantiate_decl (decl);
}
/* Push into C language context, because that's all
@ -2941,7 +2964,7 @@ finish_file ()
virtual function tables, moving the implementation of this code to
decl.c (where we can manipulate global_binding_level directly),
popping the garbage after pushing it and slicing away the vtable
stuff, or just leaving it alone. */
stuff, or just leaving it alone. */
/* Make last thing in global scope not be a virtual function table. */
#if 0 /* not yet, should get fixed properly later */
@ -2955,7 +2978,7 @@ finish_file ()
#endif
/* Walk to mark the inline functions we need, then output them so
that we can pick up any other tdecls that those routines need. */
that we can pick up any other tdecls that those routines need. */
walk_vtables ((void (*)())0, finish_prevtable_vardecl);
for (vars = pending_statics; vars; vars = TREE_CHAIN (vars))
@ -3267,7 +3290,7 @@ finish_file ()
/* We can't inline this function after it's been
emitted, so just disable inlining. We want a
variant of output_inline_function that doesn't
prevent subsequent integration... */
prevent subsequent integration... */
flag_no_inline = 1;
temporary_allocation ();
output_inline_function (decl);
@ -3329,6 +3352,7 @@ finish_file ()
Maybe this shouldn't be recursive, but how often will it actually be
used? (jason) */
tree
reparse_absdcl_as_expr (type, decl)
tree type, decl;
@ -3355,6 +3379,7 @@ reparse_absdcl_as_expr (type, decl)
In the above example, DECL is the `(int)(int)(int)', and EXPR is the
`1'. */
tree
reparse_absdcl_as_casts (decl, expr)
tree decl, expr;
@ -3392,7 +3417,7 @@ reparse_absdcl_as_casts (decl, expr)
return expr;
}
/* Given plain tree nodes for an expression, build up the full semantics. */
/* Given plain tree nodes for an expression, build up the full semantics. */
tree
build_expr_from_tree (t)
@ -3424,6 +3449,18 @@ build_expr_from_tree (t)
return build_reinterpret_cast
(TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
case CONST_CAST_EXPR:
return build_const_cast
(TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
case DYNAMIC_CAST_EXPR:
return build_dynamic_cast
(TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
case STATIC_CAST_EXPR:
return build_static_cast
(TREE_TYPE (t), build_expr_from_tree (TREE_OPERAND (t, 0)));
case PREDECREMENT_EXPR:
case PREINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
@ -3608,6 +3645,7 @@ build_expr_from_tree (t)
build_expr_from_tree, above.
In the above example, TYPE is `int' and DECL is `*a'. */
tree
reparse_decl_as_expr (type, decl)
tree type, decl;
@ -3621,7 +3659,7 @@ reparse_decl_as_expr (type, decl)
/* This is something of the form `int (*a)' that has turned out to be a
decl. It was only converted into parse nodes, so we need to do the
checking that make_{pointer,reference}_declarator do. */
checking that make_{pointer,reference}_declarator do. */
tree
finish_decl_parsing (decl)
@ -3692,6 +3730,7 @@ tree current_namespace;
/* Get the inner part of a namespace id. It doesn't have any prefix, nor
postfix. Returns 0 if in global namespace. */
tree
get_namespace_id ()
{
@ -3701,7 +3740,8 @@ get_namespace_id ()
return x;
}
/* Build up a DECL_ASSEMBLER_NAME for NAME in the current namespace. */
/* Build up a DECL_ASSEMBLER_NAME for NAME in the current namespace. */
tree
current_namespace_id (name)
tree name;
@ -3709,7 +3749,7 @@ current_namespace_id (name)
tree old_id = get_namespace_id ();
char *buf;
/* Global names retain old encoding. */
/* Global names retain old encoding. */
if (! old_id)
return name;

View File

@ -121,7 +121,8 @@ dump_readonly_or_volatile (t, p)
value. */
static char digit_buffer[128];
/* Dump into the obstack a human-readable equivalent of TYPE. */
/* Dump into the obstack a human-readable equivalent of TYPE. */
static void
dump_type (t, v)
tree t;
@ -259,7 +260,8 @@ aggr_variety (t)
return "struct";
}
/* Print out a class declaration, in the form `class foo'. */
/* Print out a class declaration, in the form `class foo'. */
static void
dump_aggr_type (t, v)
tree t;
@ -515,6 +517,7 @@ dump_type_suffix (t, v)
/* Return a function declaration which corresponds to the IDENTIFIER_NODE
argument. */
tree
ident_fndecl (t)
tree t;
@ -650,7 +653,7 @@ dump_decl (t, v)
break;
/* These special cases are duplicated here so that other functions
can feed identifiers to cp_error and get them demangled properly. */
can feed identifiers to cp_error and get them demangled properly. */
case IDENTIFIER_NODE:
{ tree f;
if (DESTRUCTOR_NAME_P (t)
@ -834,6 +837,7 @@ dump_function_decl (t, v)
/* Handle the function name for a FUNCTION_DECL node, grokking operators
and destructors properly. */
static void
dump_function_name (t)
tree t;
@ -917,6 +921,7 @@ dump_char (c)
}
/* Print out a list of initializers (subr of dump_expr) */
static void
dump_expr_list (l)
tree l;
@ -931,6 +936,7 @@ dump_expr_list (l)
}
/* Print out an expression */
static void
dump_expr (t, nop)
tree t;
@ -1377,6 +1383,7 @@ fndecl_as_string (fndecl, print_ret_type_p)
/* Same, but handtype a _TYPE.
Called from convert_to_reference, mangle_class_name_for_template,
build_unary_op, and GNU_xref_decl. */
char *
type_as_string (typ, v)
tree typ;
@ -1407,6 +1414,7 @@ expr_as_string (decl, v)
/* A cross between type_as_string and fndecl_as_string.
Only called from substitute_nice_name. */
char *
decl_as_string (decl, v)
tree decl;
@ -1482,6 +1490,7 @@ language_as_string (c, v)
}
/* Return the proper printed version of a parameter to a C++ function. */
char *
parm_as_string (p, v)
int p, v;

View File

@ -106,7 +106,7 @@ easy_expand_asm (str)
#if 0
/* This is the startup, and finish stuff per exception table. */
/* This is the startup, and finish stuff per exception table. */
/* XXX - Tad: exception handling section */
#ifndef EXCEPT_SECTION_ASM_OP
@ -320,7 +320,7 @@ struct ehQueue {
/* Holds the pc for doing "throw" */
static tree saved_pc;
/* Holds the type of the thing being thrown. */
/* Holds the type of the thing being thrown. */
static tree saved_throw_type;
/* Holds the value being thrown. */
static tree saved_throw_value;
@ -919,11 +919,11 @@ build_eh_type_type (type)
if (type == error_mark_node)
return error_mark_node;
/* peel back references, so they match. */
/* peel back references, so they match. */
if (TREE_CODE (type) == REFERENCE_TYPE)
type = TREE_TYPE (type);
/* Peel off cv qualifiers. */
/* Peel off cv qualifiers. */
type = TYPE_MAIN_VARIANT (type);
if (flag_rtti)
@ -1015,7 +1015,7 @@ expand_start_catch_block (declspecs, declarator)
a warning about an unused ((anonymous)). */
TREE_USED (decl) = 1;
/* Figure out the type that the initializer is. */
/* Figure out the type that the initializer is. */
init_type = TREE_TYPE (decl);
if (TREE_CODE (init_type) != REFERENCE_TYPE
&& TREE_CODE (init_type) != POINTER_TYPE)
@ -1054,7 +1054,7 @@ expand_start_catch_block (declspecs, declarator)
{
push_eh_cleanup ();
/* Fall into the catch all section. */
/* Fall into the catch all section. */
}
emit_move_insn (DECL_RTL (saved_in_catch), const1_rtx);
@ -1229,14 +1229,14 @@ do_unwind (inner_throw_label)
rtx return_val_rtx;
#if 0
/* I would like to do this here, but the move below doesn't seem to work. */
/* I would like to do this here, but the move below doesn't seem to work. */
/* call to __builtin_return_address () */
params = tree_cons (NULL_TREE, integer_zero_node, NULL_TREE);
fcall = build_function_call (BuiltinReturnAddress, params);
return_val_rtx = expand_expr (fcall, NULL_RTX, Pmode, 0);
emit_move_insn (return_val_rtx, inner_throw_label);
/* So, for now, just pass throw label to stack unwinder. */
/* So, for now, just pass throw label to stack unwinder. */
#endif
params = tree_cons (NULL_TREE, make_tree (ptr_type_node,
inner_throw_label), NULL_TREE);
@ -1341,7 +1341,7 @@ expand_builtin_throw ()
unwind_first = gen_label_rtx ();
/* These two can be frontend specific. If wanted, they can go in
expand_throw. */
expand_throw. */
/* Do we have a valid object we are throwing? */
emit_cmp_insn (DECL_RTL (saved_throw_type), const0_rtx, EQ, NULL_RTX,
GET_MODE (DECL_RTL (saved_throw_type)), 0, 0);
@ -1415,7 +1415,7 @@ expand_builtin_throw ()
emit_move_insn (ret_val, return_val_rtx);
#endif
/* Fall into epilogue to unwind prologue. */
/* Fall into epilogue to unwind prologue. */
}
expand_end_bindings (getdecls (), 1, 0);
@ -1614,6 +1614,7 @@ tree
start_anon_func ()
{
static int counter = 0;
int old_interface_unknown = interface_unknown;
char name[32];
tree params;
tree t;
@ -1624,6 +1625,8 @@ start_anon_func ()
/* No need to mangle this. */
push_lang_context (lang_name_c);
interface_unknown = 1;
params = void_list_node;
/* tcf stands for throw clean funciton. */
sprintf (name, "__tcf_%d", counter++);
@ -1638,6 +1641,8 @@ start_anon_func ()
expand_start_bindings (0);
emit_line_note (input_filename, lineno);
interface_unknown = old_interface_unknown;
pop_lang_context ();
return current_function_decl;
@ -1686,7 +1691,7 @@ expand_throw (exp)
tree cleanup = empty_fndecl, e;
/* throw expression */
/* First, decay it. */
/* First, decay it. */
exp = decay_conversion (exp);
if (TREE_CODE (TREE_TYPE (exp)) == POINTER_TYPE)

View File

@ -20,7 +20,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* High-level class interface. */
/* High-level class interface. */
#include "config.h"
#include "tree.h"
@ -116,6 +116,7 @@ void init_init_processing ()
Relies upon binfo being inside TYPE_BINFO (TREE_TYPE (TREE_TYPE
(addr))). */
void
expand_direct_vtbls_init (real_binfo, binfo, init_self, can_elide, addr)
tree real_binfo, binfo, addr;
@ -150,6 +151,7 @@ expand_direct_vtbls_init (real_binfo, binfo, init_self, can_elide, addr)
/* 348 - 351 */
/* Subroutine of emit_base_init. */
static void
perform_member_init (member, name, init, explicit, protect_list)
tree member, name, init;
@ -252,6 +254,7 @@ perform_member_init (member, name, init, explicit, protect_list)
extern int warn_reorder;
/* Subroutine of emit_member_init. */
static tree
sort_member_init (t)
tree t;
@ -482,6 +485,7 @@ sort_base_init (t, rbase_ptr, vbase_ptr)
}
/* Perform partial cleanups for a base for exception handling. */
static tree
build_partial_cleanup_for (binfo)
tree binfo;
@ -629,7 +633,7 @@ emit_base_init (t, immediately)
}
/* Initialize all the virtual function table fields that
do come from virtual base classes. */
do come from virtual base classes. */
if (TYPE_USES_VIRTUAL_BASECLASSES (t))
expand_indirect_vtbls_init (t_binfo, current_class_ref, current_class_ptr);
@ -735,6 +739,7 @@ emit_base_init (t, immediately)
/* Check that all fields are properly initialized after
an assignment to `this'. */
void
check_base_init (t)
tree t;
@ -751,6 +756,7 @@ check_base_init (t)
BINFO is the exact type that DECL is supposed to be. In
multiple inheritance, this might mean "C's A" if C : A, B. */
static void
expand_virtual_init (binfo, decl)
tree binfo, decl;
@ -781,6 +787,7 @@ expand_virtual_init (binfo, decl)
/* Subroutine of `expand_aggr_vbase_init'.
BINFO is the binfo of the type that is being initialized.
INIT_LIST is the list of initializers for the virtual baseclass. */
static void
expand_aggr_vbase_init_1 (binfo, exp, addr, init_list)
tree binfo, exp, addr, init_list;
@ -817,6 +824,7 @@ expand_aggr_vbase_init_1 (binfo, exp, addr, init_list)
done only at the top-level of the object being constructed.
INIT_LIST is list of initialization for constructor to perform. */
static void
expand_aggr_vbase_init (binfo, exp, addr, init_list)
tree binfo;
@ -849,6 +857,7 @@ expand_aggr_vbase_init (binfo, exp, addr, init_list)
S_ID is the scoped identifier.
NAME is the name of the member.
INIT is the initializer, or `void_type_node' if none. */
void
do_member_init (s_id, name, init)
tree s_id, name, init;
@ -873,6 +882,7 @@ do_member_init (s_id, name, init)
}
/* Find the context in which this FIELD can be initialized. */
static tree
initializing_context (field)
tree field;
@ -932,6 +942,7 @@ member_init_ok_or_else (field, type, member_name)
If INIT is non-NULL, then it the initialization should
be placed in `current_base_init_list', where it will be processed
by `emit_base_init'. */
void
expand_member_init (exp, name, init)
tree exp, name, init;
@ -986,7 +997,7 @@ expand_member_init (exp, name, init)
if (name == NULL_TREE)
{
/*
#if 0
if (basetype)
name = TYPE_IDENTIFIER (basetype);
else
@ -994,7 +1005,7 @@ expand_member_init (exp, name, init)
error ("no base class to initialize");
return;
}
*/
#endif
}
else
{
@ -1063,7 +1074,7 @@ expand_member_init (exp, name, init)
return;
/* now see if there is a constructor for this type
which will take these args. */
which will take these args. */
if (TYPE_HAS_CONSTRUCTOR (TREE_TYPE (field)))
{
@ -1166,7 +1177,7 @@ expand_member_init (exp, name, init)
initialization.
A constructor or a conversion operator may have to be used to
perform the initialization, but not both, as it would be ambiguous. */
perform the initialization, but not both, as it would be ambiguous. */
void
expand_aggr_init (exp, init, alias_this, flags)
@ -1518,6 +1529,8 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
return;
}
#ifndef NEW_OVER
/* See whether we can go through a type conversion operator.
This wins over going through a non-existent constructor. If
there is a constructor, it is ambiguous. */
@ -1533,7 +1546,7 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
if (rval)
{
/* See if there is a constructor for``type'' that takes a
``ttype''-typed object. */
``ttype''-typed object. */
tree parms = build_tree_list (NULL_TREE, init);
tree as_cons = NULL_TREE;
if (TYPE_HAS_CONSTRUCTOR (type))
@ -1550,6 +1563,7 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
}
}
}
#endif
}
/* We know that expand_default_init can handle everything we want
@ -1559,6 +1573,7 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags)
/* Report an error if NAME is not the name of a user-defined,
aggregate type. If OR_ELSE is nonzero, give an error message. */
int
is_aggr_typedef (name, or_else)
tree name;
@ -1590,6 +1605,7 @@ is_aggr_typedef (name, or_else)
/* Report an error if TYPE is not a user-defined, aggregate type. If
OR_ELSE is nonzero, give an error message. */
int
is_aggr_type (type, or_else)
tree type;
@ -1609,6 +1625,7 @@ is_aggr_type (type, or_else)
}
/* Like is_aggr_typedef, but returns typedef if successful. */
tree
get_aggr_from_typedef (name, or_else)
tree name;
@ -1657,6 +1674,7 @@ get_type_value (name)
/* For an expression of the form TYPE :: NAME (PARMLIST), build
the appropriate function call. */
tree
build_member_call (type, name, parmlist)
tree type, name, parmlist;
@ -1779,6 +1797,7 @@ build_member_call (type, name, parmlist)
@@ fields.
@@ This function should be rewritten and placed in search.c. */
tree
build_offset_ref (type, name)
tree type, name;
@ -1873,7 +1892,7 @@ build_offset_ref (type, name)
return error_mark_node;
/* A lot of this logic is now handled in lookup_field and
lookup_fnfield. */
lookup_fnfield. */
if (fnfields)
{
extern int flag_save_memoized_contexts;
@ -2198,7 +2217,7 @@ is_friend (type, supplicant)
}
}
else
/* It's a type. */
/* It's a type. */
{
if (type == supplicant)
return 1;
@ -2235,6 +2254,7 @@ is_friend (type, supplicant)
/* Add a new friend to the friends of the aggregate type TYPE.
DECL is the FUNCTION_DECL of the friend being added. */
static void
add_friend (type, decl)
tree type, decl;
@ -2284,6 +2304,7 @@ add_friend (type, decl)
/* Declare that every member function NAME in FRIEND_TYPE
(which may be NULL_TREE) is a friend of type TYPE. */
static void
add_friends (type, name, friend_type)
tree type, name, friend_type;
@ -2336,6 +2357,7 @@ add_friends (type, name, friend_type)
then the DECL_WAITING_FRIENDS contains a list of types
waiting to make it their friend. Note that these two can both
be in use at the same time! */
void
make_friend_class (type, friend_type)
tree type, friend_type;
@ -2395,6 +2417,7 @@ make_friend_class (type, friend_type)
QUALS say what special qualifies should apply to the object
pointed to by `this'. */
tree
do_friend (ctype, declarator, decl, parmdecls, flags, quals, funcdef_flag)
tree ctype, declarator, decl, parmdecls;
@ -2781,7 +2804,7 @@ build_new (placement, decl, init, use_global_new)
}
/* Get a little extra space to store a couple of things before the new'ed
array. */
array. */
if (has_array && TYPE_VEC_NEW_USES_COOKIE (true_type))
{
tree extra = BI_header_size;
@ -2797,7 +2820,7 @@ build_new (placement, decl, init, use_global_new)
cp_pedwarn ("initialization in array new");
}
/* Allocate the object. */
/* Allocate the object. */
if (! use_global_new && TYPE_LANG_SPECIFIC (true_type)
&& (TYPE_GETS_NEW (true_type) & (1 << has_array)))
rval = build_opfncall (code, LOOKUP_NORMAL,
@ -3045,7 +3068,7 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
int use_global_delete;
{
tree virtual_size;
tree ptype = build_pointer_type (type);
tree ptype = build_pointer_type (type = complete_type (type));
tree size_exp = size_in_bytes (type);
/* Temporary variables used by the loop. */
@ -3155,7 +3178,7 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
convert (string_type_node, base),
BI_header_size,
1));
/* True size with header. */
/* True size with header. */
virtual_size = size_binop (PLUS_EXPR, virtual_size, BI_header_size);
}
deallocate_expr = build_x_delete (ptype, base_tbd,
@ -3196,6 +3219,7 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete,
BASE is that starting address of the array.
COUNT is the count of objects that have been built, that need destroying.
TYPE is the type of elements in the array. */
static tree
build_array_eh_cleanup (base, count, type)
tree base, count, type;
@ -3261,7 +3285,7 @@ expand_vec_init (decl, base, maxindex, init, from_array)
if (init != NULL_TREE
&& TREE_CODE (init) == CONSTRUCTOR
&& TREE_TYPE (init) == TREE_TYPE (decl))
&& (! decl || TREE_TYPE (init) == TREE_TYPE (decl)))
{
/* Initialization of array from {...}. */
tree elts = CONSTRUCTOR_ELTS (init);
@ -3453,6 +3477,7 @@ expand_vec_init (decl, base, maxindex, init, from_array)
static object, see Free Store 12.5 ANSI C++ WP.
This does not call any destructors. */
tree
build_x_delete (type, addr, which_delete, virtual_size)
tree type, addr;
@ -3484,6 +3509,7 @@ build_x_delete (type, addr, which_delete, virtual_size)
flags. See cp-tree.h for more info.
This function does not delete an object's virtual base classes. */
tree
build_delete (type, addr, auto_delete, flags, use_global_delete)
tree type, addr;
@ -3491,7 +3517,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
int flags;
int use_global_delete;
{
tree function, parms;
tree function;
tree member;
tree expr;
tree ref;
@ -3587,15 +3613,14 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
return build_builtin_call (void_type_node, BID,
build_tree_list (NULL_TREE, addr));
}
parms = build_tree_list (NULL_TREE, addr);
/* Below, we will reverse the order in which these calls are made.
If we have a destructor, then that destructor will take care
of the base classes; otherwise, we must do that here. */
if (TYPE_HAS_DESTRUCTOR (type))
{
tree parms = build_tree_list (NULL_TREE, addr);
tree dtor = DECL_MAIN_VARIANT (TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), 1));
tree basetypes = TYPE_BINFO (type);
tree passed_auto_delete;
tree do_delete = NULL_TREE;
@ -3619,7 +3644,13 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
if (flags & LOOKUP_PROTECT)
{
tree access = compute_access (basetypes, dtor);
tree access;
tree basetypes = NULL_TREE;
if (current_class_type != NULL_TREE)
basetypes = get_binfo (type, current_class_type, 0);
if (basetypes == NULL_TREE)
basetypes = TYPE_BINFO (type);
access = compute_access (basetypes, dtor);
if (access == access_private_node)
{
@ -3863,6 +3894,7 @@ build_vbase_delete (type, decl)
values we'd have to extract. (We could use MAXINDEX with pointers to
confirm the size, and trap if the numbers differ; not clear that it'd
be worth bothering.) */
tree
build_vec_delete (base, maxindex, auto_delete_vec, auto_delete,
use_global_delete)
@ -3879,7 +3911,7 @@ build_vec_delete (base, maxindex, auto_delete_vec, auto_delete,
base = stabilize_reference (base);
/* Since we can use base many times, save_expr it. */
/* Since we can use base many times, save_expr it. */
if (TREE_SIDE_EFFECTS (base))
base = save_expr (base);

View File

@ -156,7 +156,7 @@ sub_getch ()
input = inp->next;
input_filename = inp->filename;
lineno = inp->lineno;
/* Get interface/implementation back in sync. */
/* Get interface/implementation back in sync. */
extract_interface_info ();
putback_char = inp->putback_char;
free_input (inp);

View File

@ -301,13 +301,13 @@ my_get_run_time ()
/* Table indexed by tree code giving a string containing a character
classifying the tree code. Possibilities are
t, d, s, c, r, <, 1 and 2. See cp/tree.def for details. */
t, d, s, c, r, <, 1 and 2. See cp/cp-tree.def for details. */
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
char *cplus_tree_code_type[] = {
"x",
#include "tree.def"
#include "cp-tree.def"
};
#undef DEFTREECODE
@ -319,7 +319,7 @@ char *cplus_tree_code_type[] = {
int cplus_tree_code_length[] = {
0,
#include "tree.def"
#include "cp-tree.def"
};
#undef DEFTREECODE
@ -329,7 +329,7 @@ int cplus_tree_code_length[] = {
char *cplus_tree_code_name[] = {
"@@dummy",
#include "tree.def"
#include "cp-tree.def"
};
#undef DEFTREECODE
@ -374,6 +374,7 @@ init_filename_times ()
/* Change by Bryan Boreham, Kewill, Thu Jul 27 09:46:05 1989.
Stuck this hack in to get the files open correctly; this is called
in place of init_lex if we are an unexec'd binary. */
void
reinit_lang_specific ()
{
@ -620,7 +621,7 @@ init_lex ()
SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_REGISTER],
build_tree_list (NULL_TREE, ridpointers[(int) RID_REGISTER]));
/* C++ extensions. These are probably not correctly named. */
/* C++ extensions. These are probably not correctly named. */
ridpointers[(int) RID_WCHAR] = get_identifier ("__wchar_t");
SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_WCHAR],
build_tree_list (NULL_TREE, ridpointers[(int) RID_WCHAR]));
@ -662,7 +663,7 @@ init_lex ()
ridpointers[(int) RID_TEMPLATE] = get_identifier ("template");
SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_TEMPLATE],
build_tree_list (NULL_TREE, ridpointers[(int) RID_TEMPLATE]));
/* This is for ANSI C++. */
/* This is for ANSI C++. */
ridpointers[(int) RID_MUTABLE] = get_identifier ("mutable");
SET_IDENTIFIER_AS_LIST (ridpointers[(int) RID_MUTABLE],
build_tree_list (NULL_TREE, ridpointers[(int) RID_MUTABLE]));
@ -937,13 +938,13 @@ print_parse_statistics ()
qsort (sorted, TOKEN_LENGTH, sizeof (int), token_cmp);
for (i = 0; i < TOKEN_LENGTH; i++)
{
int index = sorted[i];
if (token_count[index] == 0)
int idx = sorted[i];
if (token_count[idx] == 0)
break;
if (token_count[index] < token_count[-1])
if (token_count[idx] < token_count[-1])
break;
fprintf (stderr, "token %d, `%s', count = %d\n",
index, yytname[YYTRANSLATE (index)], token_count[index]);
idx, yytname[YYTRANSLATE (idx)], token_count[idx]);
}
fprintf (stderr, "\n");
for (i = 0; i < REDUCE_LENGTH; i++)
@ -951,13 +952,13 @@ print_parse_statistics ()
qsort (sorted, REDUCE_LENGTH, sizeof (int), reduce_cmp);
for (i = 0; i < REDUCE_LENGTH; i++)
{
int index = sorted[i];
if (reduce_count[index] == 0)
int idx = sorted[i];
if (reduce_count[idx] == 0)
break;
if (reduce_count[index] < reduce_count[-1])
if (reduce_count[idx] < reduce_count[-1])
break;
fprintf (stderr, "rule %d, line %d, count = %d\n",
index, yyrline[index], reduce_count[index]);
idx, yyrline[idx], reduce_count[idx]);
}
fprintf (stderr, "\n");
#endif
@ -968,6 +969,7 @@ print_parse_statistics ()
/* Sets the value of the 'yydebug' variable to VALUE.
This is a function so we don't have to have YYDEBUG defined
in order to build the compiler. */
void
set_yydebug (value)
int value;
@ -1010,6 +1012,7 @@ static struct impl_files *impl_file_chain;
/* Helper function to load global variables with interface
information. */
void
extract_interface_info ()
{
@ -1031,6 +1034,7 @@ extract_interface_info ()
/* Return nonzero if S is not considered part of an
INTERFACE/IMPLEMENTATION pair. Otherwise, return 0. */
static int
interface_strcmp (s)
char *s;
@ -1104,6 +1108,7 @@ set_vardecl_interface_info (prev, vars)
do, set up to process them now. This function sets up the first function
to be parsed; after it has been, the rule for fndef in parse.y will
call process_next_inline to start working on the next one. */
void
do_pending_inlines ()
{
@ -1168,6 +1173,7 @@ static int nextchar = -1;
/* Called from the fndecl rule in the parser when the function just parsed
was declared using a PRE_PARSED_FUNCTION_DECL (i.e. came from
do_pending_inlines). */
void
process_next_inline (t)
tree t;
@ -1183,12 +1189,11 @@ process_next_inline (t)
if (yychar != END_OF_SAVED_INPUT)
{
error ("parse error at end of saved function text");
/* restore_pending_input will abort unless yychar is either
* END_OF_SAVED_INPUT or YYEMPTY; since we already know we're
* hosed, feed back YYEMPTY.
* We also need to discard nextchar, since that may have gotten
* set as well.
*/
END_OF_SAVED_INPUT or YYEMPTY; since we already know we're
hosed, feed back YYEMPTY. We also need to discard nextchar,
since that may have gotten set as well. */
nextchar = -1;
}
yychar = YYEMPTY;
@ -1322,6 +1327,7 @@ restore_pending_input (p)
/* Return next non-whitespace input character, which may come
from `finput', or from `nextchar'. */
static int
yynextch ()
{
@ -1339,6 +1345,7 @@ yynextch ()
/* Unget character CH from the input stream.
If RESCAN is non-zero, then we want to `see' this
character as the next input token. */
void
yyungetc (ch, rescan)
int ch;
@ -1733,6 +1740,7 @@ cons_up_default_function (type, full_name, kind)
/* Heuristic to tell whether the user is missing a semicolon
after a struct or enum declaration. Emit an error message
if we know the user has blown it. */
void
check_for_missing_semicolon (type)
tree type;
@ -3147,7 +3155,7 @@ real_yylex ()
}
put_back (c1);
}
/* fall through... */
/* fall through... */
case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
resume_numerical_scan:
@ -3352,7 +3360,7 @@ real_yylex ()
set_float_handler (handler);
/* The second argument, machine_mode, of REAL_VALUE_ATOF
tells the desired precision of the binary result of
decimal-to-binary conversion. */
decimal-to-binary conversion. */
/* Read the suffixes to choose a data type. */
switch (c)
@ -4466,7 +4474,7 @@ handle_cp_pragma (pname)
interface_unknown = 1;
#else
/* We make this zero so that templates in the impl
file will be emitted properly. */
file will be emitted properly. */
interface_unknown = 0;
#endif
TREE_INT_CST_LOW (fileinfo) = interface_only;
@ -4485,6 +4493,7 @@ handle_cp_pragma (pname)
/* This function has to be in this file, in order to get at
the token types. */
int
handle_sysv_pragma (finput, token)
FILE *finput;

View File

@ -63,7 +63,8 @@ enum rid
RID_AUTO,
RID_MUTABLE,
/* This is where grokdeclarator ends its search when setting the specbits. */
/* This is where grokdeclarator ends its search when setting the
specbits. */
RID_PUBLIC,
RID_PRIVATE,
@ -72,7 +73,7 @@ enum rid
RID_TEMPLATE,
RID_SIGNATURE,
/* Before adding enough to get up to 64, the RIDBIT_* macros
will have to be changed a little. */
will have to be changed a little. */
RID_MAX
};
@ -82,11 +83,11 @@ enum rid
#define RID_LAST_MODIFIER RID_MUTABLE
/* The type that can represent all values of RIDBIT. */
/* We assume that we can stick in at least 32 bits into this. */
/* We assume that we can stick in at least 32 bits into this. */
typedef struct { unsigned long idata[2]; }
RID_BIT_TYPE;
/* Be careful, all these modify N twice. */
/* Be careful, all these modify N twice. */
#define RIDBIT_SETP(N, V) (((unsigned long)1 << (int) ((N)%32)) \
& (V).idata[(N)/32])
#define RIDBIT_NOTSETP(NN, VV) (! RIDBIT_SETP (NN, VV))

View File

@ -153,6 +153,7 @@ do_inline_function_hair (type, friend_list)
/* Report an argument type mismatch between the best declared function
we could find and the current argument list that we have. */
void
report_type_mismatch (cp, parmtypes, name_kind)
struct candidate *cp;
@ -261,6 +262,7 @@ static int nofold;
} while (0)
/* Code to concatenate an asciified integer to a string. */
static
#ifdef __GNUC__
__inline
@ -355,7 +357,8 @@ build_overload_nested_name (decl)
build_overload_identifier (decl);
}
/* Encoding for an INTEGER_CST value. */
/* Encoding for an INTEGER_CST value. */
static void
build_overload_int (value)
tree value;
@ -499,7 +502,7 @@ build_overload_value (type, value)
{
if (TREE_CODE (value) == CONSTRUCTOR)
{
/* This is dangerous code, crack built up pointer to members. */
/* This is dangerous code, crack built up pointer to members. */
tree args = CONSTRUCTOR_ELTS (value);
tree a1 = TREE_VALUE (args);
tree a2 = TREE_VALUE (TREE_CHAIN (args));
@ -876,7 +879,7 @@ build_overload_name (parmtypes, begin, end)
{
tree context = name;
/* If DECL_ASSEMBLER_NAME has been set properly, use it. */
/* If DECL_ASSEMBLER_NAME has been set properly, use it. */
if (DECL_ASSEMBLER_NAME (context) != DECL_NAME (context))
{
OB_PUTID (DECL_ASSEMBLER_NAME (context));
@ -946,7 +949,7 @@ build_overload_name (parmtypes, begin, end)
if (nrepeats)
flush_repeats (typevec[maxtype-1]);
/* To get here, parms must end with `...'. */
/* To get here, parms must end with `...'. */
OB_PUTC ('e');
}
@ -974,6 +977,7 @@ build_static_name (basetype, name)
FOR_METHOD is 1 if this overload is being performed
for a method, rather than a function type. It is 2 if
this overload is being performed for a constructor. */
tree
build_decl_overload (dname, parms, for_method)
tree dname;
@ -1058,6 +1062,7 @@ build_decl_overload (dname, parms, for_method)
}
/* Build an overload name for the type expression TYPE. */
tree
build_typename_overload (type)
tree type;
@ -1103,7 +1108,7 @@ get_id_2 (name, name2)
/* Top-level interface to explicit overload requests. Allow NAME
to be overloaded. Error if NAME is already declared for the current
scope. Warning if function is redundantly overloaded. */
scope. Warning if function is redundantly overloaded. */
void
declare_overloaded (name)
@ -1139,6 +1144,7 @@ declare_overloaded (name)
/* Check to see if NAME is overloaded. For first approximation,
check to see if its TREE_OVERLOADED is set. This is used on
IDENTIFIER nodes. */
int
is_overloaded (name)
tree name;
@ -1267,7 +1273,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
if (TREE_CODE (TREE_TYPE (arg1)) == ARRAY_TYPE)
{
/* Strip off the pointer and the array. */
/* Strip off the pointer and the array. */
arg1 = TREE_TYPE (TREE_TYPE (arg1));
while (TREE_CODE (arg1) == ARRAY_TYPE)
@ -1325,7 +1331,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3)
/* Try to fail. First, fail if unary */
if (! try_second)
return rval;
/* Second, see if second argument is non-aggregate. */
/* Second, see if second argument is non-aggregate. */
type2 = TREE_TYPE (xarg2);
if (TREE_CODE (type2) == OFFSET_TYPE)
type2 = TREE_TYPE (type2);
@ -1727,11 +1733,11 @@ emit_thunk (thunk_fndecl)
int failure = 0;
int save_ofp;
/* Used to remember which regs we need to emit a USE rtx for. */
/* Used to remember which regs we need to emit a USE rtx for. */
rtx need_use[FIRST_PSEUDO_REGISTER];
int need_use_count = 0;
/* rtx for the 'this' parameter. */
/* rtx for the 'this' parameter. */
rtx this_rtx = 0, this_reg_rtx = 0, fixed_this_rtx;
char *(*save_decl_printable_name) () = decl_printable_name;
@ -1775,7 +1781,7 @@ emit_thunk (thunk_fndecl)
/* Now look through all the parameters, make sure that we
don't clobber any registers used for parameters.
Also, pick up an rtx for the first "this" parameter. */
Also, pick up an rtx for the first "this" parameter. */
for (argp = TYPE_ARG_TYPES (TREE_TYPE (function));
argp != NULL_TREE;
argp = TREE_CHAIN (argp))
@ -1949,6 +1955,7 @@ emit_thunk (thunk_fndecl)
/* For the anonymous union in TYPE, return the member that is at least as
large as the rest of the members, so we can copy it. */
static tree
largest_union_member (type)
tree type;
@ -1965,6 +1972,7 @@ largest_union_member (type)
}
/* Generate code for default X(X&) constructor. */
void
do_build_copy_constructor (fndecl)
tree fndecl;

View File

@ -135,7 +135,7 @@ empty_parms ()
%token ELLIPSIS
/* the reserved words */
/* SCO include files test "ASM", so use something else. */
/* SCO include files test "ASM", so use something else. */
%token SIZEOF ENUM /* STRUCT UNION */ IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
%token BREAK CONTINUE RETURN GOTO ASM_KEYWORD GCC_ASM_KEYWORD TYPEOF ALIGNOF
%token SIGOF
@ -265,7 +265,7 @@ empty_parms ()
%type <ttype> new_initializer new_placement
%type <ttype> using_decl .poplevel
/* in order to recognize aggr tags as defining and thus shadowing. */
/* in order to recognize aggr tags as defining and thus shadowing. */
%token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
%type <ttype> named_class_head_sans_basetype_defn
%type <ttype> identifier_defn IDENTIFIER_DEFN TYPENAME_DEFN PTYPENAME_DEFN
@ -316,7 +316,7 @@ program: /* empty */
/* the reason for the strange actions in this rule
is so that notype_initdecls when reached via datadef
can find a valid list of type and sc specs in $0. */
can find a valid list of type and sc specs in $0. */
extdefs:
{ $<ttype>$ = NULL_TREE; } lang_extdef
@ -1314,7 +1314,7 @@ primary:
class = TREE_CODE_CLASS (TREE_CODE ($$));
if (class == 'e' || class == '1'
|| class == '2' || class == '<')
/* This inhibits warnings in truthvalue_conversion. */
/* This inhibits warnings in truthvalue_conversion. */
C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
| '(' expr_or_declarator ')'
{ char class;
@ -1322,7 +1322,7 @@ primary:
class = TREE_CODE_CLASS (TREE_CODE ($$));
if (class == 'e' || class == '1'
|| class == '2' || class == '<')
/* This inhibits warnings in truthvalue_conversion. */
/* This inhibits warnings in truthvalue_conversion. */
C_SET_EXP_ORIGINAL_CODE ($$, ERROR_MARK); }
| '(' error ')'
{ $$ = error_mark_node; }
@ -1510,7 +1510,7 @@ primary:
#if 0
/* This is a future direction of this code, but because
build_x_function_call cannot always undo what is done
in build_component_ref entirely yet, we cannot do this. */
in build_component_ref entirely yet, we cannot do this. */
$$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), $4, current_class_ref);
if (TREE_CODE ($$) == CALL_EXPR
&& TREE_TYPE ($$) != void_type_node)
@ -1525,7 +1525,7 @@ primary:
#if 0
/* This is a future direction of this code, but because
build_x_function_call cannot always undo what is done
in build_component_ref entirely yet, we cannot do this. */
in build_component_ref entirely yet, we cannot do this. */
$$ = build_x_function_call (build_component_ref ($$, $2, NULL_TREE, 1), NULL_TREE, current_class_ref);
if (TREE_CODE ($$) == CALL_EXPR
&& TREE_TYPE ($$) != void_type_node)
@ -2029,7 +2029,7 @@ nomods_initdcl0:
;
/* the * rules are dummies to accept the Apollo extended syntax
so that the header files compile. */
so that the header files compile. */
maybe_attribute:
/* empty */
{ $$ = NULL_TREE; }
@ -2203,7 +2203,7 @@ structsp:
yychar = YYLEX;
semi = yychar == ';';
/* finish_struct nukes this anyway; if
finish_exception does too, then it can go. */
finish_exception does too, then it can go. */
if (semi)
note_got_semicolon ($1);
@ -2692,7 +2692,7 @@ component_decl_1:
{ $$ = do_class_using_decl ($1); }
;
/* The case of exactly one component is handled directly by component_decl. */
/* The case of exactly one component is handled directly by component_decl. */
/* ??? Huh? ^^^ */
components:
/* empty: possibly anonymous */
@ -3100,7 +3100,7 @@ ptr_to_mem:
;
/* All uses of explicit global scope must go through this nonterminal so
that got_scope will be set before yylex is called to get the next token. */
that got_scope will be set before yylex is called to get the next token. */
global_scope:
SCOPE
{ got_scope = void_type_node; }
@ -3738,7 +3738,7 @@ handler_args:
| '(' typed_typespecs after_type_declarator ')'
{ check_for_new_type ("inside exception declarations", $2);
expand_start_catch_block ($2.t, $3); }
This allows reference parameters... */
This allows reference parameters... */
| '(' parm ')'
{ check_for_new_type ("inside exception declarations", $2);
expand_start_catch_block (TREE_PURPOSE ($2.t),

View File

@ -21,12 +21,12 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Known bugs or deficiencies include:
* templates for class static data don't work (methods only)
* duplicated method templates can crash the compiler
* interface/impl data is taken from file defining the template
* all methods must be provided in header files; can't use a source
file that contains only the method templates and "just win"
*/
templates for class static data don't work (methods only),
duplicated method templates can crash the compiler,
interface/impl data is taken from file defining the template,
all methods must be provided in header files; can't use a source
file that contains only the method templates and "just win". */
#include "config.h"
#include <stdio.h>
@ -78,6 +78,7 @@ begin_template_parm_list ()
/* Process information from new template parameter NEXT and append it to the
LIST being built. */
tree
process_template_parm (list, next)
tree list, next;
@ -274,6 +275,7 @@ tree tsubst PROTO ((tree, tree*, int, tree));
/* Convert all template arguments to their appropriate types, and return
a vector containing the resulting values. If any error occurs, return
error_mark_node. */
static tree
coerce_template_parms (parms, arglist, in_decl)
tree parms, arglist;
@ -477,6 +479,7 @@ comp_template_args (oldargs, newargs)
/* Given class template name and parameter list, produce a user-friendly name
for the instantiation. */
static char *
mangle_class_name_for_template (name, parms, arglist)
char *name;
@ -583,13 +586,20 @@ static void
add_pending_template (d)
tree d;
{
if (TREE_LANG_FLAG_0 (DECL_TEMPLATE_INFO (d)))
tree ti;
if (TREE_CODE_CLASS (TREE_CODE (d)) == 't')
ti = CLASSTYPE_TEMPLATE_INFO (d);
else
ti = DECL_TEMPLATE_INFO (d);
if (TREE_LANG_FLAG_0 (ti))
return;
*template_tail = perm_tree_cons
(current_function_decl, d, NULL_TREE);
template_tail = &TREE_CHAIN (*template_tail);
TREE_LANG_FLAG_0 (DECL_TEMPLATE_INFO (d)) = 1;
TREE_LANG_FLAG_0 (ti) = 1;
}
/* Given an IDENTIFIER_NODE (type TEMPLATE_DECL) and a chain of
@ -601,6 +611,7 @@ add_pending_template (d)
IN_DECL, if non-NULL, is the template declaration we are trying to
instantiate. */
tree
lookup_template_class (d1, arglist, in_decl)
tree d1, arglist;
@ -708,7 +719,7 @@ lookup_template_class (d1, arglist, in_decl)
}
}
/* Seems to be wanted. */
/* Seems to be wanted. */
CLASSTYPE_GOT_SEMICOLON (t) = 1;
if (! CLASSTYPE_TEMPLATE_INFO (t))
@ -723,7 +734,7 @@ lookup_template_class (d1, arglist, in_decl)
SET_CLASSTYPE_IMPLICIT_INSTANTIATION (t);
/* We need to set this again after CLASSTYPE_TEMPLATE_INFO is set up. */
/* We need to set this again after CLASSTYPE_TEMPLATE_INFO is set up. */
DECL_ASSEMBLER_NAME (TYPE_MAIN_DECL (t)) = id;
if (! uses_template_parms (arglist))
DECL_ASSEMBLER_NAME (TYPE_MAIN_DECL (t))
@ -732,14 +743,7 @@ lookup_template_class (d1, arglist, in_decl)
if (flag_external_templates && ! uses_template_parms (arglist)
&& CLASSTYPE_INTERFACE_KNOWN (TREE_TYPE (template))
&& ! CLASSTYPE_INTERFACE_ONLY (TREE_TYPE (template)))
{
tree d;
instantiate_class_template (t);
for (d = TYPE_METHODS (t); d; d = TREE_CHAIN (d))
add_pending_template (d);
}
add_pending_template (t);
}
return t;
@ -1116,7 +1120,7 @@ instantiate_class_template (type)
{
if (! uses_template_parms (r))
pending_statics = perm_tree_cons (NULL_TREE, r, pending_statics);
/* Perhaps I should do more of grokfield here. */
/* Perhaps I should do more of grokfield here. */
start_decl_1 (r);
DECL_IN_AGGR_P (r) = 1;
DECL_EXTERNAL (r) = 1;
@ -1188,6 +1192,8 @@ instantiate_class_template (type)
/* XXX handle attributes */
type = finish_struct_1 (type, NULL_TREE, 0);
CLASSTYPE_GOT_SEMICOLON (type) = 1;
repo_template_used (type);
}
else
{
@ -1484,6 +1490,12 @@ tsubst (t, args, nargs, in_decl)
tree_cons (argvec, r, DECL_TEMPLATE_INSTANTIATIONS (tmpl));
}
/* Like grokfndecl. If we don't do this, pushdecl will mess up our
TREE_CHAIN because it doesn't find a previous decl. Sigh. */
if (member
&& IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (r)) == NULL_TREE)
IDENTIFIER_GLOBAL_VALUE (DECL_ASSEMBLER_NAME (r)) = r;
return r;
}
@ -1876,6 +1888,9 @@ tsubst_copy (t, args, nargs, in_decl)
case CAST_EXPR:
case REINTERPRET_CAST_EXPR:
case CONST_CAST_EXPR:
case STATIC_CAST_EXPR:
case DYNAMIC_CAST_EXPR:
return build1
(code, tsubst (TREE_TYPE (t), args, nargs, in_decl),
tsubst_copy (TREE_OPERAND (t, 0), args, nargs, in_decl));
@ -2038,6 +2053,13 @@ tsubst_copy (t, args, nargs, in_decl)
case TYPENAME_TYPE:
return tsubst (t, args, nargs, in_decl);
case IDENTIFIER_NODE:
if (IDENTIFIER_TYPENAME_P (t))
return build_typename_overload
(tsubst (TREE_TYPE (t), args, nargs, in_decl));
else
return t;
default:
return t;
}
@ -2381,7 +2403,7 @@ overload_template_name (type)
If SUBR is 1, we're being called recursively (to unify the arguments of
a function or method parameter of a function template), so don't zero
out targs and don't fail on an incomplete match. */
out targs and don't fail on an incomplete match. */
int
type_unification (tparms, targs, parms, args, nsubsts, subr)
@ -2497,6 +2519,7 @@ type_unification (tparms, targs, parms, args, nsubsts, subr)
}
/* Tail recursion is your friend. */
static int
unify (tparms, targs, ntparms, parm, arg, nsubsts)
tree tparms, *targs, parm, arg;
@ -2726,6 +2749,7 @@ mark_decl_instantiated (result, extern_p)
}
/* called from the parser. */
void
do_function_instantiation (declspecs, declarator, storage)
tree declspecs, declarator, storage;
@ -2948,7 +2972,7 @@ instantiate_decl (d)
warn_if_unknown_interface (pattern);
}
if (at_eof && ! DECL_INLINE (d))
if (at_eof)
import_export_decl (d);
}

View File

@ -99,7 +99,7 @@ repo_get_id (t)
}
/* Note that a template has been used. If we can see the definition, offer
to emit it. */
to emit it. */
void
repo_template_used (t)

View File

@ -55,6 +55,7 @@ init_rtti_processing ()
pointer somewhere, return a pointer to a possible sub-object that
has a virtual table pointer in it that is the vtable parent for
that sub-object. */
static tree
build_headof_sub (exp)
tree exp;
@ -71,6 +72,7 @@ build_headof_sub (exp)
object pointed to by EXP with type cv void*, if the class has any
virtual functions (TYPE_VIRTUAL_P), else just return the
expression. */
static tree
build_headof (exp)
tree exp;
@ -112,6 +114,7 @@ build_headof (exp)
/* Return the type_info node associated with the expression EXP. If EXP is
a reference to a polymorphic class, return the dynamic type; otherwise
return the static type of the expression. */
tree
build_typeid (exp)
tree exp;
@ -131,11 +134,11 @@ build_typeid (exp)
if (TREE_CODE (exp) == VAR_DECL && TREE_CODE (type) == RECORD_TYPE)
return get_typeid (type);
/* peel back references, so they match. */
/* peel back references, so they match. */
if (TREE_CODE (type) == REFERENCE_TYPE)
type = TREE_TYPE (type);
/* Peel off cv qualifiers. */
/* Peel off cv qualifiers. */
type = TYPE_MAIN_VARIANT (type);
/* Apply trivial conversion T -> T& for dereferenced ptrs. */
@ -269,6 +272,7 @@ get_typeid_1 (type)
}
/* Return the type_info object for TYPE, creating it if necessary. */
tree
get_typeid (type)
tree type;
@ -285,7 +289,7 @@ get_typeid (type)
type = TREE_TYPE (type);
/* The top-level cv-qualifiers of the lvalue expression or the type-id
that is the operand of typeid are always ignored. */
that is the operand of typeid are always ignored. */
type = TYPE_MAIN_VARIANT (type);
return get_typeid_1 (type);
@ -325,7 +329,8 @@ throw_bad_cast ()
/* Check whether TEST is null before returning RESULT. If TEST is used in
RESULT, it must have previously had a save_expr applied to it. */
tree ifnonnull (test, result)
tree
ifnonnull (test, result)
tree test, result;
{
return build (COND_EXPR, TREE_TYPE (result),
@ -349,6 +354,12 @@ build_dynamic_cast (type, expr)
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
if (current_template_parms)
{
tree t = build_min (DYNAMIC_CAST_EXPR, type, expr);
return t;
}
switch (tc)
{
case POINTER_TYPE:
@ -539,7 +550,7 @@ build_dynamic_cast (type, expr)
return build (COND_EXPR, type, result, result, expr1);
}
/* Now back to the type we want from a void*. */
/* Now back to the type we want from a void*. */
result = convert (type, result);
return ifnonnull (expr, result);
}
@ -616,7 +627,7 @@ expand_si_desc (tdecl, type)
expand_expr_stmt (fn);
}
/* Build an initializer for a __class_type_info node. */
/* Build an initializer for a __class_type_info node. */
static void
expand_class_desc (tdecl, type)
@ -797,6 +808,7 @@ expand_class_desc (tdecl, type)
}
/* Build an initializer for a __pointer_type_info node. */
static void
expand_ptr_desc (tdecl, type)
tree tdecl;
@ -1022,13 +1034,14 @@ synthesize_tinfo_fn (fndecl)
#if 0
/* This is the old dossier type descriptor generation code, it's much
more extended than rtti. It's reserved for later use. */
more extended than rtti. It's reserved for later use. */
/* Build an initializer for a __t_desc node. So that we can take advantage
of recursion, we accept NULL for TYPE.
DEFINITION is greater than zero iff we must define the type descriptor
(as opposed to merely referencing it). 1 means treat according to
#pragma interface/#pragma implementation rules. 2 means define as
global and public, no matter what. */
tree
build_t_desc (type, definition)
tree type;
@ -1192,6 +1205,7 @@ build_t_desc (type, definition)
}
/* Build an initializer for a __i_desc node. */
tree
build_i_desc (decl)
tree decl;
@ -1225,6 +1239,7 @@ build_i_desc (decl)
}
/* Build an initializer for a __m_desc node. */
tree
build_m_desc (decl)
tree decl;

View File

@ -20,7 +20,7 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* High-level class interface. */
/* High-level class interface. */
#include "config.h"
#include "tree.h"
@ -40,9 +40,11 @@ extern tree abort_fndecl;
#include "stack.h"
/* Obstack used for remembering decision points of breadth-first. */
static struct obstack search_obstack;
/* Methods for pushing and popping objects to and from obstacks. */
struct stack_level *
push_stack_level (obstack, tp, size)
struct obstack *obstack;
@ -85,6 +87,7 @@ static tree vbase_decl_ptr_intermediate, vbase_decl_ptr;
static tree vbase_init_result;
/* Allocate a level of searching. */
static struct search_level *
push_search_level (stack, obstack)
struct stack_level *stack;
@ -97,6 +100,7 @@ push_search_level (stack, obstack)
}
/* Discard a level of search allocation. */
static struct search_level *
pop_search_level (obstack)
struct stack_level *obstack;
@ -107,6 +111,7 @@ pop_search_level (obstack)
}
/* Search memoization. */
struct type_level
{
struct stack_level base;
@ -157,6 +162,7 @@ static struct type_level *prev_type_stack;
static tree closed_envelopes = NULL_TREE;
/* Allocate a level of type memoization context. */
static struct type_level *
push_type_level (stack, obstack)
struct stack_level *stack;
@ -186,6 +192,7 @@ pop_type_level (stack)
/* Make something that looks like a TREE_LIST, but
do it on the type_obstack_entries obstack. */
static tree
my_tree_cons (purpose, value, chain)
tree purpose, value, chain;
@ -217,6 +224,7 @@ my_build_string (str)
/* Memoizing machinery to make searches for multiple inheritance
reasonably efficient. */
#define MEMOIZE_HASHSIZE 8
typedef struct memoized_entry
{
@ -247,6 +255,7 @@ my_new_memoized_entry (chain)
}
/* Clears the deferred pop from pop_memoized_context, if any. */
static void
clear_memoized_cache ()
{
@ -266,7 +275,7 @@ make_memoized_table_entry (type, name, function_p)
tree type, name;
int function_p;
{
int index = MEMOIZED_HASH_FN (name);
int idx = MEMOIZED_HASH_FN (name);
tree entry, *prev_entry;
/* Since we allocate from the type_obstack, we must pop any deferred
@ -284,9 +293,9 @@ make_memoized_table_entry (type, name, function_p)
my_friendly_abort (88);
}
if (function_p)
prev_entry = &MEMOIZED_FNFIELDS (CLASSTYPE_MTABLE_ENTRY (type), index);
prev_entry = &MEMOIZED_FNFIELDS (CLASSTYPE_MTABLE_ENTRY (type), idx);
else
prev_entry = &MEMOIZED_FIELDS (CLASSTYPE_MTABLE_ENTRY (type), index);
prev_entry = &MEMOIZED_FIELDS (CLASSTYPE_MTABLE_ENTRY (type), idx);
entry = my_tree_cons (name, NULL_TREE, *prev_entry);
*prev_entry = entry;
@ -325,6 +334,7 @@ make_memoized_table_entry (type, name, function_p)
be NULL_TREE if we are not in a class's scope.
USE_OLD, if nonzero tries to use previous context. */
void
push_memoized_context (type, use_old)
tree type;
@ -363,6 +373,7 @@ push_memoized_context (type, use_old)
If we wanted to, we could not use pop_search_level, since
poping that level allows the data we have collected to
be clobbered; a stack of obstacks would be needed. */
void
pop_memoized_context (use_old)
int use_old;
@ -402,6 +413,7 @@ pop_memoized_context (use_old)
the same type as the type given in PARENT. To be optimal, we want
the first one that is found by going through the least number of
virtual bases. DEPTH should be NULL_PTR. */
static tree
get_vbase (parent, binfo, depth)
tree parent, binfo;
@ -448,6 +460,7 @@ get_vbase (parent, binfo, depth)
/* Convert EXPR to a virtual base class of type TYPE. We know that
EXPR is a non-null POINTER_TYPE to RECORD_TYPE. We also know that
the type of what expr points to has a virtual base of type TYPE. */
tree
convert_pointer_to_vbase (type, expr)
tree type;
@ -508,6 +521,7 @@ get_binfo (parent, binfo, protect)
}
/* This is the newer depth first get_base_distance routine. */
static int
get_base_distance_recursive (binfo, depth, is_private, rval,
rval_private_ptr, new_binfo_ptr, parent, path_ptr,
@ -575,7 +589,7 @@ get_base_distance_recursive (binfo, depth, is_private, rval,
tree base_binfo = TREE_VEC_ELT (binfos, i);
/* Find any specific instance of a virtual base, when searching with
a binfo... */
a binfo... */
if (BINFO_MARKED (base_binfo) == 0 || TREE_CODE (parent) == TREE_VEC)
{
int via_private
@ -589,7 +603,7 @@ get_base_distance_recursive (binfo, depth, is_private, rval,
int was;
/* When searching for a non-virtual, we cannot mark
virtually found binfos. */
virtually found binfos. */
if (! this_virtual)
SET_BINFO_MARKED (base_binfo);
@ -602,7 +616,7 @@ get_base_distance_recursive (binfo, depth, is_private, rval,
protect, via_virtual_ptr,
this_virtual,
current_scope_in_chain);
/* watch for updates; only update if path is good. */
/* watch for updates; only update if path is good. */
if (path_ptr && WATCH_VALUES (rval, *via_virtual_ptr) != was)
BINFO_INHERITANCE_CHAIN (base_binfo) = binfo;
if (rval == -2 && *via_virtual_ptr == 0)
@ -658,7 +672,7 @@ get_base_distance (parent, binfo, protect, path_ptr)
type = BINFO_TYPE (binfo);
else if (IS_AGGR_TYPE_CODE (TREE_CODE (binfo)))
{
type = binfo;
type = complete_type (binfo);
binfo = TYPE_BINFO (type);
if (path_ptr)
@ -693,7 +707,7 @@ get_base_distance (parent, binfo, protect, path_ptr)
if (rval && protect && rval_private)
return -3;
/* find real virtual base classes. */
/* find real virtual base classes. */
if (rval == -1 && TREE_CODE (parent) == TREE_VEC
&& parent == binfo_member (BINFO_TYPE (parent),
CLASSTYPE_VBASECLASSES (type)))
@ -716,6 +730,7 @@ get_base_distance (parent, binfo, protect, path_ptr)
/* Do a 1-level search for NAME as a member of TYPE. The caller must
figure out whether it can access this field. (Since it is only one
level, this is reasonable.) */
static tree
lookup_field_1 (type, name)
tree type, name;
@ -759,11 +774,11 @@ lookup_field_1 (type, name)
/* There are a number of cases we need to be aware of here:
current_class_type current_function_decl
* global NULL NULL
* fn-local NULL SET
* class-local SET NULL
* class->fn SET SET
* fn->class SET SET
global NULL NULL
fn-local NULL SET
class-local SET NULL
class->fn SET SET
fn->class SET SET
Those last two make life interesting. If we're in a function which is
itself inside a class, we need decls to go into the fn's decls (our
@ -806,7 +821,7 @@ current_scope ()
lexical scope because it is protected.
access_private_node means that the field cannot be accessed by the current
lexical scope because it is private. */
lexical scope because it is private. */
#if 0
#define PUBLIC_RETURN return (DECL_PUBLIC (field) = 1), access_public_node
@ -998,6 +1013,7 @@ compute_access (basetype_path, field)
found as a base class and sub-object of the object denoted by
BINFO. This routine relies upon binfos not being shared, except
for binfos for virtual bases. */
static int
is_subobject_of_p (parent, binfo)
tree parent, binfo;
@ -1024,7 +1040,8 @@ is_subobject_of_p (parent, binfo)
correspond to ANSI working paper Sept 17, 1992 10p4. The two
binfos given are the binfos corresponding to the particular places
the FIELD_DECLs are found. This routine relies upon binfos not
being shared, except for virtual bases. */
being shared, except for virtual bases. */
static int
hides (hider_binfo, hidee_binfo)
tree hider_binfo, hidee_binfo;
@ -1034,29 +1051,30 @@ hides (hider_binfo, hidee_binfo)
part is always true is the second part is true.
When hider and hidee are the same (two ways to get to the exact
same member) we consider either one as hiding the other. */
same member) we consider either one as hiding the other. */
return is_subobject_of_p (hidee_binfo, hider_binfo);
}
/* Very similar to lookup_fnfields_1 but it ensures that at least one
function was declared inside the class given by TYPE. It really should
only return functions that match the given TYPE. */
static int
lookup_fnfields_here (type, name)
tree type, name;
{
int index = lookup_fnfields_1 (type, name);
int idx = lookup_fnfields_1 (type, name);
tree fndecls;
/* ctors and dtors are always only in the right class. */
if (index <= 1)
return index;
fndecls = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), index);
if (idx <= 1)
return idx;
fndecls = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), idx);
while (fndecls)
{
if (TYPE_MAIN_VARIANT (DECL_CLASS_CONTEXT (fndecls))
== TYPE_MAIN_VARIANT (type))
return index;
return idx;
fndecls = TREE_CHAIN (fndecls);
}
return -1;
@ -1070,6 +1088,7 @@ lookup_fnfields_here (type, name)
It was not clear what should happen if WANT_TYPE is set, and an
ambiguity is found. At least one use (lookup_name) to not see
the error. */
tree
lookup_field (xbasetype, name, protect, want_type)
register tree xbasetype, name;
@ -1101,7 +1120,7 @@ lookup_field (xbasetype, name, protect, want_type)
/* Set this to nonzero if we don't know how to compute
accurate error messages for access control. */
int index = MEMOIZED_HASH_FN (name);
int idx = MEMOIZED_HASH_FN (name);
#if 0
/* We cannot search for constructor/destructor names like this. */
@ -1128,7 +1147,7 @@ lookup_field (xbasetype, name, protect, want_type)
if (CLASSTYPE_MTABLE_ENTRY (type))
{
tree tem = MEMOIZED_FIELDS (CLASSTYPE_MTABLE_ENTRY (type), index);
tree tem = MEMOIZED_FIELDS (CLASSTYPE_MTABLE_ENTRY (type), idx);
while (tem && TREE_PURPOSE (tem) != name)
{
@ -1232,7 +1251,7 @@ lookup_field (xbasetype, name, protect, want_type)
TREE_VIA_PROTECTED (basetype_chain) = TREE_VIA_PROTECTED (basetype_path);
TREE_VIA_VIRTUAL (basetype_chain) = TREE_VIA_VIRTUAL (basetype_path);
/* The ambiguity check relies upon breadth first searching. */
/* The ambiguity check relies upon breadth first searching. */
search_stack = push_search_level (search_stack, &search_obstack);
binfo = basetype_path;
@ -1303,12 +1322,12 @@ lookup_field (xbasetype, name, protect, want_type)
else if (rval_binfo && hides (rval_binfo_h, binfo_h))
{
/* This is ok, the member found is in rval_binfo, not
here (binfo). */
here (binfo). */
}
else if (rval_binfo==NULL_TREE || hides (binfo_h, rval_binfo_h))
{
/* This is ok, the member found is here (binfo), not in
rval_binfo. */
rval_binfo. */
if (nval)
{
rval = nval;
@ -1320,7 +1339,7 @@ lookup_field (xbasetype, name, protect, want_type)
}
else
{
/* Undo finding it before, as something else hides it. */
/* Undo finding it before, as something else hides it. */
rval = NULL_TREE;
}
rval_binfo = binfo;
@ -1328,7 +1347,7 @@ lookup_field (xbasetype, name, protect, want_type)
}
else
{
/* This is ambiguous. */
/* This is ambiguous. */
errstr = "request for member `%D' is ambiguous";
protect += 2;
break;
@ -1453,6 +1472,7 @@ lookup_field (xbasetype, name, protect, want_type)
}
/* Try to find NAME inside a nested class. */
tree
lookup_nested_field (name, complain)
tree name;
@ -1517,6 +1537,7 @@ lookup_nested_field (name, complain)
/* TYPE is a class type. Return the index of the fields within
the method vector with name NAME, or -1 is no such field exists. */
static int
lookup_fnfields_1 (type, name)
tree type, name;
@ -1573,6 +1594,7 @@ lookup_fnfields_1 (type, name)
As a special case, is COMPLAIN is -1, we don't complain, and we
don't return error_mark_node, but rather the complete list of
virtuals. This is used by get_virtuals_named_this. */
tree
lookup_fnfields (basetype_path, name, complain)
tree basetype_path, name;
@ -1604,7 +1626,7 @@ lookup_fnfields (basetype_path, name, complain)
/* Set this to nonzero if we don't know how to compute
accurate error messages for access control. */
int index = MEMOIZED_HASH_FN (name);
int idx = MEMOIZED_HASH_FN (name);
if (complain == -1)
{
@ -1625,10 +1647,10 @@ lookup_fnfields (basetype_path, name, complain)
binfo_h = binfo;
type = complete_type (BINFO_TYPE (basetype_path));
/* The memoization code is in need of maintenance. */
/* The memoization code is in need of maintenance. */
if (!find_all && CLASSTYPE_MTABLE_ENTRY (type))
{
tree tem = MEMOIZED_FNFIELDS (CLASSTYPE_MTABLE_ENTRY (type), index);
tree tem = MEMOIZED_FNFIELDS (CLASSTYPE_MTABLE_ENTRY (type), idx);
while (tem && TREE_PURPOSE (tem) != name)
{
@ -1685,19 +1707,19 @@ lookup_fnfields (basetype_path, name, complain)
else
entry = 0;
index = lookup_fnfields_here (type, name);
if (index >= 0 || lookup_field_1 (type, name))
idx = lookup_fnfields_here (type, name);
if (idx >= 0 || lookup_field_1 (type, name))
{
rval_binfo = basetype_path;
rval_binfo_h = rval_binfo;
}
if (index >= 0)
if (idx >= 0)
{
rval = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), index);
rval = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), idx);
rvals = my_tree_cons (basetype_path, rval, rvals);
if (BINFO_BASETYPES (binfo) && CLASSTYPE_BASELINK_VEC (type))
TREE_TYPE (rvals) = TREE_VEC_ELT (CLASSTYPE_BASELINK_VEC (type), index);
TREE_TYPE (rvals) = TREE_VEC_ELT (CLASSTYPE_BASELINK_VEC (type), idx);
if (entry)
{
@ -1734,7 +1756,7 @@ lookup_fnfields (basetype_path, name, complain)
TREE_VIA_VIRTUAL (basetype_chain) = TREE_VIA_VIRTUAL (basetype_path);
}
/* The ambiguity check relies upon breadth first searching. */
/* The ambiguity check relies upon breadth first searching. */
search_stack = push_search_level (search_stack, &search_obstack);
binfo = basetype_path;
@ -1744,7 +1766,7 @@ lookup_fnfields (basetype_path, name, complain)
{
tree binfos = BINFO_BASETYPES (binfo);
int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
int index;
int idx;
/* Process and/or queue base types. */
for (i = 0; i < n_baselinks; i++)
@ -1794,32 +1816,32 @@ lookup_fnfields (basetype_path, name, complain)
and we do find NAME in TYPE, verify that such a second
sighting is in fact valid. */
index = lookup_fnfields_here (type, name);
idx = lookup_fnfields_here (type, name);
if (index >= 0 || (lookup_field_1 (type, name)!=NULL_TREE && !find_all))
if (idx >= 0 || (lookup_field_1 (type, name)!=NULL_TREE && !find_all))
{
if (rval_binfo && !find_all && hides (rval_binfo_h, binfo_h))
{
/* This is ok, the member found is in rval_binfo, not
here (binfo). */
here (binfo). */
}
else if (rval_binfo==NULL_TREE || find_all || hides (binfo_h, rval_binfo_h))
{
/* This is ok, the member found is here (binfo), not in
rval_binfo. */
if (index >= 0)
rval_binfo. */
if (idx >= 0)
{
rval = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), index);
rval = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), idx);
/* Note, rvals can only be previously set if find_all is
true. */
rvals = my_tree_cons (basetype_path, rval, rvals);
if (TYPE_BINFO_BASETYPES (type)
&& CLASSTYPE_BASELINK_VEC (type))
TREE_TYPE (rvals) = TREE_VEC_ELT (CLASSTYPE_BASELINK_VEC (type), index);
TREE_TYPE (rvals) = TREE_VEC_ELT (CLASSTYPE_BASELINK_VEC (type), idx);
}
else
{
/* Undo finding it before, as something else hides it. */
/* Undo finding it before, as something else hides it. */
rval = NULL_TREE;
rvals = NULL_TREE;
}
@ -1828,7 +1850,7 @@ lookup_fnfields (basetype_path, name, complain)
}
else
{
/* This is ambiguous. */
/* This is ambiguous. */
errstr = "request for method `%D' is ambiguous";
rvals = error_mark_node;
break;
@ -2006,6 +2028,7 @@ tree_has_any_destructor_p (binfo, i)
DTORP is nonzero if we are looking for a destructor. Destructors
need special treatment because they do not match by name. */
tree
get_matching_virtual (binfo, fndecl, dtorp)
tree binfo, fndecl;
@ -2134,6 +2157,7 @@ get_matching_virtual (binfo, fndecl, dtorp)
/* Return the list of virtual functions which are abstract in type
TYPE that come from non virtual base classes. See
expand_direct_vtbls_init for the style of search we do. */
static tree
get_abstract_virtuals_1 (binfo, do_self, abstract_virtuals)
tree binfo;
@ -2175,6 +2199,7 @@ get_abstract_virtuals_1 (binfo, do_self, abstract_virtuals)
/* Return the list of virtual functions which are abstract in type TYPE.
This information is cached, and so must be built on a
non-temporary obstack. */
tree
get_abstract_virtuals (type)
tree type;
@ -2182,7 +2207,7 @@ get_abstract_virtuals (type)
tree vbases;
tree abstract_virtuals = CLASSTYPE_ABSTRACT_VIRTUALS (type);
/* First get all from non-virtual bases. */
/* First get all from non-virtual bases. */
abstract_virtuals
= get_abstract_virtuals_1 (TYPE_BINFO (type), 1, abstract_virtuals);
@ -2217,7 +2242,7 @@ get_baselinks (type_as_binfo_list, type, name)
tree type_as_binfo_list;
tree type, name;
{
int head = 0, tail = 0, index;
int head = 0, tail = 0, idx;
tree rval = 0, nval = 0;
tree basetypes = type_as_binfo_list;
tree binfo = TYPE_BINFO (type);
@ -2253,17 +2278,17 @@ get_baselinks (type_as_binfo_list, type, name)
basetypes = search_stack->first[head++];
binfo = TREE_VALUE (basetypes);
type = BINFO_TYPE (binfo);
index = lookup_fnfields_1 (type, name);
if (index >= 0)
idx = lookup_fnfields_1 (type, name);
if (idx >= 0)
{
nval = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), index);
nval = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), idx);
rval = hash_tree_cons (0, 0, 0, basetypes, nval, rval);
if (TYPE_BINFO_BASETYPES (type) == 0)
goto dont_queue;
else if (TREE_VEC_LENGTH (TYPE_BINFO_BASETYPES (type)) == 1)
{
if (CLASSTYPE_BASELINK_VEC (type))
TREE_TYPE (rval) = TREE_VEC_ELT (CLASSTYPE_BASELINK_VEC (type), index);
TREE_TYPE (rval) = TREE_VEC_ELT (CLASSTYPE_BASELINK_VEC (type), idx);
goto dont_queue;
}
}
@ -2321,7 +2346,8 @@ static int mi_size;
/* This routine converts a pointer to be a pointer of an immediate
base class. The normal convert_pointer_to routine would diagnose
the conversion as ambiguous, under MI code that has the base class
as an ambiguous base class. */
as an ambiguous base class. */
static tree
convert_pointer_to_single_level (to_type, expr)
tree to_type, expr;
@ -2340,7 +2366,8 @@ convert_pointer_to_single_level (to_type, expr)
This routine has to remember the path it walked up, when
dfs_init_vbase_pointers is the work function, as otherwise there
would be no record. */
would be no record. */
static void
dfs_walk (binfo, fn, qfn)
tree binfo;
@ -2554,6 +2581,7 @@ dfs_debug_mark (binfo)
virtual base class, given the global pointer vbase_decl_ptr.
We use the global vbase_types. ICK! */
static void
dfs_find_vbases (binfo)
tree binfo;
@ -2624,6 +2652,7 @@ dfs_init_vbase_pointers (binfo)
/* Sometimes this needs to clear both VTABLE_PATH and NEW_VTABLE. Other
times, just NEW_VTABLE, but optimizer should make both with equal
efficiency (though it does not currently). */
static void
dfs_clear_vbase_slots (binfo)
tree binfo;
@ -2666,6 +2695,7 @@ init_vbase_pointers (type, decl_ptr)
We know that if there is more than one place (binfo) the fndecl that the
declared, they all refer to the same binfo. See get_class_offset_1 for
the check that ensures this. */
static tree
virtual_context (fndecl, t, vbase)
tree fndecl, t, vbase;
@ -2717,7 +2747,8 @@ virtual_context (fndecl, t, vbase)
offset information for the virtual bases, so the offsets are only
calculated once. The offsets are computed by where we think the
vbase should be (as noted by the CLASSTYPE_SEARCH_SLOT) minus where
the vbase really is. */
the vbase really is. */
static void
expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
vbase_offsets)
@ -2749,7 +2780,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
&& current_fndecl != abort_fndecl
&& (vc=virtual_context (current_fndecl, t, vbase)) != vbase)
{
/* This may in fact need a runtime fixup. */
/* This may in fact need a runtime fixup. */
tree idx = DECL_VINDEX (current_fndecl);
tree vtbl = BINFO_VTABLE (binfo);
tree nvtbl = lookup_name (DECL_NAME (vtbl), 0);
@ -2777,7 +2808,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
nvtbl, vtbl);
TREE_SIDE_EFFECTS (init) = 1;
expand_expr_stmt (init);
/* Update the vtable pointers as necessary. */
/* Update the vtable pointers as necessary. */
ref = build_vfield_ref (build_indirect_ref (addr, NULL_PTR), DECL_CONTEXT (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))));
expand_expr_stmt (build_modify_expr (ref, NOP_EXPR,
build_unary_op (ADDR_EXPR, nvtbl, 0)));
@ -2826,6 +2857,7 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t,
/* Fixup upcast offsets for all direct vtables. Patterned after
expand_direct_vtbls_init. */
static void
fixup_virtual_upcast_offsets (real_binfo, binfo, init_self, can_elide, addr, orig_addr, type, vbase, vbase_offsets)
tree real_binfo, binfo;
@ -2900,21 +2932,22 @@ expand_indirect_vtbls_init (binfo, true_exp, decl_ptr)
addr = convert_pointer_to_vbase (TREE_TYPE (vbases), vbase_decl_ptr);
/* Do all vtables from this virtual base. */
/* Do all vtables from this virtual base. */
/* This assumes that virtual bases can never serve as parent
binfos. (in the CLASSTPE_VFIELD_PARENT sense) */
expand_direct_vtbls_init (vbases, TYPE_BINFO (BINFO_TYPE (vbases)),
1, 0, addr);
/* Now we adjust the offsets for virtual functions that cross
virtual boundaries on an implicit upcast on vf call so that
the layout of the most complete type is used, instead of
assuming the layout of the virtual bases from our current type. */
/* Now we adjust the offsets for virtual functions that
cross virtual boundaries on an implicit upcast on vf call
so that the layout of the most complete type is used,
instead of assuming the layout of the virtual bases from
our current type. */
if (flag_vtable_thunks)
{
/* We don't have dynamic thunks yet!
So for now, just fail silently. */
So for now, just fail silently. */
}
else
{
@ -2968,6 +3001,7 @@ dfs_get_vbase_types (binfo)
}
/* get a list of virtual base classes in dfs order. */
tree
get_vbase_types (type)
tree type;
@ -3097,6 +3131,7 @@ note_debug_info_needed (type)
/* Subroutines of push_class_decls (). */
/* Add in a decl to the envelope. */
static void
envelope_add_decl (type, decl, values)
tree type, decl, *values;
@ -3105,7 +3140,7 @@ envelope_add_decl (type, decl, values)
tree name = DECL_NAME (decl);
int dont_add = 0;
/* virtual base names are always unique. */
/* virtual base names are always unique. */
if (VBASE_NAME_P (name))
*values = NULL_TREE;
@ -3298,6 +3333,7 @@ dfs_pushdecls (binfo)
}
/* Consolidate unique (by name) member functions. */
static void
dfs_compress_decls (binfo)
tree binfo;
@ -3340,6 +3376,7 @@ dfs_compress_decls (binfo)
with `error_mark_node' so that if they are encountered
without explicit qualification, we can emit an error
message. */
void
push_class_decls (type)
tree type;
@ -3394,6 +3431,7 @@ push_class_decls (type)
}
/* Here's a subroutine we need because C lacks lambdas. */
static void
dfs_unuse_fields (binfo)
tree binfo;
@ -3517,6 +3555,7 @@ lookup_conversions (type)
tree type;
{
conversions = NULL_TREE;
dfs_walk (TYPE_BINFO (type), add_conversions, 0);
if (TYPE_SIZE (type))
dfs_walk (TYPE_BINFO (type), add_conversions, 0);
return conversions;
}

View File

@ -153,8 +153,7 @@ build_signature_pointer_or_reference_type (to_type, constp, volatilep, refp)
const s * sptr;
};
Similarly, for `volatile' and `const volatile'.
*/
Similarly, for `volatile' and `const volatile'. */
t = make_lang_type (RECORD_TYPE);
{
@ -423,6 +422,7 @@ match_method_types (sig_mtype, class_mtype)
}
/* Undo casts of opaque type variables to the RHS types. */
static void
undo_casts (sig_ty)
tree sig_ty;
@ -562,7 +562,7 @@ build_signature_table_constructor (sig_ty, rhs)
}
else
{
tree tag, vb_off, delta, index, pfn, vt_off;
tree tag, vb_off, delta, idx, pfn, vt_off;
tree tag_decl, vb_off_decl, delta_decl, index_decl;
tree pfn_decl, vt_off_decl;
@ -572,7 +572,7 @@ build_signature_table_constructor (sig_ty, rhs)
tag = build_unary_op (NEGATE_EXPR, integer_one_node, 0);
vb_off = build_unary_op (NEGATE_EXPR, integer_one_node, 0);
delta = integer_zero_node;
index = integer_zero_node;
idx = integer_zero_node;
pfn = build_addr_func (rhs_method);
TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (rhs_method)) = 1;
TREE_TYPE (pfn) = ptr_type_node;
@ -590,7 +590,7 @@ build_signature_table_constructor (sig_ty, rhs)
else
delta = BINFO_OFFSET
(get_binfo (DECL_CLASS_CONTEXT (rhs_method), rhstype, 1));
index = DECL_VINDEX (rhs_method);
idx = DECL_VINDEX (rhs_method);
vt_off = get_vfield_offset (get_binfo (DECL_CONTEXT (rhs_method),
rhstype, 0));
}
@ -601,7 +601,7 @@ build_signature_table_constructor (sig_ty, rhs)
vb_off = build_unary_op (NEGATE_EXPR, integer_one_node, 0);
delta = BINFO_OFFSET (get_binfo (DECL_CLASS_CONTEXT (rhs_method),
rhstype, 1));
index = integer_zero_node;
idx = integer_zero_node;
pfn = build_addr_func (rhs_method);
TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (rhs_method)) = 1;
TREE_TYPE (pfn) = ptr_type_node;
@ -621,7 +621,7 @@ build_signature_table_constructor (sig_ty, rhs)
tag = convert (TREE_TYPE (tag_decl), tag);
vb_off = convert (TREE_TYPE (vb_off_decl), vb_off);
delta = convert (TREE_TYPE (delta_decl), delta);
index = convert (TREE_TYPE (index_decl), index);
idx = convert (TREE_TYPE (index_decl), idx);
if (DECL_VINDEX (rhs_method))
{
@ -636,7 +636,7 @@ build_signature_table_constructor (sig_ty, rhs)
tbl_entry = build_tree_list (pfn_decl, pfn);
}
tbl_entry = tree_cons (delta_decl, delta,
tree_cons (index_decl, index, tbl_entry));
tree_cons (index_decl, idx, tbl_entry));
tbl_entry = tree_cons (tag_decl, tag,
tree_cons (vb_off_decl, vb_off, tbl_entry));
tbl_entry = build (CONSTRUCTOR, sigtable_entry_type,
@ -934,7 +934,7 @@ build_signature_method_call (basetype, instance, function, parms)
tree tbl_entry = build_component_ref (build1 (INDIRECT_REF, basetype,
signature_tbl_ptr),
sig_field_name, basetype_path, 1);
tree tag, delta, pfn, vt_off, index, vfn;
tree tag, delta, pfn, vt_off, idx, vfn;
tree deflt_call = NULL_TREE, direct_call, virtual_call, result;
tbl_entry = save_expr (tbl_entry);
@ -942,7 +942,7 @@ build_signature_method_call (basetype, instance, function, parms)
delta = build_component_ref (tbl_entry, delta_identifier, NULL_TREE, 1);
pfn = build_component_ref (tbl_entry, pfn_identifier, NULL_TREE, 1);
vt_off = build_component_ref (tbl_entry, vt_off_identifier, NULL_TREE, 1);
index = build_component_ref (tbl_entry, index_identifier, NULL_TREE, 1);
idx = build_component_ref (tbl_entry, index_identifier, NULL_TREE, 1);
TREE_TYPE (pfn) = build_pointer_type (TREE_TYPE (function));
if (IS_DEFAULT_IMPLEMENTATION (function))
@ -980,7 +980,7 @@ build_signature_method_call (basetype, instance, function, parms)
convert (ptrdiff_type_node, vt_off));
vtbl = build_indirect_ref (build_indirect_ref (vfld, NULL_PTR),
NULL_PTR);
aref = build_array_ref (vtbl, index);
aref = build_array_ref (vtbl, idx);
if (flag_vtable_thunks)
vfn = aref;

View File

@ -35,9 +35,9 @@ Boston, MA 02111-1307, USA. */
/* This takes a token stream that hasn't decided much about types and
tries to figure out as much as it can, with excessive lookahead and
backtracking. */
backtracking. */
/* fifo of tokens recognized and available to parser. */
/* fifo of tokens recognized and available to parser. */
struct token {
/* The values for YYCHAR will fit in a short. */
short yychar;
@ -68,6 +68,7 @@ static int debug_yychar ();
#endif
/* Initialize token_obstack. Called once, from init_lex. */
void
init_spew ()
{
@ -77,7 +78,8 @@ init_spew ()
#ifdef SPEW_DEBUG
/* Use functions for debugging... */
/* Return the number of tokens available on the fifo. */
/* Return the number of tokens available on the fifo. */
static int
num_tokens ()
{
@ -85,18 +87,20 @@ num_tokens ()
- first_token;
}
/* Fetch the token N down the line from the head of the fifo. */
/* Fetch the token N down the line from the head of the fifo. */
static struct token*
nth_token (n)
int n;
{
/* could just have this do slurp_ implicitly, but this way is easier
* to debug... */
to debug... */
my_friendly_assert (n < num_tokens (), 298);
return ((struct token*)obstack_base (&token_obstack)) + n + first_token;
}
/* Add a token to the token fifo. */
/* Add a token to the token fifo. */
static void
add_token (t)
struct token* t;
@ -105,6 +109,7 @@ add_token (t)
}
/* Consume the next token out of the fifo. */
static void
consume_token ()
{
@ -194,7 +199,7 @@ probe_obstack (h, obj, nlevels)
lp = (h)->chunk;
/* We use >= rather than > since the object cannot be exactly at
the beginning of the chunk but might be an empty object exactly
at the end of an adjacent chunk. */
at the end of an adjacent chunk. */
for (; nlevels != 0 && lp != 0 && ((tree)lp >= obj || (tree)lp->limit < obj);
nlevels -= 1)
{
@ -207,7 +212,7 @@ probe_obstack (h, obj, nlevels)
/* from lex.c: */
/* Value is 1 (or 2) if we should try to make the next identifier look like
a typename (when it may be a local variable or a class variable).
Value is 0 if we treat this name in a default fashion. */
Value is 0 if we treat this name in a default fashion. */
extern int looking_for_typename;
int looking_for_template;
@ -262,8 +267,8 @@ yylex ()
}
/* many tokens just need to be returned. At first glance, all we
* have to do is send them back up, but some of them are needed to
* figure out local context. */
have to do is send them back up, but some of them are needed to
figure out local context. */
switch (tmp_token.yychar)
{
case EMPTY:
@ -318,7 +323,7 @@ yylex ()
else
lastiddecl = trrr;
got_scope = NULL_TREE;
/* and fall through to... */
/* and fall through to... */
case IDENTIFIER_DEFN:
case TYPENAME:
case TYPENAME_DEFN:
@ -344,11 +349,11 @@ yylex ()
case AGGR:
*nth_token (0) = tmp_token;
do_aggr ();
/* fall through to output... */
/* fall through to output... */
case ENUM:
/* Set this again, in case we are rescanning. */
looking_for_typename = 1;
/* fall through... */
/* fall through... */
default:
consume_token ();
}
@ -365,11 +370,11 @@ yylex ()
}
/* token[0] == AGGR (struct/union/enum)
* Thus, token[1] is either a TYPENAME or a TYPENAME_DEFN.
* If token[2] == '{' or ':' then it's TYPENAME_DEFN.
* It's also a definition if it's a forward declaration (as in 'struct Foo;')
* which we can tell if token[2] == ';' *and* token[-1] != FRIEND or NEW.
*/
Thus, token[1] is either a TYPENAME or a TYPENAME_DEFN.
If token[2] == '{' or ':' then it's TYPENAME_DEFN.
It's also a definition if it's a forward declaration (as in 'struct Foo;')
which we can tell if token[2] == ';' *and* token[-1] != FRIEND or NEW. */
static int
do_aggr ()
{
@ -383,7 +388,7 @@ do_aggr ()
if (yc2 == ';')
{
/* It's a forward declaration iff we were not preceded by
'friend' or `new'. */
'friend' or `new'. */
if (first_token > 0)
{
if (nth_token (-1)->yychar == SCSPEC
@ -414,7 +419,8 @@ do_aggr ()
}
#ifdef SPEW_DEBUG
/* debug_yychar takes a yychar (token number) value and prints its name. */
/* debug_yychar takes a yychar (token number) value and prints its name. */
static int
debug_yychar (yy)
int yy;

View File

@ -54,7 +54,7 @@ real_lvalue_p (ref)
switch (TREE_CODE (ref))
{
/* preincrements and predecrements are valid lvals, provided
what they refer to are valid lvals. */
what they refer to are valid lvals. */
case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
case COMPONENT_REF:
@ -124,7 +124,7 @@ lvalue_p (ref)
switch (TREE_CODE (ref))
{
/* preincrements and predecrements are valid lvals, provided
what they refer to are valid lvals. */
what they refer to are valid lvals. */
case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
case COMPONENT_REF:
@ -206,6 +206,7 @@ lvalue_or_else (ref, string)
Build an encapsulation of the initialization to perform
and return it so that it can be processed by language-independent
and language-specific expression expanders. */
tree
build_cplus_new (type, init)
tree type;
@ -279,7 +280,7 @@ break_out_calls (exp)
if (code == CALL_EXPR)
return copy_node (exp);
/* Don't try and defeat a save_expr, as it should only be done once. */
/* Don't try and defeat a save_expr, as it should only be done once. */
if (code == SAVE_EXPR)
return exp;
@ -360,6 +361,7 @@ extern struct obstack *saveable_obstack;
/* Construct, lay out and return the type of methods belonging to class
BASETYPE and whose arguments are described by ARGTYPES and whose values
are described by RETTYPE. If each type exists already, reuse it. */
tree
build_cplus_method_type (basetype, rettype, argtypes)
tree basetype, rettype, argtypes;
@ -496,6 +498,7 @@ cp_build_type_variant (type, constp, volatilep)
Note that we don't have to worry about having two paths to the
same base type, since this type owns its association list. */
void
propagate_binfo_offsets (binfo, offset)
tree binfo;
@ -577,6 +580,7 @@ propagate_binfo_offsets (binfo, offset)
Returns the maximum number of virtual functions any of the virtual
baseclasses provide. */
int
layout_vbasetypes (rec, max)
tree rec;
@ -717,6 +721,7 @@ layout_vbasetypes (rec, max)
creates a list of base_binfos in TYPE_BINFO (REC) from BINFOS.
Returns list of virtual base classes in a FIELD_DECL chain. */
tree
layout_basetypes (rec, binfos)
tree rec, binfos;
@ -734,7 +739,7 @@ layout_basetypes (rec, binfos)
/* Record size so far is CONST_SIZE + VAR_SIZE bits, where CONST_SIZE is
an integer and VAR_SIZE is a tree expression. If VAR_SIZE is null,
the size is just CONST_SIZE. Naturally we try to avoid using
VAR_SIZE. And so far, we've been successful. */
VAR_SIZE. And so far, we've been successful. */
#if 0
register tree var_size = 0;
#endif
@ -769,7 +774,7 @@ layout_basetypes (rec, binfos)
class A;
class B: private A { virtual void F(); };
does not dump core when compiled. */
does not dump core when compiled. */
my_friendly_abort (121);
#endif
continue;
@ -805,7 +810,7 @@ layout_basetypes (rec, binfos)
build_pointer_type (basetype));
/* If you change any of the below, take a look at all the
other VFIELD_BASEs and VTABLE_BASEs in the code, and change
them too. */
them too. */
DECL_ASSEMBLER_NAME (decl) = get_identifier (VTABLE_BASE);
DECL_VIRTUAL_P (decl) = 1;
DECL_FIELD_CONTEXT (decl) = rec;
@ -992,6 +997,7 @@ list_hash_add (hashcode, list)
This function frees the list you pass in if it is a duplicate. */
/* Set to 1 to debug without canonicalization. Never set by program. */
static int debug_no_list_hash = 0;
tree
@ -1038,6 +1044,7 @@ hash_tree_cons (via_public, via_virtual, via_protected, purpose, value, chain)
}
/* Constructor for hashed lists. */
tree
hash_tree_chain (value, chain)
tree value, chain;
@ -1055,6 +1062,7 @@ hash_tree_chain (value, chain)
}
/* Similar, but used for concatenating two lists. */
tree
hash_chainon (list1, list2)
tree list1, list2;
@ -1353,6 +1361,7 @@ is_aggr_type_2 (t1, t2)
/* Give message using types TYPE1 and TYPE2 as arguments.
PFN is the function which will print the message;
S is the format string for PFN to use. */
void
message_2_types (pfn, s, type1, type2)
void (*pfn) ();
@ -1421,6 +1430,7 @@ lang_printable_name (decl)
/* Build the FUNCTION_TYPE or METHOD_TYPE which may throw exceptions
listed in RAISES. */
tree
build_exception_variant (type, raises)
tree type;
@ -1436,7 +1446,7 @@ build_exception_variant (type, raises)
|| TYPE_VOLATILE (v) != volatilep)
continue;
/* @@ This should do set equality, not exact match. */
/* @@ This should do set equality, not exact match. */
if (simple_cst_list_equal (TYPE_RAISES_EXCEPTIONS (v), raises))
/* List of exceptions raised matches previously found list.
@ -1653,6 +1663,7 @@ perm_manip (t)
/* Assuming T is a node built bottom-up, make it all exist on
permanent obstack, if it is not permanent already. */
tree
copy_to_permanent (t)
tree t;
@ -1701,6 +1712,7 @@ print_lang_statistics ()
which `cc' doesn't know how to link. Note that the C++ front-end
no longer actually uses the `assert' macro (instead, it calls
my_friendly_assert). But all of the back-end files still need this. */
void
__eprintf (string, expression, line, filename)
#ifdef __STDC__
@ -1720,8 +1732,9 @@ __eprintf (string, expression, line, filename)
abort ();
}
/* Return, as an INTEGER_CST node, the number of elements for
TYPE (which is an ARRAY_TYPE). This counts only elements of the top array. */
/* Return, as an INTEGER_CST node, the number of elements for TYPE
(which is an ARRAY_TYPE). This counts only elements of the top
array. */
tree
array_type_nelts_top (type)
@ -1732,9 +1745,9 @@ array_type_nelts_top (type)
integer_one_node));
}
/* Return, as an INTEGER_CST node, the number of elements for
TYPE (which is an ARRAY_TYPE). This one is a recursive count of all
ARRAY_TYPEs that are clumped together. */
/* Return, as an INTEGER_CST node, the number of elements for TYPE
(which is an ARRAY_TYPE). This one is a recursive count of all
ARRAY_TYPEs that are clumped together. */
tree
array_type_nelts_total (type)
@ -1765,6 +1778,7 @@ bot_manip (t)
}
/* Actually, we'll just clean out the target exprs for the moment. */
tree
break_out_target_exprs (t)
tree t;
@ -1918,7 +1932,7 @@ vec_binfo_member (elem, vec)
if (vec)
for (i = 0; i < TREE_VEC_LENGTH (vec); ++i)
if (elem == BINFO_TYPE (TREE_VEC_ELT (vec, i)))
if (comptypes (elem, BINFO_TYPE (TREE_VEC_ELT (vec, i)), 1))
return TREE_VEC_ELT (vec, i);
return NULL_TREE;

View File

@ -127,7 +127,7 @@ tree
complete_type (type)
tree type;
{
if (TYPE_SIZE (type) != NULL_TREE)
if (type == error_mark_node || TYPE_SIZE (type) != NULL_TREE)
;
else if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type))
{
@ -142,6 +142,7 @@ complete_type (type)
}
/* Return truthvalue of whether type of EXP is instantiated. */
int
type_unknown_p (exp)
tree exp;
@ -153,6 +154,7 @@ type_unknown_p (exp)
}
/* Return truthvalue of whether T is function (or pfn) type. */
int
fntype_p (t)
tree t;
@ -166,6 +168,7 @@ fntype_p (t)
/* Do `exp = require_instantiated_type (type, exp);' to make sure EXP
does not have an uninstantiated type.
TYPE is type to instantiate with, if uninstantiated. */
tree
require_instantiated_type (type, exp, errval)
tree type, exp, errval;
@ -541,7 +544,8 @@ common_type (t1, t2)
tree b1 = TYPE_OFFSET_BASETYPE (t1);
tree b2 = TYPE_OFFSET_BASETYPE (t2);
if (DERIVED_FROM_P (b1, b2) && binfo_or_else (b1, b2))
if (comptypes (b1, b2, 1)
|| (DERIVED_FROM_P (b1, b2) && binfo_or_else (b1, b2)))
return build_type_attribute_variant (t2, attributes);
else if (binfo_or_else (b2, b1))
return build_type_attribute_variant (t1, attributes);
@ -554,6 +558,7 @@ common_type (t1, t2)
}
/* Return 1 if TYPE1 and TYPE2 raise the same exceptions. */
int
compexcepttypes (t1, t2)
tree t1, t2;
@ -616,6 +621,7 @@ comp_array_types (cmp, t1, t2, strict)
pointer to a base classes. These allowances do not commute. In this
case, TYPE1 is assumed to be the base class, and TYPE2 is assumed to
be the derived class. */
int
comptypes (type1, type2, strict)
tree type1, type2;
@ -931,6 +937,7 @@ comp_target_types (ttl, ttr, nptrs)
/* If two types share a common base type, return that basetype.
If there is not a unique most-derived base type, this function
returns ERROR_MARK_NODE. */
tree
common_base_type (tt1, tt2)
tree tt1, tt2;
@ -990,6 +997,7 @@ common_base_type (tt1, tt2)
C++: See comment above about TYPE1, TYPE2, STRICT.
If STRICT == 3, it means checking is strict, but do not compare
default parameter values. */
int
compparms (parms1, parms2, strict)
tree parms1, parms2;
@ -1036,6 +1044,7 @@ compparms (parms1, parms2, strict)
/* This really wants return whether or not parameter type lists
would make their owning functions assignment compatible or not. */
int
comp_target_parms (parms1, parms2, strict)
tree parms1, parms2;
@ -1617,6 +1626,7 @@ build_object_ref (datum, basetype, field)
/* Like `build_component_ref, but uses an already found field.
Must compute access for current_class_ref. Otherwise, ok. */
tree
build_component_ref_1 (datum, field, protect)
tree datum, field;
@ -1689,6 +1699,7 @@ build_component_ref_1 (datum, field, protect)
we're dealing with aggregates. So, we now call this in unary_complex_lvalue,
and in build_modify_expr. The case (in particular) that led to this was
with CODE == ADDR_EXPR, since it's not an lvalue when we'd get it there. */
static tree
rationalize_conditional_expr (code, t)
enum tree_code code;
@ -1704,6 +1715,7 @@ rationalize_conditional_expr (code, t)
FIELD_DECL for the field. If not found return NULL_TREE. Because
anonymous unions can nest, we must also search all anonymous unions
that are directly reachable. */
static tree
lookup_anon_field (t, type)
tree t, type;
@ -1739,6 +1751,7 @@ lookup_anon_field (t, type)
/* Build a COMPONENT_REF for a given DATUM, and it's member COMPONENT.
COMPONENT can be an IDENTIFIER_NODE that is the name of the member
that we are interested in, or it can be a FIELD_DECL. */
tree
build_component_ref (datum, component, basetype_path, protect)
tree datum, component, basetype_path;
@ -1752,7 +1765,8 @@ build_component_ref (datum, component, basetype_path, protect)
if (current_template_parms)
return build_min_nt (COMPONENT_REF, datum, component);
/* If DATUM is a COMPOUND_EXPR or COND_EXPR, move our reference inside it. */
/* If DATUM is a COMPOUND_EXPR or COND_EXPR, move our reference
inside it. */
switch (TREE_CODE (datum))
{
case COMPOUND_EXPR:
@ -1786,7 +1800,7 @@ build_component_ref (datum, component, basetype_path, protect)
code = TREE_CODE (basetype);
}
/* First, see if there is a field or component with name COMPONENT. */
/* First, see if there is a field or component with name COMPONENT. */
if (TREE_CODE (component) == TREE_LIST)
{
my_friendly_assert (!(TREE_CHAIN (component) == NULL_TREE
@ -2076,13 +2090,13 @@ build_indirect_ref (ptr, errorstring)
will inherit the type of the array, which will be some pointer type. */
tree
build_x_array_ref (array, index)
tree array, index;
build_x_array_ref (array, idx)
tree array, idx;
{
tree rval = build_opfncall (ARRAY_REF, LOOKUP_NORMAL, array, index, NULL_TREE);
tree rval = build_opfncall (ARRAY_REF, LOOKUP_NORMAL, array, idx, NULL_TREE);
if (rval)
return rval;
return build_array_ref (array, index);
return build_array_ref (array, idx);
}
tree
@ -2256,7 +2270,7 @@ build_x_function_call (function, params, decl)
&& TREE_CODE (function) == TREE_LIST
&& TREE_CHAIN (function) == NULL_TREE)
{
/* Undo (Foo:bar)()... */
/* Undo (Foo:bar)()... */
type = TYPE_OFFSET_BASETYPE (type);
function = TREE_VALUE (function);
my_friendly_assert (TREE_CODE (function) == TREE_LIST, 999);
@ -2341,7 +2355,7 @@ build_x_function_call (function, params, decl)
{
/* Should we undo what was done in build_component_ref? */
if (TREE_CODE (TREE_PURPOSE (TREE_OPERAND (function, 1))) == TREE_VEC)
/* Get the name that build_component_ref hid. */
/* Get the name that build_component_ref hid. */
function = DECL_NAME (TREE_VALUE (TREE_OPERAND (function, 1)));
else
function = TREE_PURPOSE (TREE_OPERAND (function, 1));
@ -2458,7 +2472,7 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
if (TYPE_PTRMEMFUNC_P (TREE_TYPE (function)))
{
tree fntype, index, e1, delta, delta2, e2, e3, aref, vtbl;
tree fntype, idx, e1, delta, delta2, e2, e3, aref, vtbl;
tree instance;
tree instance_ptr = *instance_ptrptr;
@ -2470,16 +2484,16 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
function = save_expr (function);
fntype = TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (function));
index = save_expr (build_component_ref (function,
index_identifier,
NULL_TREE, 0));
e1 = build (GT_EXPR, boolean_type_node, index,
idx = save_expr (build_component_ref (function,
index_identifier,
NULL_TREE, 0));
e1 = build (GT_EXPR, boolean_type_node, idx,
convert (delta_type_node, integer_zero_node));
delta = convert (ptrdiff_type_node,
build_component_ref (function, delta_identifier, NULL_TREE, 0));
delta2 = DELTA2_FROM_PTRMEMFUNC (function);
/* convert down to the right base, before using the instance. */
/* convert down to the right base, before using the instance. */
instance
= convert_pointer_to_real (TYPE_METHOD_BASETYPE (TREE_TYPE (fntype)),
instance_ptr);
@ -2493,7 +2507,7 @@ get_member_function_from_ptrfunc (instance_ptrptr, function)
vtbl, convert (ptrdiff_type_node, delta2));
vtbl = build_indirect_ref (vtbl, NULL_PTR);
aref = build_array_ref (vtbl, build_binary_op (MINUS_EXPR,
index,
idx,
integer_one_node, 1));
if (! flag_vtable_thunks)
{
@ -2783,7 +2797,7 @@ convert_arguments (return_loc, typelist, values, fndecl, flags)
else if (TREE_CODE (val) == OFFSET_REF
&& TREE_CODE (TREE_TYPE (val)) == METHOD_TYPE)
{
/* This is unclean. Should be handled elsewhere. */
/* This is unclean. Should be handled elsewhere. */
val = build_unary_op (ADDR_EXPR, val, 0);
}
else if (TREE_CODE (val) == OFFSET_REF)
@ -3646,7 +3660,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
tree primop0 = get_narrower (op0, &unsignedp0);
tree primop1 = get_narrower (op1, &unsignedp1);
/* Check for comparison of different enum types. */
/* Check for comparison of different enum types. */
if (flag_int_enum_equivalence == 0
&& TREE_CODE (TREE_TYPE (orig_op0)) == ENUMERAL_TYPE
&& TREE_CODE (TREE_TYPE (orig_op1)) == ENUMERAL_TYPE
@ -3987,7 +4001,7 @@ build_x_unary_op (code, xarg)
return build_min_nt (code, xarg, NULL_TREE);
/* & rec, on incomplete RECORD_TYPEs is the simple opr &, not an
error message. */
error message. */
if (code == ADDR_EXPR
&& ((IS_AGGR_TYPE_CODE (TREE_CODE (TREE_TYPE (xarg)))
&& TYPE_SIZE (TREE_TYPE (xarg)) == NULL_TREE)
@ -4033,6 +4047,7 @@ condition_conversion (expr)
NOCONVERT nonzero suppresses the default promotions
(such as from short to int). */
tree
build_unary_op (code, xarg, noconvert)
enum tree_code code;
@ -4198,7 +4213,7 @@ build_unary_op (code, xarg, noconvert)
modify = build_modify_expr (arg, NOP_EXPR, incremented);
compound = build (COMPOUND_EXPR, TREE_TYPE (arg), modify, value);
/* Eliminate warning about unused result of + or -. */
/* Eliminate warning about unused result of + or -. */
TREE_NO_UNUSED_WARNING (compound) = 1;
return compound;
}
@ -4499,7 +4514,7 @@ unary_complex_lvalue (code, arg)
t = TREE_OPERAND (arg, 1);
if (TREE_CODE (t) == FUNCTION_DECL) /* Check all this code for right semantics. */
if (TREE_CODE (t) == FUNCTION_DECL) /* Check all this code for right semantics. */
return build_unary_op (ADDR_EXPR, t, 0);
if (TREE_CODE (t) == VAR_DECL)
return build_unary_op (ADDR_EXPR, t, 0);
@ -4648,6 +4663,10 @@ mark_addressable (exp)
TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (x)) = 1;
return 1;
case CONSTRUCTOR:
TREE_ADDRESSABLE (x) = 1;
return 1;
default:
return 1;
}
@ -4915,8 +4934,13 @@ build_conditional_expr (ifexp, op1, op2)
a type is done using NOP_EXPRs. */
if (code1 == RECORD_TYPE && TYPE_HAS_CONVERSION (type1))
{
tree tmp = build_pointer_type
(build_type_variant (TREE_TYPE (type2), 1, 1));
/* There are other types besides pointers and records. */
tree tmp;
if (code2 == POINTER_TYPE)
tmp = build_pointer_type
(build_type_variant (TREE_TYPE (type2), 1, 1));
else
tmp = type2;
tmp = build_type_conversion (CONVERT_EXPR, tmp, op1, 0);
if (tmp == NULL_TREE)
{
@ -4928,13 +4952,18 @@ build_conditional_expr (ifexp, op1, op2)
error ("ambiguous pointer conversion");
else
STRIP_NOPS (tmp);
result_type = common_type (type1, TREE_TYPE (tmp));
result_type = common_type (type2, TREE_TYPE (tmp));
op1 = tmp;
}
else if (code2 == RECORD_TYPE && TYPE_HAS_CONVERSION (type2))
{
tree tmp = build_pointer_type
(build_type_variant (TREE_TYPE (type1), 1, 1));
tree tmp;
if (code1 == POINTER_TYPE)
tmp = build_pointer_type
(build_type_variant (TREE_TYPE (type1), 1, 1));
else
tmp = type1;
tmp = build_type_conversion (CONVERT_EXPR, tmp, op2, 0);
if (tmp == NULL_TREE)
{
@ -4976,6 +5005,7 @@ build_conditional_expr (ifexp, op1, op2)
/* Handle overloading of the ',' operator when needed. Otherwise,
this function just builds an expression list. */
tree
build_x_compound_expr (list)
tree list;
@ -5054,6 +5084,12 @@ tree
build_static_cast (type, expr)
tree type, expr;
{
if (current_template_parms)
{
tree t = build_min (STATIC_CAST_EXPR, type, expr);
return t;
}
return build_c_cast (type, expr, 0);
}
@ -5118,6 +5154,12 @@ build_const_cast (type, expr)
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
if (current_template_parms)
{
tree t = build_min (CONST_CAST_EXPR, type, expr);
return t;
}
if (TYPE_PTRMEMFUNC_P (type))
type = TYPE_PTRMEMFUNC_FN_TYPE (type);
if (TYPE_PTRMEMFUNC_P (intype))
@ -5389,8 +5431,8 @@ expand_target_expr (t)
to combine the old value of LHS with RHS to get the new value.
Or else MODIFYCODE is NOP_EXPR meaning do a simple assignment.
C++: If MODIFYCODE is INIT_EXPR, then leave references unbashed.
*/
C++: If MODIFYCODE is INIT_EXPR, then leave references unbashed. */
tree
build_modify_expr (lhs, modifycode, rhs)
tree lhs;
@ -5782,7 +5824,7 @@ build_modify_expr (lhs, modifycode, rhs)
}
else
{
/* Avoid warnings on enum bit fields. */
/* Avoid warnings on enum bit fields. */
if (TREE_CODE (olhstype) == ENUMERAL_TYPE
&& TREE_CODE (lhstype) == INTEGER_TYPE)
{
@ -5858,7 +5900,7 @@ build_modify_expr (lhs, modifycode, rhs)
if (olhstype == TREE_TYPE (result))
return result;
/* Avoid warnings converting integral types back into enums
for enum bit fields. */
for enum bit fields. */
if (TREE_CODE (TREE_TYPE (result)) == INTEGER_TYPE
&& TREE_CODE (olhstype) == ENUMERAL_TYPE)
{
@ -5903,6 +5945,7 @@ language_lvalue_valid (exp)
/* Get difference in deltas for different pointer to member function
types. Return integer_zero_node, if FROM cannot be converted to a
TO type. If FORCE is true, then allow reverse conversions as well. */
static tree
get_delta_difference (from, to, force)
tree from, to;
@ -5980,14 +6023,14 @@ build_ptrmemfunc (type, pfn, force)
tree type, pfn;
int force;
{
tree index = integer_zero_node;
tree idx = integer_zero_node;
tree delta = integer_zero_node;
tree delta2 = integer_zero_node;
tree vfield_offset;
tree npfn;
tree u;
/* Handle multiple conversions of pointer to member functions. */
/* Handle multiple conversions of pointer to member functions. */
if (TYPE_PTRMEMFUNC_P (TREE_TYPE (pfn)))
{
tree ndelta, ndelta2, nindex;
@ -6000,17 +6043,17 @@ build_ptrmemfunc (type, pfn, force)
tree e1, e2, e3;
ndelta = convert (ptrdiff_type_node, build_component_ref (pfn, delta_identifier, NULL_TREE, 0));
ndelta2 = convert (ptrdiff_type_node, DELTA2_FROM_PTRMEMFUNC (pfn));
index = build_component_ref (pfn, index_identifier, NULL_TREE, 0);
idx = build_component_ref (pfn, index_identifier, NULL_TREE, 0);
delta = get_delta_difference (TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (pfn)))),
TYPE_METHOD_BASETYPE (TREE_TYPE (type)),
force);
delta = build_binary_op (PLUS_EXPR, delta, ndelta, 1);
delta2 = build_binary_op (PLUS_EXPR, ndelta2, delta2, 1);
e1 = fold (build (GT_EXPR, boolean_type_node, index, integer_zero_node));
e1 = fold (build (GT_EXPR, boolean_type_node, idx, integer_zero_node));
u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (delta2_identifier, delta2, NULL_TREE));
u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (NULL_TREE, delta,
tree_cons (NULL_TREE, index,
tree_cons (NULL_TREE, idx,
tree_cons (NULL_TREE, u, NULL_TREE))));
e2 = digest_init (TYPE_GET_PTRMEMFUNC_TYPE (type), u, (tree*)0);
@ -6020,7 +6063,7 @@ build_ptrmemfunc (type, pfn, force)
u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (pfn_identifier, npfn, NULL_TREE));
u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (NULL_TREE, delta,
tree_cons (NULL_TREE, index,
tree_cons (NULL_TREE, idx,
tree_cons (NULL_TREE, u, NULL_TREE))));
e3 = digest_init (TYPE_GET_PTRMEMFUNC_TYPE (type), u, (tree*)0);
return build_conditional_expr (e1, e2, e3);
@ -6056,7 +6099,7 @@ build_ptrmemfunc (type, pfn, force)
}
}
/* Handle null pointer to member function conversions. */
/* Handle null pointer to member function conversions. */
if (integer_zerop (pfn))
{
pfn = build_c_cast (type, integer_zero_node, 0);
@ -6077,7 +6120,7 @@ build_ptrmemfunc (type, pfn, force)
pfn = build_addr_func (pfn);
}
/* Allow pointer to member conversions here. */
/* Allow pointer to member conversions here. */
delta = get_delta_difference (TYPE_METHOD_BASETYPE (TREE_TYPE (TREE_TYPE (pfn))),
TYPE_METHOD_BASETYPE (TREE_TYPE (type)),
force);
@ -6097,7 +6140,7 @@ build_ptrmemfunc (type, pfn, force)
if (TREE_CODE (TREE_OPERAND (pfn, 0)) == FUNCTION_DECL
&& DECL_VINDEX (TREE_OPERAND (pfn, 0)))
{
/* Find the offset to the vfield pointer in the object. */
/* Find the offset to the vfield pointer in the object. */
vfield_offset = get_binfo (DECL_CONTEXT (TREE_OPERAND (pfn, 0)),
DECL_CLASS_CONTEXT (TREE_OPERAND (pfn, 0)),
0);
@ -6105,14 +6148,14 @@ build_ptrmemfunc (type, pfn, force)
delta2 = size_binop (PLUS_EXPR, vfield_offset, delta2);
/* Map everything down one to make room for the null pointer to member. */
index = size_binop (PLUS_EXPR,
DECL_VINDEX (TREE_OPERAND (pfn, 0)),
integer_one_node);
idx = size_binop (PLUS_EXPR,
DECL_VINDEX (TREE_OPERAND (pfn, 0)),
integer_one_node);
u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (delta2_identifier, delta2, NULL_TREE));
}
else
{
index = size_binop (MINUS_EXPR, integer_zero_node, integer_one_node);
idx = size_binop (MINUS_EXPR, integer_zero_node, integer_one_node);
if (type == TREE_TYPE (pfn))
{
@ -6128,7 +6171,7 @@ build_ptrmemfunc (type, pfn, force)
}
u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (NULL_TREE, delta,
tree_cons (NULL_TREE, index,
tree_cons (NULL_TREE, idx,
tree_cons (NULL_TREE, u, NULL_TREE))));
return digest_init (TYPE_GET_PTRMEMFUNC_TYPE (type), u, (tree*)0);
}
@ -6573,7 +6616,7 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
else if (ctt == 0)
cp_error ("%s to `%T' from `%T'", errtype, ttl, ttr);
/* compatible pointer to member functions. */
/* compatible pointer to member functions. */
return build_ptrmemfunc (ttl, rhs, 0);
}
else if (codel == ERROR_MARK || coder == ERROR_MARK)
@ -6612,6 +6655,7 @@ convert_for_assignment (type, rhs, errtype, fndecl, parmnum)
exist, an ambiguity exists.
If flags doesn't include LOOKUP_COMPLAIN, don't complain about anything. */
tree
convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
tree exp, type, rhs;
@ -7063,9 +7107,11 @@ c_expand_return (retval)
}
else
{
retval = convert_for_initialization (result, valtype, retval,
LOOKUP_NORMAL,
"return", NULL_TREE, 0);
/* We already did this above, don't do it again. */
if (TREE_CODE (valtype) != REFERENCE_TYPE)
retval = convert_for_initialization (result, valtype, retval,
LOOKUP_NORMAL,
"return", NULL_TREE, 0);
DECL_INITIAL (result) = NULL_TREE;
}
if (retval == error_mark_node)
@ -7186,18 +7232,18 @@ c_expand_start_case (exp)
}
else
{
tree index;
tree idx;
exp = default_conversion (exp);
type = TREE_TYPE (exp);
index = get_unwidened (exp, 0);
idx = get_unwidened (exp, 0);
/* We can't strip a conversion from a signed type to an unsigned,
because if we did, int_fits_type_p would do the wrong thing
when checking case values for being in range,
and it's too hard to do the right thing. */
if (TREE_UNSIGNED (TREE_TYPE (exp))
== TREE_UNSIGNED (TREE_TYPE (index)))
exp = index;
== TREE_UNSIGNED (TREE_TYPE (idx)))
exp = idx;
}
expand_start_case
@ -7209,6 +7255,7 @@ c_expand_start_case (exp)
/* CONSTP remembers whether or not all the intervening pointers in the `to'
type have been const. */
int
comp_ptr_ttypes_real (to, from, constp)
tree to, from;
@ -7242,6 +7289,7 @@ comp_ptr_ttypes_real (to, from, constp)
/* When comparing, say, char ** to char const **, this function takes the
'char *' and 'char const *'. Do not pass non-pointer types to this
function. */
int
comp_ptr_ttypes (to, from)
tree to, from;

View File

@ -44,6 +44,7 @@ extern int sorrycount;
/* Print an error message stemming from an attempt to use
BASETYPE as a base class for TYPE. */
tree
error_not_base_type (basetype, type)
tree basetype, type;
@ -75,6 +76,7 @@ binfo_or_else (parent_or_type, type)
value may not be changed thereafter. Thus, we emit hard errors for these,
rather than just pedwarns. If `SOFT' is 1, then we just pedwarn. (For
example, conversions to references.) */
void
readonly_error (arg, string, soft)
tree arg;
@ -122,6 +124,7 @@ readonly_error (arg, string, soft)
/* Print an error message for invalid use of a type which declares
virtual functions which are not inheritable. */
void
abstract_virtuals_error (decl, type)
tree decl;
@ -167,6 +170,7 @@ abstract_virtuals_error (decl, type)
/* Print an error message for invalid use of a signature type.
Signatures are treated similar to abstract classes here, they
cannot be instantiated. */
void
signature_error (decl, type)
tree decl;
@ -253,6 +257,7 @@ incomplete_type_error (value, type)
}
/* Like error(), but don't call report_error_function(). */
static void
ack (s, v, v2)
char *s;
@ -1182,9 +1187,7 @@ process_init_constructor (type, init, elts)
x.A::ii refers to the ii member of the L part of
of A part of the C object named by X. In this case,
DATUM would be x, and BASETYPE would be A.
*/
DATUM would be x, and BASETYPE would be A. */
tree
build_scoped_ref (datum, basetype)
@ -1242,6 +1245,7 @@ build_scoped_ref (datum, basetype)
performed until an object which does not have the `->' operator
overloaded is found. An error is reported when circular pointer
delegation is detected. */
tree
build_x_arrow (datum)
tree datum;
@ -1320,6 +1324,7 @@ build_x_arrow (datum)
As a special case, if there is only one method by that name,
it is returned. Otherwise we return an expression which other
routines will have to know how to deal with later. */
tree
build_m_component_ref (datum, component)
tree datum, component;
@ -1378,6 +1383,7 @@ build_m_component_ref (datum, component)
}
/* Return a tree node for the expression TYPENAME '(' PARMS ')'. */
tree
build_functional_cast (exp, parms)
tree exp;
@ -1464,6 +1470,7 @@ build_functional_cast (exp, parms)
/* Return the character string for the name that encodes the
enumeral value VALUE in the domain TYPE. */
char *
enum_name_string (value, type)
tree value;
@ -1495,6 +1502,7 @@ enum_name_string (value, type)
TYPE is the type of the switch index expression.
NEW is the new value that we were trying to add.
OLD is the old value that stopped us from adding it. */
void
report_case_error (code, type, new_value, old_value)
int code;

View File

@ -569,6 +569,7 @@ gen_assign(xf, name)
of CLS.
??? Needs to handle nested classes. */
void
GNU_xref_hier(cls, base, pub, virt, frnd)
char *cls;