]> granicus.if.org Git - gc/commitdiff
Turn on incremental collection in gctest also if DEFAULT_VDB or MANUAL_VDB
authorIvan Maidanski <ivmai@mail.ru>
Mon, 7 May 2018 05:20:57 +0000 (08:20 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 7 May 2018 05:24:43 +0000 (08:24 +0300)
* tests/test.c [DEFAULT_VDB] (TEST_DEFAULT_VDB): Define (before include
gc.h).
* tests/test.c [!GC_DISABLE_INCREMENTAL] (main): Call
GC_enable_incremental also if MANUAL_VDB or TEST_DEFAULT_VDB; print
message about emulating dirty bits with mprotect only if MPROTECT_VDB.

tests/test.c

index e19ac0f7f255a519ab9f037d2d6c4314bebc9055..c389b397040ff3e2e4e068eb8e9ce26336cf5ae5 100644 (file)
 #  define GC_DEBUG
 #endif
 
+#ifdef DEFAULT_VDB /* specified manually (e.g. passed to CFLAGS) */
+# define TEST_DEFAULT_VDB
+#endif
+
 #if defined(CPPCHECK) && defined(GC_PTHREADS) && !defined(_GNU_SOURCE)
 # define _GNU_SOURCE 1
 #endif
@@ -1813,7 +1817,8 @@ void GC_CALLBACK warn_proc(char *msg, GC_word p)
 #   endif
     GC_COND_INIT();
     GC_set_warn_proc(warn_proc);
-#   if defined(MPROTECT_VDB) || defined(PROC_VDB) || defined(GWW_VDB)
+#   if !defined(GC_DISABLE_INCREMENTAL) \
+       && (defined(TEST_DEFAULT_VDB) || !defined(DEFAULT_VDB))
 #     if !defined(MAKE_BACK_GRAPH) && !defined(NO_INCREMENTAL) \
          && !(defined(MPROTECT_VDB) && defined(USE_MUNMAP))
         GC_enable_incremental();
@@ -1827,9 +1832,9 @@ void GC_CALLBACK warn_proc(char *msg, GC_word p)
 #         ifdef MPROTECT_VDB
             GC_printf("Or emulating dirty bits with mprotect/signals\n");
 #         endif
-#       else /* MPROTECT_VDB && !GWW_VDB */
+#       elif defined(MPROTECT_VDB)
           GC_printf("Emulating dirty bits with mprotect/signals\n");
-#       endif
+#       endif /* MPROTECT_VDB && !GWW_VDB */
       }
 #   endif
     set_print_procs();
@@ -2250,15 +2255,18 @@ int main(void)
         }
 #   endif
     n_tests = 0;
-#   if defined(MPROTECT_VDB)
+#   if !defined(GC_DISABLE_INCREMENTAL) \
+       && (defined(TEST_DEFAULT_VDB) || !defined(DEFAULT_VDB))
 #     if !defined(REDIRECT_MALLOC) && !defined(MAKE_BACK_GRAPH) \
          && !defined(USE_PROC_FOR_LIBRARIES) && !defined(NO_INCREMENTAL) \
          && !defined(USE_MUNMAP)
         GC_enable_incremental();
 #     endif
       if (GC_is_incremental_mode()) {
-        GC_printf("Switched to incremental mode\n"
-                  "Emulating dirty bits with mprotect/signals\n");
+        GC_printf("Switched to incremental mode\n");
+#       ifdef MPROTECT_VDB
+          GC_printf("Emulating dirty bits with mprotect/signals\n");
+#       endif
       }
 #   endif
     GC_set_min_bytes_allocd(1);