+Tue Feb 11 13:50:48 1997 Mike Stump <mrs@cygnus.com>
+
+ * new1.cc: Include a declaration for malloc, to avoid warning, and
+ avoid lossing on systems that require one (ones that define malloc
+ in xm.h).
+
+Mon Feb 10 22:51:13 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+
+ * decl2.c (max_tinst_depth): New variable.
+ (lang_decode_option): Parse "-ftemplate-depth-NN" command line
+ option.
+ * pt.c (max_tinst_depth): Variable moved.
+ * lang-options.h: Declare "-ftemplate-depth-NN" command line option
+ as legal.
+
+Fri Feb 7 15:43:34 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * decl.c (xref_basetypes): Allow a base class that depends on
+ template parms to be incomplete.
+
+ * decl2.c (build_expr_from_tree): Support typeid(type).
+ * rtti.c (get_typeid): Support templates.
+ (expand_si_desc, expand_class_desc): Fix string length.
+ (expand_ptr_desc, expand_attr_desc, expand_generic_desc): Likewise.
+
Tue Feb 4 11:28:24 1997 Jason Merrill <jason@yorick.cygnus.com>
* pt.c (unify, case TEMPLATE_CONST_PARM): Use cp_tree_equal.
}
#if 1
/* This code replaces similar code in layout_basetypes. */
- else if (TREE_CODE (basetype) != TEMPLATE_TYPE_PARM
- && TREE_CODE (basetype) != TYPENAME_TYPE
- && TYPE_SIZE (complete_type (basetype)) == NULL_TREE)
+ else if (TYPE_SIZE (complete_type (basetype)) == NULL_TREE
+ && ! (current_template_parms && uses_template_parms (basetype)))
{
cp_error ("base class `%T' has incomplete type", basetype);
continue;
int flag_weak = 1;
+/* Maximum template instantiation depth. Must be at least 17 for ANSI
+ compliance. */
+
+int max_tinst_depth = 17;
+
/* Table of language-dependent -f options.
STRING is the option name. VARIABLE is the address of the variable.
ON_VALUE is the value to store in VARIABLE
flag_implicit_templates = 0;
found = 1;
}
+ else if (!strncmp (p, "template-depth-", 15))
+ {
+ char *endp = p + 15;
+ while (*endp)
+ {
+ if (*endp >= '0' && *endp <= '9')
+ endp++;
+ else
+ {
+ error ("Invalid option `%s'", p - 2);
+ goto template_depth_lose;
+ }
+ }
+ max_tinst_depth = atoi (p + 15);
+ template_depth_lose: ;
+ }
else for (j = 0;
!found && j < sizeof (lang_f_options) / sizeof (lang_f_options[0]);
j++)
}
case TYPEID_EXPR:
+ if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 0))) == 't')
+ return get_typeid (TREE_OPERAND (t, 0));
return build_x_typeid (build_expr_from_tree (TREE_OPERAND (t, 0)));
case VAR_DECL:
@item
@code{volatile} is not implemented in general.
-@cindex pointers to members
-@item
-Pointers to members are only minimally supported, and there are places
-where the grammar doesn't even properly accept them yet.
-
-@cindex multiple inheritance
-@item
-@code{this} will be wrong in virtual members functions defined in a
-virtual base class, when they are overridden in a derived class, when
-called via a non-left most object.
-
-An example would be:
-
-@example
-extern "C" int printf(const char*, ...);
-struct A @{ virtual void f() @{ @} @};
-struct B : virtual A @{ int b; B() : b(0) @{@} void f() @{ b++; @} @};
-struct C : B @{@};
-struct D : B @{@};
-struct E : C, D @{@};
-int main()
-@{
- E e;
- C& c = e; D& d = e;
- c.f(); d.f();
- printf ("C::b = %d, D::b = %d\n", e.C::b, e.D::b);
- return 0;
-@}
-@end example
-
-This will print out 2, 0, instead of 1,1.
-
@end itemize
@node Routines, Implementation Specifics, Limitations of g++, Top
have a way to know if a handler `matches' a thrown exception, and this
is frontend specific.
-The UNSAVE_EXPR tree code has to be migrated to the backend. Exprs such
-as TARGET_EXPRs, WITH_CLEANUP_EXPRs, CALL_EXPRs and RTL_EXPRs have to be
-changed to support unsaving. This is meant to be a complete list.
-SAVE_EXPRs can be unsaved already. expand_decl_cleanup should be
-changed to unsave it's argument, if needed. See
-cp/tree.c:cp_expand_decl_cleanup, unsave_expr_now, unsave_expr, and
-cp/expr.c:cplus_expand_expr(case UNSAVE_EXPR:) for the UNSAVE_EXPR code.
-Now, as to why... because kenner already tripped over the exact same
-problem in Ada, we talked about it, he didn't like any of the solution,
-but yet, didn't like no solution either. He was willing to live with
-the drawbacks of this solution. The drawback is unsave_expr_now. It
-should have a callback into the frontend, to allow the unsaveing of
-frontend special codes. The callback goes in, inplace of the call to
-my_friendly_abort.
-
The stack unwinder is one of the hardest parts to do. It is highly
machine dependent. The form that kenner seems to like was a couple of
macros, that would do the machine dependent grunt work. One preexisting
would do the hard work of fixing up the registers, adjusting the stack
pointer, frame pointer, arg pointer and so on.
-The eh archive (~mrs/eh) might be good reading for understanding the Ada
-perspective, and some of kenners mindset, and a detailed explanation
-(Message-Id: <9308301130.AA10543@@vlsi1.ultra.nyu.edu>) of the concepts
-involved.
-
-Here is a guide to existing backend type code. It is all in
-cp/except.c. Check out do_unwind, and expand_builtin_throw for current
-code on how to figure out what handler matches an exception,
-emit_exception_table for code on emitting the PC range table that is
-built during compilation, expand_exception_blocks for code that emits
-all the handlers at the end of a functions, end_protect to mark the end
-of an exception region, start_protect to mark the start of an exception
-region, lang_interim_eh is the master hook used by the backend into the
-EH backend that now exists in the frontend, and expand_internal_throw to
-raise an exception.
-
@node Free Store, Concept Index, Exception Handling, Top
@section Free Store
-operator new [] adds a magic cookie to the beginning of arrays for which
-the number of elements will be needed by operator delete []. These are
-arrays of objects with destructors and arrays of objects that define
-operator delete [] with the optional size_t argument. This cookie can
-be examined from a program as follows:
+@code{operator new []} adds a magic cookie to the beginning of arrays
+for which the number of elements will be needed by @code{operator delete
+[]}. These are arrays of objects with destructors and arrays of objects
+that define @code{operator delete []} with the optional size_t argument.
+This cookie can be examined from a program as follows:
@example
typedef unsigned long size_t;
"-fno-stats",
"-fstrict-prototype",
"-fno-strict-prototype",
+ "-ftemplate-depth-",
"-fthis-is-variable",
"-fno-this-is-variable",
"-fvtable-thunks",
#include "new"
+extern "C" void *malloc (size_t);
+
typedef void (*vfp)(void);
extern vfp __new_handler;
extern void __default_new_handler (void);
static struct tinst_level *current_tinst_level = 0;
static struct tinst_level *free_tinst_level = 0;
static int tinst_depth = 0;
-int max_tinst_depth = 17;
+extern int max_tinst_depth;
#ifdef GATHER_STATISTICS
int depth_reached = 0;
#endif
error ("template instantiation depth exceeds maximum of %d",
max_tinst_depth);
+ error (" (use -ftemplate-depth-NN to increase the maximum)");
cp_error (" instantiating `%D'", d);
for (; p; p = p->next)
if (type == error_mark_node)
return error_mark_node;
+ if (processing_template_decl)
+ return build_min_nt (TYPEID_EXPR, type);
+
/* If the type of the type-id is a reference type, the result of the
typeid expression refers to a type_info object representing the
referenced type. */
{
tree t, elems, fn;
char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name), name));
+ tree name_string = combine_strings (build_string (strlen (name)+1, name));
type = BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (type), 0));
expand_expr_stmt (get_typeid_1 (type));
#endif
name = build_overload_name (type, 1, 1);
- name_string = combine_strings (build_string (strlen (name), name));
+ name_string = combine_strings (build_string (strlen (name)+1, name));
{
tree arrtype = build_array_type (base_info_type_node, NULL_TREE);
{
tree t, elems, fn;
char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name), name));
+ tree name_string = combine_strings (build_string (strlen (name)+1, name));
type = TREE_TYPE (type);
expand_expr_stmt (get_typeid_1 (type));
{
tree elems, t, fn;
char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name), name));
+ tree name_string = combine_strings (build_string (strlen (name)+1, name));
tree attrval = build_int_2
(TYPE_READONLY (type) | TYPE_VOLATILE (type) * 2, 0);
char *fnname;
{
char *name = build_overload_name (type, 1, 1);
- tree name_string = combine_strings (build_string (strlen (name), name));
+ tree name_string = combine_strings (build_string (strlen (name)+1, name));
tree elems = tree_cons
(NULL_TREE, decay_conversion (tdecl), tree_cons
(NULL_TREE, decay_conversion (name_string), NULL_TREE));