diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-07-10 14:21:11 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-07-10 14:21:11 +0000 |
commit | bb118b7356439a930be13962ced5f36aab9f74bf (patch) | |
tree | 5a9fad8dd6dc7f236bfc8e6b22c04cad0b837928 /gc/tests/test_cpp.cc | |
parent | delete old ftp site (diff) | |
download | w3m-bb118b7356439a930be13962ced5f36aab9f74bf.tar.gz w3m-bb118b7356439a930be13962ced5f36aab9f74bf.zip |
import gc6.1alpha5
Diffstat (limited to '')
-rw-r--r-- | gc/tests/test_cpp.cc | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/gc/tests/test_cpp.cc b/gc/tests/test_cpp.cc index 75fd366..d6032b8 100644 --- a/gc/tests/test_cpp.cc +++ b/gc/tests/test_cpp.cc @@ -28,7 +28,10 @@ few minutes to complete. #include <stdio.h> #include <stdlib.h> #include <string.h> -#ifdef __GNUC__ +#define USE_STD_ALLOCATOR +#ifdef USE_STD_ALLOCATOR +# include "gc_allocator.h" +#elif __GNUC__ # include "new_gc_alloc.h" #else # include "gc_alloc.h" @@ -195,15 +198,20 @@ int APIENTRY WinMain( argc = sizeof(argv_)/sizeof(argv_[0]); // commandline # endif int i, iters, n; -# if !defined(MACOS) +# ifdef USE_STD_ALLOCATOR + int *x = gc_allocator<int>().allocate(1); + int **xptr = traceable_allocator<int *>().allocate(1); +# else # ifdef __GNUC__ - int *x = (int *)gc_alloc::allocate(sizeof(int)); + int *x = (int *)gc_alloc::allocate(sizeof(int)); # else - int *x = (int *)alloc::allocate(sizeof(int)); + int *x = (int *)alloc::allocate(sizeof(int)); # endif - - *x = 29; - x -= 3; +# endif + *x = 29; +# ifdef USE_STD_ALLOCATOR + *xptr = x; + x = 0; # endif if (argc != 2 || (0 >= (n = atoi( argv[ 1 ] )))) { GC_printf0( "usage: test_cpp number-of-iterations\n" ); @@ -268,9 +276,10 @@ int APIENTRY WinMain( D::Test(); F::Test();} -# if !defined(__GNUC__) && !defined(MACOS) - my_assert (29 == x[3]); +# ifdef USE_STD_ALLOCATOR + x = *xptr; # endif + my_assert (29 == x[0]); GC_printf0( "The test appears to have succeeded.\n" ); return( 0 );} |