summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-08-04 09:58:04 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-08-05 08:27:34 +0300
commit2a6cee2a42c5a2fa69dc52b18b92420ee9bf61da (patch)
treeee7e33b581b308c3681dbbf985047a413920afd5
parente717f1191ba099d46a4eb0c56954b1b2e5333d5b (diff)
downloadbdwgc-2a6cee2a42c5a2fa69dc52b18b92420ee9bf61da.tar.gz
Fix 'passing arg 1 of GC_apply_to_all_blocks from incompatible type' error
(fix of commit e717f1191) Issue #460 (bdwgc). * backgraph.c [MAKE_BACK_GRAPH] (per_object_helper): Add GC_CALLBACK modifier; change 2nd argument type from word to GC_word. * checksums.c [CHECKSUMS] (GC_add_block): Likewise. * dbg_mlc.c [!SHORT_DBG_HDRS] (GC_check_heap_block): Likewise. * mark.c (clear_marks_for_block): Likewise. * misc.c (block_add_size): Likewise. * reclaim.c (GC_reclaim_block, GC_print_block_descr, GC_do_enumerate_reachable_objects): Likewise. * checksums.c [CHECKSUMS] (GC_check_blocks): Remove unnecessary cast of zero to word. * include/gc/gc_mark.h (GC_apply_to_all_blocks): Add GC_ATTR_NONNULL(1).
-rw-r--r--backgraph.c2
-rw-r--r--checksums.c5
-rw-r--r--dbg_mlc.c3
-rw-r--r--include/gc/gc_mark.h2
-rw-r--r--mark.c3
-rw-r--r--misc.c2
-rw-r--r--reclaim.c10
7 files changed, 16 insertions, 11 deletions
diff --git a/backgraph.c b/backgraph.c
index 1ed10f07..69b71218 100644
--- a/backgraph.c
+++ b/backgraph.c
@@ -283,7 +283,7 @@ static void add_edge(ptr_t p, ptr_t q)
typedef void (*per_object_func)(ptr_t p, size_t n_bytes, word gc_descr);
-static void per_object_helper(struct hblk *h, word fn)
+static GC_CALLBACK void per_object_helper(struct hblk *h, GC_word fn)
{
hdr * hhdr = HDR(h);
size_t sz = (size_t)hhdr->hb_sz;
diff --git a/checksums.c b/checksums.c
index 95601854..f6188c75 100644
--- a/checksums.c
+++ b/checksums.c
@@ -114,7 +114,8 @@ STATIC void GC_update_check_page(struct hblk *h, int index)
word GC_bytes_in_used_blocks = 0;
-STATIC void GC_add_block(struct hblk *h, word dummy GC_ATTR_UNUSED)
+STATIC void GC_CALLBACK GC_add_block(struct hblk *h,
+ GC_word dummy GC_ATTR_UNUSED)
{
hdr * hhdr = HDR(h);
@@ -126,7 +127,7 @@ STATIC void GC_check_blocks(void)
word bytes_in_free_blocks = GC_large_free_bytes;
GC_bytes_in_used_blocks = 0;
- GC_apply_to_all_blocks(GC_add_block, (word)0);
+ GC_apply_to_all_blocks(GC_add_block, 0);
GC_COND_LOG_PRINTF("GC_bytes_in_used_blocks= %lu,"
" bytes_in_free_blocks= %lu, heapsize= %lu\n",
(unsigned long)GC_bytes_in_used_blocks,
diff --git a/dbg_mlc.c b/dbg_mlc.c
index 4595a7ac..12821820 100644
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -983,7 +983,8 @@ STATIC void GC_print_all_smashed_proc(void)
/* Check all marked objects in the given block for validity */
/* Avoid GC_apply_to_each_object for performance reasons. */
-STATIC void GC_check_heap_block(struct hblk *hbp, word dummy GC_ATTR_UNUSED)
+STATIC void GC_CALLBACK GC_check_heap_block(struct hblk *hbp,
+ GC_word dummy GC_ATTR_UNUSED)
{
struct hblkhdr * hhdr = HDR(hbp);
word sz = hhdr -> hb_sz;
diff --git a/include/gc/gc_mark.h b/include/gc/gc_mark.h
index 53380f61..ed7b75da 100644
--- a/include/gc/gc_mark.h
+++ b/include/gc/gc_mark.h
@@ -188,7 +188,7 @@ typedef void (GC_CALLBACK *GC_walk_hblk_fn)(struct GC_hblk_s *,
/* of the caller to avoid data race during the function execution (e.g. */
/* by holding the allocation lock). */
GC_API void GC_CALL GC_apply_to_all_blocks(GC_walk_hblk_fn,
- GC_word /* client_data */);
+ GC_word /* client_data */) GC_ATTR_NONNULL(1);
/* And some routines to support creation of new "kinds", e.g. with */
/* custom mark procedures, by language runtimes. */
diff --git a/mark.c b/mark.c
index 3d806117..93b9a46d 100644
--- a/mark.c
+++ b/mark.c
@@ -166,7 +166,8 @@ GC_INNER void GC_set_hdr_marks(hdr *hhdr)
}
/* Clear all mark bits associated with block h. */
-static void clear_marks_for_block(struct hblk *h, word dummy GC_ATTR_UNUSED)
+static void GC_CALLBACK clear_marks_for_block(struct hblk *h,
+ GC_word dummy GC_ATTR_UNUSED)
{
hdr * hhdr = HDR(h);
diff --git a/misc.c b/misc.c
index 6ccc196f..46e65088 100644
--- a/misc.c
+++ b/misc.c
@@ -2347,7 +2347,7 @@ GC_API void * GC_CALL GC_do_blocking(GC_fn_type fn, void * client_data)
}
#endif /* !NO_DEBUGGING */
-static void block_add_size(struct hblk *h, word pbytes)
+static void GC_CALLBACK block_add_size(struct hblk *h, GC_word pbytes)
{
hdr *hhdr = HDR(h);
*(word *)pbytes += (WORDS_TO_BYTES(hhdr->hb_sz) + HBLKSIZE-1)
diff --git a/reclaim.c b/reclaim.c
index 84b1ba11..b847fdaf 100644
--- a/reclaim.c
+++ b/reclaim.c
@@ -385,7 +385,8 @@ STATIC void GC_reclaim_small_nonempty_block(struct hblk *hbp, word sz,
* If report_if_found is TRUE, then process any block immediately, and
* simply report free objects; do not actually reclaim them.
*/
-STATIC void GC_reclaim_block(struct hblk *hbp, word report_if_found)
+STATIC void GC_CALLBACK GC_reclaim_block(struct hblk *hbp,
+ GC_word report_if_found)
{
hdr * hhdr = HDR(hbp);
word sz; /* size of objects in current block */
@@ -560,8 +561,8 @@ unsigned GC_n_set_marks(hdr *hhdr)
#endif /* !USE_MARK_BYTES */
-STATIC void GC_print_block_descr(struct hblk *h,
- word /* struct PrintStats */ raw_ps)
+STATIC void GC_CALLBACK GC_print_block_descr(struct hblk *h,
+ GC_word /* struct PrintStats */ raw_ps)
{
hdr *hhdr = HDR(h);
word sz = hhdr -> hb_sz;
@@ -814,7 +815,8 @@ struct enumerate_reachable_s {
void *client_data;
};
-STATIC void GC_do_enumerate_reachable_objects(struct hblk *hbp, word ped)
+STATIC void GC_CALLBACK GC_do_enumerate_reachable_objects(struct hblk *hbp,
+ GC_word ped)
{
struct hblkhdr *hhdr = HDR(hbp);
size_t sz = (size_t)hhdr->hb_sz;