Re: [PATCH 1/7] cex: dervation reference counting
Akim Demaille <[email protected]>
| Newsgroups | gmane.comp.parsers.bison.patches |
|---|---|
| Message-ID | <[email protected]> |
FTR, I'm installing this diff within this patch, because otherwise it doesn't compile cleanly on my machine.
/Users/akim/src/gnu/bison/src/parse-simulation.c: In function 'parser_pop':
/Users/akim/src/gnu/bison/src/parse-simulation.c:335:27: error: cast between incompatible function types from 'struct gl_list_node_impl * (*)(struct gl_list_impl *, const void *)' to 'void (*)(struct gl_list_impl *, void *)' [-Werror=cast-function-type]
335 | (chunk_append_fn)gl_list_add_last);
| ^
cc1: all warnings being treated as errors
diff --git a/src/parse-simulation.c b/src/parse-simulation.c
index 5648bd5a..2be02834 100644
--- a/src/parse-simulation.c
+++ b/src/parse-simulation.c
@@ -265,7 +265,15 @@ parse_state_completed_steps (const parse_state *ps, int *shifts, int *production
*shifts = root_ps->state_items.total_size - count;
}
-typedef void (*chunk_append_fn) (gl_list_t, void *);
+typedef void (*chunk_append_fn) (gl_list_t, const void *);
+
+// A version of gl_list_add_last which has the chunk_append_fn
+// signature.
+void list_add_last (gl_list_t list, const void *elt)
+{
+ gl_list_add_last (list, elt);
+}
+
// takes an array of n gl_lists and flattens them into two list
// based off of the index split
static void
@@ -332,7 +340,7 @@ parser_pop (parse_state *ps, int deriv_index,
ret->derivs.contents, popped_derivs
};
list_flatten_and_split (chunks, ret_chunks, si_index, 2,
- (chunk_append_fn)gl_list_add_last);
+ list_add_last);
list_flatten_and_split (chunks + 2, ret_chunks + 2, deriv_index, 2,
(chunk_append_fn)derivation_list_append);
size_t s_size = gl_list_size (ret->state_items.contents);