From ae03b1678514ae323a9355ffa62fde96a85ab2a9 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 3 Jun 2020 08:26:23 +0200 Subject: [PATCH] warnings: fix -Wmissing-prototypes issues * src/counterexample.c, src/lssi.c, src/parse-simulation.c, * src/state-item.c: Here. --- src/counterexample.c | 32 ++++++++++++++++---------------- src/lssi.c | 6 +++--- src/parse-simulation.c | 8 +++++--- src/state-item.c | 4 ++-- 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/counterexample.c b/src/counterexample.c index 0f08f652..1eb83451 100644 --- a/src/counterexample.c +++ b/src/counterexample.c @@ -60,7 +60,7 @@ #define CUMULATIVE_TIME_LIMIT 120.0f // This is the fastest way to get the tail node from the gl_list API. -gl_list_node_t +static gl_list_node_t list_get_end (gl_list_t list) { gl_list_node_t sentinel = gl_list_add_last (list, NULL); @@ -77,7 +77,7 @@ typedef struct bool timeout; } counterexample; -counterexample * +static counterexample * new_counterexample (derivation *d1, derivation *d2, bool u, bool t) { @@ -89,7 +89,7 @@ new_counterexample (derivation *d1, derivation *d2, return res; } -void +static void free_counterexample (counterexample *cex) { derivation_free (cex->d1); @@ -97,7 +97,7 @@ free_counterexample (counterexample *cex) free (cex); } -void +static void print_counterexample (counterexample *cex) { FILE *out = stderr; @@ -133,7 +133,7 @@ typedef struct si_bfs_node int reference_count; } si_bfs_node; -si_bfs_node * +static si_bfs_node * si_bfs_new (state_item_number si, si_bfs_node *parent) { si_bfs_node *res = xcalloc (1, sizeof (si_bfs_node)); @@ -154,7 +154,7 @@ si_bfs_contains (const si_bfs_node *n, state_item_number sin) return false; } -void +static void si_bfs_free (si_bfs_node *n) { if (n == NULL) @@ -384,11 +384,10 @@ complete_diverging_example (symbol_number conflict_sym, return res; } -/* iterates backwards through the shifts of the path in the - reduce conflict, and finds a path of shifts from the shift - conflict that goes through the same states. - */ -gl_list_t +/* Iterate backwards through the shifts of the path in the reduce + conflict, and find a path of shifts from the shift conflict that + goes through the same states. */ +static gl_list_t nonunifying_shift_path (gl_list_t reduce_path, state_item *shift_conflict) { gl_list_node_t tmp = gl_list_add_last (reduce_path, NULL); @@ -483,7 +482,7 @@ nonunifying_shift_path (gl_list_t reduce_path, state_item *shift_conflict) * Construct a nonunifying counterexample from the shortest * lookahead-sensitive path. */ -counterexample * +static counterexample * example_from_path (bool shift_reduce, state_item_number itm2, gl_list_t shortest_path, symbol_number next_sym) @@ -604,7 +603,7 @@ ss_set_parse_state (search_state *ss, int idx, parse_state *ps) * which has its parse states unified at the beginning * but not the end of the example. */ -counterexample * +static counterexample * complete_diverging_examples(search_state *ss, symbol_number next_sym) { @@ -630,7 +629,8 @@ typedef struct gl_list_t states; int complexity; } search_state_bundle; -void + +static void ssb_free (search_state_bundle *ssb) { gl_list_free (ssb->states); @@ -797,7 +797,7 @@ reduction_step (search_state *ss, const item_number *conflict_item, * the given subsequent next symbol on each path. If a reverse transition * cannot be made on both states, possible reverse productions are prepended */ -void +static void search_state_prepend (search_state *ss, symbol_number sym, bitset guide) { (void) sym; // FIXME: Unused. @@ -1042,7 +1042,7 @@ generate_next_states (search_state *ss, state_item *conflict1, * we are at and gives the appropriate counterexample * type based off of time constraints. */ -counterexample * +static counterexample * unifying_example (state_item_number itm1, state_item_number itm2, bool shift_reduce, diff --git a/src/lssi.c b/src/lssi.c index 2af399b5..b3512f0f 100644 --- a/src/lssi.c +++ b/src/lssi.c @@ -38,7 +38,7 @@ typedef struct lssi bool free_lookahead; } lssi; -lssi * +static lssi * new_lssi (state_item_number si, lssi *p, bitset l, bool free_l) { lssi *res = xmalloc (sizeof *res); @@ -49,7 +49,7 @@ new_lssi (state_item_number si, lssi *p, bitset l, bool free_l) return res; } -void +static void lssi_free (lssi *sn) { if (sn == NULL) @@ -117,7 +117,7 @@ lssi_print (lssi *l) * Compute the set of state-items that can reach the given conflict item via * a combination of transitions or production steps. */ -bitset +static bitset eligible_state_items (state_item *target) { bitset result = bitset_create (nstate_items, BITSET_FIXED); diff --git a/src/parse-simulation.c b/src/parse-simulation.c index d22502ed..e439360d 100644 --- a/src/parse-simulation.c +++ b/src/parse-simulation.c @@ -272,7 +272,8 @@ 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) +static void +list_add_last (gl_list_t list, const void *elt) { gl_list_add_last (list, elt); } @@ -316,7 +317,8 @@ parse_state_list_new (void) true); } -void parse_state_list_append (parse_state_list pl, parse_state *ps) +static void +parse_state_list_append (parse_state_list pl, parse_state *ps) { parse_state_retain (ps); gl_list_add_last (pl, ps); @@ -407,7 +409,7 @@ parse_state_lists (parse_state *ps, gl_list_t *sitems, * Compute the parse states that result from taking a transition on * nullable symbols whenever possible from the given state_item. */ -void +static void nullable_closure (parse_state *ps, state_item *si, parse_state_list state_list) { parse_state *current_ps = ps; diff --git a/src/state-item.c b/src/state-item.c index 691ce015..b3e8cdfc 100644 --- a/src/state-item.c +++ b/src/state-item.c @@ -61,7 +61,7 @@ hash_pair_free (hash_pair *hp) free (hp); } -Hash_table * +static Hash_table * hash_pair_table_create (int size) { return hash_xinitialize (size, @@ -333,7 +333,7 @@ gen_lookaheads (void) bitsetv firsts = NULL; -void +static void init_firsts (void) { firsts = bitsetv_create (nvars, nsyms, BITSET_FIXED);