]> granicus.if.org Git - gc/commitdiff
test_cpp: Recognize new macro to choose between GC allocator headers
authorIvan Maidanski <ivmai@mail.ru>
Wed, 28 Dec 2011 10:19:28 +0000 (14:19 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 28 Dec 2011 10:38:05 +0000 (14:38 +0400)
* tests/test_cpp.cc (USE_STD_ALLOCATOR): Replace with
DONT_USE_STD_ALLOCATOR; remove explicit macro definition; add comment.
* tests/test_cpp.cc (main): Use DONT_USE_STD_ALLOCATOR macro instead
of USE_STD_ALLOCATOR.

tests/test_cpp.cc

index fd2982b5f76169c6b91b0ca396d44acd618b3607..f13937293170feaaea4fbabb6af5c9c1af739462 100644 (file)
@@ -34,12 +34,11 @@ few minutes to complete.
 #include <stdlib.h>
 #include <string.h>
 
-#define USE_STD_ALLOCATOR
-
-#ifdef USE_STD_ALLOCATOR
-#   include "gc_allocator.h"
+#ifndef DONT_USE_STD_ALLOCATOR
+# include "gc_allocator.h"
 #else
-#   include "new_gc_alloc.h"
+  /* Note: This works only for ancient STL versions.    */
+# include "new_gc_alloc.h"
 #endif
 
 extern "C" {
@@ -209,7 +208,7 @@ int APIENTRY WinMain(
     GC_INIT();
 
     int i, iters, n;
-#   ifdef USE_STD_ALLOCATOR
+#   ifndef DONT_USE_STD_ALLOCATOR
       int *x = gc_allocator<int>().allocate(1);
       int *xio;
       xio = gc_allocator_ignore_off_page<int>().allocate(1);
@@ -218,7 +217,7 @@ int APIENTRY WinMain(
       int *x = (int *)gc_alloc::allocate(sizeof(int));
 #   endif
     *x = 29;
-#   ifdef USE_STD_ALLOCATOR
+#   ifndef DONT_USE_STD_ALLOCATOR
       *xptr = x;
       x = 0;
 #   endif
@@ -287,7 +286,7 @@ int APIENTRY WinMain(
         D::Test();
         F::Test();}
 
-#   ifdef USE_STD_ALLOCATOR
+#   ifndef DONT_USE_STD_ALLOCATOR
       x = *xptr;
 #   endif
     my_assert (29 == x[0]);