Skip to content

Commit

Permalink
Conditionally compile BUFFERED_FINALIZE test
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-hughes committed Apr 17, 2024
1 parent f02d754 commit 27bf9af
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions tests/gctest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1667,29 +1667,31 @@ static void run_one_test(void)
CHECK_OUT_OF_MEMORY(p);
AO_fetch_and_add1(&collectable_count);
}
{
size_t i;
void *p;

GC_init();
# ifdef BUFFERED_FINALIZATION
{
size_t i;
void *p;

p = GC_buffered_finalize_malloc(17);
CHECK_OUT_OF_MEMORY(p);
AO_fetch_and_add1(&collectable_count);
GC_init();

for (i = sizeof(GC_word); i <= HBLKSIZE * 4; i *= 2) {
p = checkOOM(GC_buffered_finalize_memalign(i, 17));
p = GC_buffered_finalize_malloc(17);
CHECK_OUT_OF_MEMORY(p);
AO_fetch_and_add1(&collectable_count);
if ((GC_word)p % i != 0 || *(int *)p != 0) {
GC_printf("GC_buffered_finalize_posix_memalign(%u,17) produced incorrect result: %p\n",
(unsigned)i, p);
FAIL;

for (i = sizeof(GC_word); i <= HBLKSIZE * 4; i *= 2) {
p = checkOOM(GC_buffered_finalize_memalign(i, 17));
AO_fetch_and_add1(&collectable_count);
if ((GC_word)p % i != 0 || *(int *)p != 0) {
GC_printf("GC_buffered_finalize_posix_memalign(%u,17) produced incorrect result: %p\n",
(unsigned)i, p);
FAIL;
}
}
}
(void)GC_buffered_finalize_posix_memalign(&p, 64, 1);
CHECK_OUT_OF_MEMORY(p);
AO_fetch_and_add1(&collectable_count);
}
(void)GC_buffered_finalize_posix_memalign(&p, 64, 1);
CHECK_OUT_OF_MEMORY(p);
AO_fetch_and_add1(&collectable_count);
}
# endif
# ifndef GC_NO_VALLOC
{
void *p = checkOOM(GC_valloc(78));
Expand Down

0 comments on commit 27bf9af

Please sign in to comment.