be0959d219
PR target/42811 * tests/staticrootstest.c: New test source file. * tests/staticrootslib.c: New test library source file. * Makefile.am (test_ldadd): New variable. (gctest_LDADD): Use it. (TESTS): Add leaktest, middletest and staticrootstest. (check_PROGRAMS): Likewise. (leaktest_SOURCES): New libtool variable definition. (leaktest_LDADD): Likewise. (leaktest_LDFLAGS): Likewise. (leaktest_LINK): Likewise. (middletest_SOURCES): Likewise. (middletest_LDADD): Likewise. (middletest_LDFLAGS): Likewise. (middletest_LINK): Likewise. (staticrootstest_SOURCES): Likewise. (staticrootstest_LDADD): Likewise. (staticrootstest_LDFLAGS): Likewise. (staticrootstest_LINK): Likewise. (check_LTLIBRARIES): Likewise. (libstaticrootslib_la_SOURCES): Likewise. (libstaticrootslib_la_LIBADD): Likewise. (libstaticrootslib_la_LDFLAGS): Likewise. (libstaticrootslib_la_DEPENDENCIES): Likewise. * Makefile.in: Regenerate. From-SVN: r159115
34 lines
562 B
C
34 lines
562 B
C
#include <stdio.h>
|
|
|
|
#ifndef GC_DEBUG
|
|
# define GC_DEBUG
|
|
#endif
|
|
|
|
#include "gc.h"
|
|
|
|
struct treenode {
|
|
struct treenode *x;
|
|
struct treenode *y;
|
|
} * root[10];
|
|
|
|
struct treenode * libsrl_mktree(int i)
|
|
{
|
|
struct treenode * r = GC_MALLOC(sizeof(struct treenode));
|
|
if (0 == i) return 0;
|
|
if (1 == i) r = GC_MALLOC_ATOMIC(sizeof(struct treenode));
|
|
r -> x = libsrl_mktree(i-1);
|
|
r -> y = libsrl_mktree(i-1);
|
|
return r;
|
|
}
|
|
|
|
void * libsrl_init(void)
|
|
{
|
|
GC_INIT();
|
|
return GC_MALLOC(sizeof(struct treenode));
|
|
}
|
|
|
|
void * libsrl_collect (void)
|
|
{
|
|
GC_gcollect();
|
|
}
|