* Make-lang.in (check-g++-strict-gc): New.
(cp/except.o): Depend on gt-cp-except.h
* except.c: Include gt-cp-except.h.
* config-lang.in (gtfiles): Add cp/except.c.
* decl2.c (mark_used): Adjust constexpr condition, set
function_depth around template instantiation.
* parser.c (cp_parser_lambda_body): Set function_depth.
* semantics.c (maybe_add_lambda_conv_op): Likewise.
From-SVN: r176350
2011-07-15 Jason Merrill <jason@redhat.com>
+ * Make-lang.in (check-g++-strict-gc): New.
+ (cp/except.o): Depend on gt-cp-except.h
+ * except.c: Include gt-cp-except.h.
+ * config-lang.in (gtfiles): Add cp/except.c.
+ * decl2.c (mark_used): Adjust constexpr condition, set
+ function_depth around template instantiation.
+ * parser.c (cp_parser_lambda_body): Set function_depth.
+ * semantics.c (maybe_add_lambda_conv_op): Likewise.
+
PR testsuite/49741
* Make-lang.in (check-c++0x): Use --extra_opts instead of--tool_opts.
check-c++0x:
$(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --extra_opts,-std=gnu++0x" \
TESTSUITEDIR="$(TESTSUITEDIR).c++0x" check-g++
+# Run the testsuite with garbage collection at every opportunity.
+check-g++-strict-gc:
+ $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --extra_opts,--param,ggc-min-heapsize=0,--param,ggc-min-expand=0" \
+ TESTSUITEDIR="$(TESTSUITEDIR).gc" check-g++
check-c++-subtargets : check-g++-subtargets
# List of targets that can use the generic check- rule and its // variant.
lang_checks += check-g++
cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) convert.h \
$(TARGET_H) $(C_PRAGMA_H) gt-cp-rtti.h intl.h
cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
- cp/cfns.h $(TREE_INLINE_H) $(TARGET_H)
+ cp/cfns.h $(TREE_INLINE_H) $(TARGET_H) gt-cp-except.h
cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(TM_P_H)
cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/cp-objcp-common.h \
toplev.h $(TREE_INLINE_H) pointer-set.h gt-cp-pt.h vecprim.h intl.h \
target_libs="target-libstdc++-v3"
-gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.h \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/cp-lang.c"
+gtfiles="\$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.h \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-objc.h \$(srcdir)/c-family/c-lex.c \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-pragma.c \$(srcdir)/cp/class.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/cp-lang.c \$(srcdir)/cp/except.c"
if ((decl_maybe_constant_var_p (decl)
|| (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_DECLARED_CONSTEXPR_P (decl)))
- && !DECL_INITIAL (decl)
&& DECL_LANG_SPECIFIC (decl)
- && DECL_TEMPLATE_INSTANTIATION (decl))
+ && DECL_TEMPLATE_INFO (decl)
+ && !uses_template_parms (DECL_TI_ARGS (decl)))
{
/* Instantiating a function will result in garbage collection. We
must treat this situation as if we were within the body of a
times. Maintaining a stack of active functions is expensive,
and the inliner knows to instantiate any functions it might
need. Therefore, we always try to defer instantiation. */
- instantiate_decl (decl, /*defer_ok=*/true,
- /*expl_inst_class_mem_p=*/false);
+ {
+ ++function_depth;
+ instantiate_decl (decl, /*defer_ok=*/true,
+ /*expl_inst_class_mem_p=*/false);
+ --function_depth;
+ }
}
#include "gt-cp-decl2.h"
return build_tree_list (expr, NULL_TREE);
}
}
+
+#include "gt-cp-except.h"
bool nested = (current_function_decl != NULL_TREE);
if (nested)
push_function_context ();
+ else
+ /* Still increment function_depth so that we don't GC in the
+ middle of an expression. */
+ ++function_depth;
/* Finish the function call operator
- class_specifier
if (nested)
pop_function_context();
+ else
+ --function_depth;
}
/* Statements [gram.stmt.stmt] */
if (nested)
push_function_context ();
+ else
+ /* Still increment function_depth so that we don't GC in the
+ middle of an expression. */
+ ++function_depth;
/* Generate the body of the thunk. */
if (nested)
pop_function_context ();
+ else
+ --function_depth;
}
/* Returns true iff VAL is a lambda-related declaration which should