aboutsummaryrefslogtreecommitdiff
path: root/gcc/ggc-tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ggc-tests.c')
-rw-r--r--gcc/ggc-tests.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/gcc/ggc-tests.c b/gcc/ggc-tests.c
index 4ee9550..e83f701 100644
--- a/gcc/ggc-tests.c
+++ b/gcc/ggc-tests.c
@@ -22,21 +22,10 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tree-core.h"
#include "tree.h"
-#include "ggc-internal.h" /* (for ggc_force_collect). */
#include "selftest.h"
#if CHECKING_P
-/* A helper function for writing ggc tests. */
-
-void
-selftest::forcibly_ggc_collect ()
-{
- ggc_force_collect = true;
- ggc_collect ();
- ggc_force_collect = false;
-}
-
/* The various GTY markers must be outside of a namespace to be seen by
gengtype, so we don't put this file within the selftest namespace. */
@@ -58,7 +47,7 @@ test_basic_struct ()
root_test_struct = ggc_cleared_alloc <test_struct> ();
root_test_struct->other = ggc_cleared_alloc <test_struct> ();
- selftest::forcibly_ggc_collect ();
+ ggc_collect (GGC_COLLECT_FORCE);
ASSERT_TRUE (ggc_marked_p (root_test_struct));
ASSERT_TRUE (ggc_marked_p (root_test_struct->other));
@@ -88,7 +77,7 @@ test_length ()
for (int i = 0; i < count; i++)
root_test_of_length->elem[i] = ggc_cleared_alloc <test_of_length> ();
- selftest::forcibly_ggc_collect ();
+ ggc_collect (GGC_COLLECT_FORCE);
ASSERT_TRUE (ggc_marked_p (root_test_of_length));
for (int i = 0; i < count; i++)
@@ -162,7 +151,7 @@ test_union ()
test_struct *referenced_by_other = ggc_cleared_alloc <test_struct> ();
other->m_ptr = referenced_by_other;
- selftest::forcibly_ggc_collect ();
+ ggc_collect (GGC_COLLECT_FORCE);
ASSERT_TRUE (ggc_marked_p (root_test_of_union_1));
ASSERT_TRUE (ggc_marked_p (ts));
@@ -203,7 +192,7 @@ test_finalization ()
test_struct_with_dtor::dtor_call_count = 0;
- selftest::forcibly_ggc_collect ();
+ ggc_collect (GGC_COLLECT_FORCE);
/* Verify that the destructor was run for each instance. */
ASSERT_EQ (count, test_struct_with_dtor::dtor_call_count);
@@ -221,7 +210,7 @@ test_deletable_global ()
test_of_deletable = ggc_cleared_alloc <test_struct> ();
ASSERT_TRUE (test_of_deletable != NULL);
- selftest::forcibly_ggc_collect ();
+ ggc_collect (GGC_COLLECT_FORCE);
ASSERT_EQ (NULL, test_of_deletable);
}
@@ -294,7 +283,7 @@ test_inheritance ()
test_some_subclass_as_base_ptr = new some_subclass ();
test_some_other_subclass_as_base_ptr = new some_other_subclass ();
- selftest::forcibly_ggc_collect ();
+ ggc_collect (GGC_COLLECT_FORCE);
/* Verify that the roots and everything referenced by them got marked
(both for fields in the base class and those in subclasses). */
@@ -373,7 +362,7 @@ test_chain_next ()
tail_node = new_node;
}
- selftest::forcibly_ggc_collect ();
+ ggc_collect (GGC_COLLECT_FORCE);
/* If we got here, we survived. */
@@ -440,7 +429,7 @@ test_user_struct ()
num_calls_to_user_gt_ggc_mx = 0;
- selftest::forcibly_ggc_collect ();
+ ggc_collect (GGC_COLLECT_FORCE);
ASSERT_TRUE (ggc_marked_p (root_user_struct_ptr));
ASSERT_TRUE (ggc_marked_p (referenced));
@@ -458,7 +447,7 @@ test_tree_marking ()
{
dummy_unittesting_tree = build_int_cst (integer_type_node, 1066);
- selftest::forcibly_ggc_collect ();
+ ggc_collect (GGC_COLLECT_FORCE);
ASSERT_TRUE (ggc_marked_p (dummy_unittesting_tree));
}