Use accessors instead of symbols deprecated in libgc 7.3.
authorLudovic Courtès <ludo@gnu.org>
Fri, 1 Mar 2013 16:36:21 +0000 (17:36 +0100)
committerLudovic Courtès <ludo@gnu.org>
Fri, 1 Mar 2013 16:50:05 +0000 (17:50 +0100)
* configure.ac: Check for `GC_set_all_interior_pointers',
  `GC_get_gc_no', and `GC_set_java_finalization'.
* libguile/gc.c (scm_gc_stats)[HAVE_GC_GET_GC_NO]: Use `GC_get_gc_no'.
  (scm_storage_prehistory)[HAVE_GC_SET_ALL_INTERIOR_POINTERS]: Use
  `GC_set_all_interior_pointers'.
* libguile/guardians.c (scm_init_guardians)[HAVE_GC_SET_JAVA_FINALIZATION]:
  Use `GC_set_java_finalization'.

configure.ac
libguile/gc.c
libguile/guardians.c

index 8848339..cbad0a1 100644 (file)
@@ -1229,7 +1229,12 @@ save_LIBS="$LIBS"
 LIBS="$BDW_GC_LIBS $LIBS"
 CFLAGS="$BDW_GC_CFLAGS $CFLAGS"
 
-AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask GC_set_start_callback GC_get_heap_usage_safe GC_get_free_space_divisor GC_gcollect_and_unmap GC_get_unmapped_bytes GC_set_finalizer_notifier GC_set_finalize_on_demand])
+AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit  \
+  GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask       \
+  GC_set_start_callback GC_get_heap_usage_safe                         \
+  GC_get_free_space_divisor GC_gcollect_and_unmap GC_get_unmapped_bytes        \
+  GC_set_finalizer_notifier GC_set_finalize_on_demand                  \
+  GC_set_all_interior_pointers GC_get_gc_no GC_set_java_finalization])
 
 # Though the `GC_do_blocking ()' symbol is present in GC 7.1, it is not
 # declared, and has a different type (returning void instead of
index 06b5044..6e459c3 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006,
+ *   2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -317,7 +318,13 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0,
 
   GC_get_heap_usage_safe (&heap_size, &free_bytes, &unmapped_bytes,
                           &bytes_since_gc, &total_bytes);
+#ifdef HAVE_GC_GET_GC_NO
+  /* This function was added in 7.2alpha2 (June 2009).  */
+  gc_times = GC_get_gc_no ();
+#else
+  /* This symbol is deprecated as of 7.3.  */
   gc_times = GC_gc_no;
+#endif
 
   answer =
     scm_list_n (scm_cons (sym_gc_time_taken, scm_from_long (gc_time_taken)),
@@ -629,7 +636,14 @@ GC_set_finalize_on_demand (int foo)
 void
 scm_storage_prehistory ()
 {
+#ifdef HAVE_GC_SET_ALL_INTERIOR_POINTERS
+  /* This function was added in 7.2alpha2 (June 2009).  */
+  GC_set_all_interior_pointers (0);
+#else
+  /* This symbol is deprecated in 7.3.  */
   GC_all_interior_pointers = 0;
+#endif
+
   free_space_divisor = scm_getenv_int ("GC_FREE_SPACE_DIVISOR", 3);
   minimum_free_space_divisor = free_space_divisor;
   target_free_space_divisor = free_space_divisor;
index 022f54e..6ba8c0b 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (C) 1998,1999,2000,2001, 2006, 2008, 2009, 2011,
- *   2012 Free Software Foundation, Inc.
+ *   2012, 2013 Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -351,7 +351,13 @@ void
 scm_init_guardians ()
 {
   /* We use unordered finalization `a la Java.  */
+#ifdef HAVE_GC_SET_JAVA_FINALIZATION
+  /* This function was added in 7.2alpha2 (June 2009).  */
+  GC_set_java_finalization (1);
+#else
+  /* This symbol is deprecated as of 7.3.  */
   GC_java_finalization = 1;
+#endif
 
   tc16_guardian = scm_make_smob_type ("guardian", 0);