wingo pushed a commit to branch wip-whippet
in repository guile.

commit f5edbc278b684da978b0c0ab67f1dbead4329ece
Author: Andy Wingo <wi...@igalia.com>
AuthorDate: Thu May 15 15:56:40 2025 +0200

    Add warn proc to bdw
---
 src/bdw.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/bdw.c b/src/bdw.c
index fa06f7256..fc228c15e 100644
--- a/src/bdw.c
+++ b/src/bdw.c
@@ -558,6 +558,11 @@ static void* oom_fn(size_t nbytes) {
   return NULL;
 }
 
+static void warn_fn(char *fmt, GC_word arg) {
+  /* FIXME: Do something better with this.  */
+  fprintf (stderr, fmt, arg);
+}
+
 void gc_heap_set_allocation_failure_handler(struct gc_heap *heap,
                                             void* (*handler)(struct gc_heap*,
                                                              size_t)) {
@@ -616,6 +621,7 @@ int gc_init(const struct gc_options *options, struct 
gc_stack_addr stack_base,
   snprintf(markers, sizeof(markers), "%d", options->common.parallelism);
   setenv("GC_MARKERS", markers, 1);
   GC_init();
+  GC_set_warn_proc (warn_fn);
   size_t current_heap_size = GC_get_heap_size();
   if (options->common.heap_size > current_heap_size)
     GC_expand_hp(options->common.heap_size - current_heap_size);

Reply via email to