diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2017-05-25 20:11:04 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2017-05-25 20:11:04 +0000 |
commit | 49980273ebcb16755542606ba7959bca0fd4821f (patch) | |
tree | c064a7addcbc564b90dcd01804a3e7a26dcb3465 | |
parent | ab69dce588018883bcb73ed04813b42eb2cf6c25 (diff) |
fix a variety of warnings. from Brian Callahan
-rw-r--r-- | usr.bin/yacc/closure.c | 142 | ||||
-rw-r--r-- | usr.bin/yacc/lalr.c | 10 | ||||
-rw-r--r-- | usr.bin/yacc/main.c | 4 | ||||
-rw-r--r-- | usr.bin/yacc/mkpar.c | 22 | ||||
-rw-r--r-- | usr.bin/yacc/reader.c | 12 | ||||
-rw-r--r-- | usr.bin/yacc/verbose.c | 16 |
6 files changed, 103 insertions, 103 deletions
diff --git a/usr.bin/yacc/closure.c b/usr.bin/yacc/closure.c index ac82d4236e4..52148808818 100644 --- a/usr.bin/yacc/closure.c +++ b/usr.bin/yacc/closure.c @@ -1,4 +1,4 @@ -/* $OpenBSD: closure.c,v 1.14 2014/12/02 15:56:22 millert Exp $ */ +/* $OpenBSD: closure.c,v 1.15 2017/05/25 20:11:03 tedu Exp $ */ /* $NetBSD: closure.c,v 1.4 1996/03/19 03:21:29 jtc Exp $ */ /* @@ -43,7 +43,76 @@ static unsigned *first_derives; static unsigned *EFF; -void +#ifdef DEBUG + +static void +print_closure(int n) +{ + short *isp; + + printf("\n\nn = %d\n\n", n); + for (isp = itemset; isp < itemsetend; isp++) + printf(" %d\n", *isp); +} + +static void +print_EFF(void) +{ + int i, j; + unsigned int *rowp; + unsigned int k, word; + + printf("\n\nEpsilon Free Firsts\n"); + + for (i = start_symbol; i < nsyms; i++) { + printf("\n%s", symbol_name[i]); + rowp = EFF + ((i - start_symbol) * WORDSIZE(nvars)); + word = *rowp++; + + k = BITS_PER_WORD; + for (j = 0; j < nvars; k++, j++) { + if (k >= BITS_PER_WORD) { + word = *rowp++; + k = 0; + } + + if (word & (1 << k)) + printf(" %s", symbol_name[start_symbol + j]); + } + } +} + +static void +print_first_derives(void) +{ + int i, j; + unsigned int *rp; + unsigned int k, cword = 0; + + printf("\n\n\nFirst Derives\n"); + + for (i = start_symbol; i < nsyms; i++) { + printf("\n%s derives\n", symbol_name[i]); + rp = first_derives + i * WORDSIZE(nrules); + k = BITS_PER_WORD; + for (j = 0; j <= nrules; k++, j++) { + if (k >= BITS_PER_WORD) { + cword = *rp++; + k = 0; + } + + if (cword & (1 << k)) + printf(" %d\n", j); + } + } + + fflush(stdout); +} + +#endif + + +static void set_EFF(void) { unsigned int *row; @@ -177,72 +246,3 @@ finalize_closure(void) free(ruleset); free(first_derives + ntokens * WORDSIZE(nrules)); } - - -#ifdef DEBUG - -void -print_closure(int n) -{ - short *isp; - - printf("\n\nn = %d\n\n", n); - for (isp = itemset; isp < itemsetend; isp++) - printf(" %d\n", *isp); -} - -void -print_EFF(void) -{ - int i, j; - unsigned int *rowp; - unsigned int k, word; - - printf("\n\nEpsilon Free Firsts\n"); - - for (i = start_symbol; i < nsyms; i++) { - printf("\n%s", symbol_name[i]); - rowp = EFF + ((i - start_symbol) * WORDSIZE(nvars)); - word = *rowp++; - - k = BITS_PER_WORD; - for (j = 0; j < nvars; k++, j++) { - if (k >= BITS_PER_WORD) { - word = *rowp++; - k = 0; - } - - if (word & (1 << k)) - printf(" %s", symbol_name[start_symbol + j]); - } - } -} - -void -print_first_derives(void) -{ - int i, j; - unsigned int *rp; - unsigned int k, cword = 0; - - printf("\n\n\nFirst Derives\n"); - - for (i = start_symbol; i < nsyms; i++) { - printf("\n%s derives\n", symbol_name[i]); - rp = first_derives + i * WORDSIZE(nrules); - k = BITS_PER_WORD; - for (j = 0; j <= nrules; k++, j++) { - if (k >= BITS_PER_WORD) { - cword = *rp++; - k = 0; - } - - if (cword & (1 << k)) - printf(" %d\n", j); - } - } - - fflush(stdout); -} - -#endif diff --git a/usr.bin/yacc/lalr.c b/usr.bin/yacc/lalr.c index 42b88b4a76f..86874077ec3 100644 --- a/usr.bin/yacc/lalr.c +++ b/usr.bin/yacc/lalr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lalr.c,v 1.18 2015/12/11 20:25:47 mmcc Exp $ */ +/* $OpenBSD: lalr.c,v 1.19 2017/05/25 20:11:03 tedu Exp $ */ /* $NetBSD: lalr.c,v 1.4 1996/03/19 03:21:33 jtc Exp $ */ /* @@ -52,7 +52,7 @@ short *goto_map; short *from_state; short *to_state; -short **transpose(); +short **transpose(short **, int); void set_state_table(void); void set_accessing_symbol(void); void set_shift_table(void); @@ -448,7 +448,7 @@ add_lookback_edge(int stateno, int ruleno, int gotono) short ** -transpose(short **R, int n) +transpose(short **old_R, int n) { short **new_R, **temp_R, *nedges, *sp; int i, k; @@ -456,7 +456,7 @@ transpose(short **R, int n) nedges = NEW2(n, short); for (i = 0; i < n; i++) { - sp = R[i]; + sp = old_R[i]; if (sp) { while (*sp >= 0) nedges[*sp++]++; @@ -479,7 +479,7 @@ transpose(short **R, int n) free(nedges); for (i = 0; i < n; i++) { - sp = R[i]; + sp = old_R[i]; if (sp) { while (*sp >= 0) *temp_R[*sp++]++ = i; diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c index 7ca222d2b57..3d9f6add5c8 100644 --- a/usr.bin/yacc/main.c +++ b/usr.bin/yacc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.28 2016/07/27 20:53:47 tedu Exp $ */ +/* $OpenBSD: main.c,v 1.29 2017/05/25 20:11:03 tedu Exp $ */ /* $NetBSD: main.c,v 1.5 1996/03/19 03:21:38 jtc Exp $ */ /* @@ -122,7 +122,7 @@ done(int k) void -onintr(int signo) +onintr(__unused int signo) { sigdie = 1; done(1); diff --git a/usr.bin/yacc/mkpar.c b/usr.bin/yacc/mkpar.c index 9b2373d9561..14f2dbf3d0d 100644 --- a/usr.bin/yacc/mkpar.c +++ b/usr.bin/yacc/mkpar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkpar.c,v 1.18 2014/03/13 00:59:34 tedu Exp $ */ +/* $OpenBSD: mkpar.c,v 1.19 2017/05/25 20:11:03 tedu Exp $ */ /* $NetBSD: mkpar.c,v 1.4 1996/03/19 03:21:39 jtc Exp $ */ /* @@ -49,10 +49,10 @@ short final_state; static int SRcount; static int RRcount; -extern action *parse_actions(); -extern action *get_shifts(); -extern action *add_reductions(); -extern action *add_reduce(); +extern action *parse_actions(int); +extern action *get_shifts(int); +extern action *add_reductions(int, action *); +extern action *add_reduce(action *, int, int); short sole_reduction(int); void free_action_row(action *); @@ -98,16 +98,16 @@ get_shifts(int stateno) { action *actions, *temp; shifts *sp; - short *to_state; + short *tto_state; int i, k; int symbol; actions = 0; sp = shift_table[stateno]; if (sp) { - to_state = sp->shift; + tto_state = sp->shift; for (i = sp->nshifts - 1; i >= 0; i--) { - k = to_state[i]; + k = tto_state[i]; symbol = accessing_symbol[k]; if (ISTOKEN(symbol)) { temp = NEW(action); @@ -187,14 +187,14 @@ void find_final_state(void) { int goal, i; - short *to_state; + short *tto_state; shifts *p; p = shift_table[0]; - to_state = p->shift; + tto_state = p->shift; goal = ritem[1]; for (i = p->nshifts - 1; i >= 0; --i) { - final_state = to_state[i]; + final_state = tto_state[i]; if (accessing_symbol[final_state] == goal) break; } diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c index 2c8006829c5..4964be11f83 100644 --- a/usr.bin/yacc/reader.c +++ b/usr.bin/yacc/reader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: reader.c,v 1.33 2016/03/22 18:24:34 mmcc Exp $ */ +/* $OpenBSD: reader.c,v 1.34 2017/05/25 20:11:03 tedu Exp $ */ /* $NetBSD: reader.c,v 1.5 1996/03/19 03:21:43 jtc Exp $ */ /* @@ -945,7 +945,7 @@ declare_tokens(int assoc) * %expect requires special handling as it really isn't part of the yacc * grammar only a flag for yacc proper. */ -void +static void declare_expect(int assoc) { int c; @@ -1746,7 +1746,7 @@ void pack_grammar(void) { int i, j; - int assoc, prec; + int assoc, pprec; ritem = reallocarray(NULL, nitems, sizeof(short)); if (ritem == NULL) @@ -1780,11 +1780,11 @@ pack_grammar(void) rlhs[i] = plhs[i]->index; rrhs[i] = j; assoc = TOKEN; - prec = 0; + pprec = 0; while (pitem[j]) { ritem[j] = pitem[j]->index; if (pitem[j]->class == TERM) { - prec = pitem[j]->prec; + pprec = pitem[j]->prec; assoc = pitem[j]->assoc; } ++j; @@ -1792,7 +1792,7 @@ pack_grammar(void) ritem[j] = -i; ++j; if (rprec[i] == UNDEFINED) { - rprec[i] = prec; + rprec[i] = pprec; rassoc[i] = assoc; } } diff --git a/usr.bin/yacc/verbose.c b/usr.bin/yacc/verbose.c index 00857275204..0dcc6c7634f 100644 --- a/usr.bin/yacc/verbose.c +++ b/usr.bin/yacc/verbose.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verbose.c,v 1.13 2014/10/09 03:02:18 deraadt Exp $ */ +/* $OpenBSD: verbose.c,v 1.14 2017/05/25 20:11:03 tedu Exp $ */ /* $NetBSD: verbose.c,v 1.4 1996/03/19 03:21:50 jtc Exp $ */ /* @@ -298,7 +298,7 @@ print_shifts(action * p) void -print_reductions(action * p, int defred) +print_reductions(action * p, int pdefred) { int k, anyreds; action *q; @@ -315,7 +315,7 @@ print_reductions(action * p, int defred) fprintf(verbose_file, "\t. error\n"); else { for (; p; p = p->next) { - if (p->action_code == REDUCE && p->number != defred) { + if (p->action_code == REDUCE && p->number != pdefred) { k = p->number - 2; if (p->suppressed == 0) fprintf(verbose_file, "\t%s reduce %d\n", @@ -323,8 +323,8 @@ print_reductions(action * p, int defred) } } - if (defred > 0) - fprintf(verbose_file, "\t. reduce %d\n", defred - 2); + if (pdefred > 0) + fprintf(verbose_file, "\t. reduce %d\n", pdefred - 2); } } @@ -334,14 +334,14 @@ print_gotos(int stateno) { int i, k; int as; - short *to_state; + short *tto_state; shifts *sp; putc('\n', verbose_file); sp = shift_table[stateno]; - to_state = sp->shift; + tto_state = sp->shift; for (i = 0; i < sp->nshifts; ++i) { - k = to_state[i]; + k = tto_state[i]; as = accessing_symbol[k]; if (ISVAR(as)) fprintf(verbose_file, "\t%s goto %d\n", |