Commit 92a12fbc by Andrew Pinski Committed by Andrew Pinski

re PR c++/5050 (template instantiation depth exceeds/maybe recursion problem)

2003-12-22  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c++/5050
        * tree.c (cp_start_inlining): Remove.
        (cp_end_inlining): Remove.
        * cp-lang.c (LANG_HOOKS_TREE_INLINING_START_INLINING): Do not define.
        (LANG_HOOKS_TREE_INLINING_END_INLINING): Do not define.
        * cp-tree.h (cp_start_inlining): Do not declare.
        (cp_end_inlining): Do not declare.

        PR c++/5050
	* g++.dg/template/recurse1.C: New test.

From-SVN: r74947
parent 70a84160
2003-12-22 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/5050
* tree.c (cp_start_inlining): Remove.
(cp_end_inlining): Remove.
* cp-lang.c (LANG_HOOKS_TREE_INLINING_START_INLINING): Do not define.
(LANG_HOOKS_TREE_INLINING_END_INLINING): Do not define.
* cp-tree.h (cp_start_inlining): Do not declare.
(cp_end_inlining): Do not declare.
2003-12-22 Mark Mitchell <mark@codesourcery.com> 2003-12-22 Mark Mitchell <mark@codesourcery.com>
PR c++/12479 PR c++/12479
......
...@@ -156,10 +156,6 @@ static void cxx_initialize_diagnostics (diagnostic_context *); ...@@ -156,10 +156,6 @@ static void cxx_initialize_diagnostics (diagnostic_context *);
#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P anon_aggr_type_p #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P anon_aggr_type_p
#undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P #undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P
#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P cp_var_mod_type_p #define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P cp_var_mod_type_p
#undef LANG_HOOKS_TREE_INLINING_START_INLINING
#define LANG_HOOKS_TREE_INLINING_START_INLINING cp_start_inlining
#undef LANG_HOOKS_TREE_INLINING_END_INLINING
#define LANG_HOOKS_TREE_INLINING_END_INLINING cp_end_inlining
#undef LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS #undef LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS
#define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS c_estimate_num_insns #define LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS c_estimate_num_insns
#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
......
...@@ -4169,8 +4169,6 @@ extern int cp_is_overload_p (tree); ...@@ -4169,8 +4169,6 @@ extern int cp_is_overload_p (tree);
extern int cp_auto_var_in_fn_p (tree,tree); extern int cp_auto_var_in_fn_p (tree,tree);
extern tree cp_copy_res_decl_for_inlining (tree, tree, tree, void*, extern tree cp_copy_res_decl_for_inlining (tree, tree, tree, void*,
int*, tree); int*, tree);
extern int cp_start_inlining (tree);
extern void cp_end_inlining (tree);
/* in typeck.c */ /* in typeck.c */
extern int string_conv_p (tree, tree, int); extern int string_conv_p (tree, tree, int);
......
...@@ -2194,28 +2194,6 @@ cp_copy_res_decl_for_inlining (tree result, ...@@ -2194,28 +2194,6 @@ cp_copy_res_decl_for_inlining (tree result,
return var; return var;
} }
/* Record that we're about to start inlining FN, and return nonzero if
that's OK. Used for lang_hooks.tree_inlining.start_inlining. */
int
cp_start_inlining (tree fn)
{
if (DECL_TEMPLATE_INSTANTIATION (fn))
return push_tinst_level (fn);
else
return 1;
}
/* Record that we're done inlining FN. Used for
lang_hooks.tree_inlining.end_inlining. */
void
cp_end_inlining (tree fn ATTRIBUTE_UNUSED )
{
if (DECL_TEMPLATE_INSTANTIATION (fn))
pop_tinst_level ();
}
/* Initialize tree.c. */ /* Initialize tree.c. */
void void
......
2003-12-22 Andrew Pinski <pinskia@physics.uc.edu>
* g++.dg/template/recurse1.C: New test
2003-12-22 Mark Mitchell <mark@codesourcery.com> 2003-12-22 Mark Mitchell <mark@codesourcery.com>
PR c++/12479 PR c++/12479
......
// PR c++/5050
// Origin: georg.wild@gmx.de
// Reduced by: tbagot@bluearc.com and Nathanael C. Nerode <neroden@twcny.rr.com>
// Test for that excessive template recursion does not occur
// because of optimization.
// { dg-options "-ftemplate-depth-1 -O" }
struct ostream {
template<class T> ostream& foo( const T & )
{ return *this; }
};
void foo() {
ostream os;
(os.foo(1)).foo(2);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment