Fix WARNS=4 issues (-Wshadow -Wcast-qual)
This commit is contained in:
parent
f974617411
commit
3abdd2c250
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: defs.h,v 1.16 2007/12/15 22:01:25 perry Exp $ */
|
||||
/* $NetBSD: defs.h,v 1.17 2009/04/14 09:41:30 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
|
@ -226,9 +226,9 @@ extern char lflag;
|
|||
extern char rflag;
|
||||
extern char tflag;
|
||||
extern char vflag;
|
||||
extern char *symbol_prefix;
|
||||
extern const char *symbol_prefix;
|
||||
|
||||
extern char *myname;
|
||||
extern const char *myname;
|
||||
extern char *cptr;
|
||||
extern char *line;
|
||||
extern int lineno;
|
||||
|
@ -243,7 +243,7 @@ extern const char * const trailer[];
|
|||
extern char *action_file_name;
|
||||
extern char *code_file_name;
|
||||
extern char *defines_file_name;
|
||||
extern char *input_file_name;
|
||||
extern const char *input_file_name;
|
||||
extern char *output_file_name;
|
||||
extern char *text_file_name;
|
||||
extern char *union_file_name;
|
||||
|
@ -314,19 +314,19 @@ extern short final_state;
|
|||
|
||||
extern char *allocate(unsigned);
|
||||
extern bucket *lookup(char *);
|
||||
extern bucket *make_bucket(char *);
|
||||
extern bucket *make_bucket(const char *);
|
||||
|
||||
extern void set_first_derives(void);
|
||||
extern void closure(short *, int);
|
||||
extern void finalize_closure(void);
|
||||
|
||||
extern __dead void fatal(char *);
|
||||
extern __dead void fatal(const char *);
|
||||
|
||||
extern void reflexive_transitive_closure(unsigned *, int);
|
||||
extern __dead void done(int);
|
||||
|
||||
extern __dead void no_space(void);
|
||||
extern __dead void open_error(char *);
|
||||
extern __dead void open_error(const char *);
|
||||
extern __dead void unexpected_EOF(void);
|
||||
extern void print_pos(char *, char *);
|
||||
extern __dead void syntax_error(int, char *, char *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: error.c,v 1.10 2006/05/24 18:01:43 christos Exp $ */
|
||||
/* $NetBSD: error.c,v 1.11 2009/04/14 09:41:30 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)error.c 5.3 (Berkeley) 6/1/90";
|
||||
#else
|
||||
__RCSID("$NetBSD: error.c,v 1.10 2006/05/24 18:01:43 christos Exp $");
|
||||
__RCSID("$NetBSD: error.c,v 1.11 2009/04/14 09:41:30 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -46,7 +46,7 @@ __RCSID("$NetBSD: error.c,v 1.10 2006/05/24 18:01:43 christos Exp $");
|
|||
#include "defs.h"
|
||||
|
||||
__dead void
|
||||
fatal(char *msg)
|
||||
fatal(const char *msg)
|
||||
{
|
||||
fprintf(stderr, "%s: f - %s\n", myname, msg);
|
||||
done(2);
|
||||
|
@ -61,7 +61,7 @@ no_space(void)
|
|||
}
|
||||
|
||||
__dead void
|
||||
open_error(char *filename)
|
||||
open_error(const char *filename)
|
||||
{
|
||||
fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename);
|
||||
done(2);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lalr.c,v 1.10 2006/05/24 18:06:58 christos Exp $ */
|
||||
/* $NetBSD: lalr.c,v 1.11 2009/04/14 09:41:30 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)lalr.c 5.3 (Berkeley) 6/1/90";
|
||||
#else
|
||||
__RCSID("$NetBSD: lalr.c,v 1.10 2006/05/24 18:06:58 christos Exp $");
|
||||
__RCSID("$NetBSD: lalr.c,v 1.11 2009/04/14 09:41:30 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -407,7 +407,7 @@ build_relations(void)
|
|||
shifts *sp;
|
||||
int length;
|
||||
int nedges;
|
||||
int done;
|
||||
int isdone;
|
||||
int state1;
|
||||
int stateno;
|
||||
int symbol1;
|
||||
|
@ -451,16 +451,16 @@ build_relations(void)
|
|||
add_lookback_edge(stateno, *rulep, i);
|
||||
|
||||
length--;
|
||||
done = 0;
|
||||
while (!done)
|
||||
isdone = 0;
|
||||
while (!isdone)
|
||||
{
|
||||
done = 1;
|
||||
isdone = 1;
|
||||
rp--;
|
||||
if (ISVAR(*rp))
|
||||
{
|
||||
stateno = states[--length];
|
||||
edge[nedges++] = map_goto(stateno, *rp);
|
||||
if (nullable[*rp] && length > 0) done = 0;
|
||||
if (nullable[*rp] && length > 0) isdone = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ add_lookback_edge(int stateno, int ruleno, int gotono)
|
|||
|
||||
|
||||
static short **
|
||||
transpose(short **R, int n)
|
||||
transpose(short **tR, int n)
|
||||
{
|
||||
short **new_R;
|
||||
short **temp_R;
|
||||
|
@ -530,7 +530,7 @@ transpose(short **R, int n)
|
|||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
sp = R[i];
|
||||
sp = tR[i];
|
||||
if (sp)
|
||||
{
|
||||
while (*sp >= 0)
|
||||
|
@ -557,7 +557,7 @@ transpose(short **R, int n)
|
|||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
sp = R[i];
|
||||
sp = tR[i];
|
||||
if (sp)
|
||||
{
|
||||
while (*sp >= 0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lr0.c,v 1.9 2006/05/24 18:01:43 christos Exp $ */
|
||||
/* $NetBSD: lr0.c,v 1.10 2009/04/14 09:41:30 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)lr0.c 5.3 (Berkeley) 1/20/91";
|
||||
#else
|
||||
__RCSID("$NetBSD: lr0.c,v 1.9 2006/05/24 18:01:43 christos Exp $");
|
||||
__RCSID("$NetBSD: lr0.c,v 1.10 2009/04/14 09:41:30 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -615,7 +615,7 @@ set_nullable(void)
|
|||
{
|
||||
int i, j;
|
||||
int empty;
|
||||
int done;
|
||||
int isdone;
|
||||
|
||||
nullable = MALLOC(nsyms);
|
||||
if (nullable == 0) no_space();
|
||||
|
@ -623,10 +623,10 @@ set_nullable(void)
|
|||
for (i = 0; i < nsyms; ++i)
|
||||
nullable[i] = 0;
|
||||
|
||||
done = 0;
|
||||
while (!done)
|
||||
isdone = 0;
|
||||
while (!isdone)
|
||||
{
|
||||
done = 1;
|
||||
isdone = 1;
|
||||
for (i = 1; i < nitems; i++)
|
||||
{
|
||||
empty = 1;
|
||||
|
@ -642,7 +642,7 @@ set_nullable(void)
|
|||
if (!nullable[j])
|
||||
{
|
||||
nullable[j] = 1;
|
||||
done = 0;
|
||||
isdone = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.20 2008/07/21 14:19:28 lukem Exp $ */
|
||||
/* $NetBSD: main.c,v 1.21 2009/04/14 09:41:30 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
|
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 5.5 (Berkeley) 5/24/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.20 2008/07/21 14:19:28 lukem Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.21 2009/04/14 09:41:30 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -61,8 +61,8 @@ char rflag;
|
|||
char tflag;
|
||||
char vflag;
|
||||
|
||||
char *symbol_prefix;
|
||||
char *myname = "yacc";
|
||||
const char *symbol_prefix;
|
||||
const char *myname = "yacc";
|
||||
|
||||
|
||||
int lineno;
|
||||
|
@ -71,7 +71,7 @@ int outline;
|
|||
char *action_file_name;
|
||||
char *code_file_name;
|
||||
char *defines_file_name;
|
||||
char *input_file_name = "";
|
||||
const char *input_file_name = "";
|
||||
char *output_file_name;
|
||||
char *text_file_name;
|
||||
char *union_file_name;
|
||||
|
@ -110,8 +110,8 @@ char *rassoc;
|
|||
short **derives;
|
||||
char *nullable;
|
||||
|
||||
static char *file_prefix = "y";
|
||||
static char *temp_form = "yacc.XXXXXXX";
|
||||
static const char *file_prefix = "y";
|
||||
static const char *temp_form = "yacc.XXXXXXX";
|
||||
static int explicit_file_name;
|
||||
|
||||
|
||||
|
@ -300,7 +300,7 @@ static void
|
|||
create_file_names(void)
|
||||
{
|
||||
int i, len;
|
||||
char *tmpdir;
|
||||
const char *tmpdir;
|
||||
|
||||
tmpdir = getenv("TMPDIR");
|
||||
if (tmpdir == 0) tmpdir = "/tmp";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mkpar.c,v 1.11 2006/05/24 18:01:43 christos Exp $ */
|
||||
/* $NetBSD: mkpar.c,v 1.12 2009/04/14 09:41:31 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)mkpar.c 5.3 (Berkeley) 1/20/91";
|
||||
#else
|
||||
__RCSID("$NetBSD: mkpar.c,v 1.11 2006/05/24 18:01:43 christos Exp $");
|
||||
__RCSID("$NetBSD: mkpar.c,v 1.12 2009/04/14 09:41:31 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -104,7 +104,7 @@ get_shifts(int stateno)
|
|||
{
|
||||
action *actions, *temp;
|
||||
shifts *sp;
|
||||
short *to_state;
|
||||
short *state;
|
||||
int i, k;
|
||||
int symbol;
|
||||
|
||||
|
@ -112,10 +112,10 @@ get_shifts(int stateno)
|
|||
sp = shift_table[stateno];
|
||||
if (sp)
|
||||
{
|
||||
to_state = sp->shift;
|
||||
state = sp->shift;
|
||||
for (i = sp->nshifts - 1; i >= 0; i--)
|
||||
{
|
||||
k = to_state[i];
|
||||
k = state[i];
|
||||
symbol = accessing_symbol[k];
|
||||
if (ISTOKEN(symbol))
|
||||
{
|
||||
|
@ -200,15 +200,15 @@ static void
|
|||
find_final_state(void)
|
||||
{
|
||||
int goal, i;
|
||||
short *to_state;
|
||||
short *state;
|
||||
shifts *p;
|
||||
|
||||
p = shift_table[0];
|
||||
to_state = p->shift;
|
||||
state = p->shift;
|
||||
goal = ritem[1];
|
||||
for (i = p->nshifts - 1; i >= 0; --i)
|
||||
{
|
||||
final_state = to_state[i];
|
||||
final_state = state[i];
|
||||
if (accessing_symbol[final_state] == goal) break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: output.c,v 1.14 2006/05/24 18:01:43 christos Exp $ */
|
||||
/* $NetBSD: output.c,v 1.15 2009/04/14 09:41:31 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)output.c 5.7 (Berkeley) 5/24/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: output.c,v 1.14 2006/05/24 18:01:43 christos Exp $");
|
||||
__RCSID("$NetBSD: output.c,v 1.15 2009/04/14 09:41:31 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -931,7 +931,7 @@ static void
|
|||
output_debug(void)
|
||||
{
|
||||
int i, j, k, max;
|
||||
char **symnam, *s;
|
||||
const char **symnam, *s;
|
||||
|
||||
++outline;
|
||||
fprintf(code_file, "#define YYFINAL %d\n", final_state);
|
||||
|
@ -949,7 +949,7 @@ output_debug(void)
|
|||
++outline;
|
||||
fprintf(code_file, "#define YYMAXTOKEN %d\n", max);
|
||||
|
||||
symnam = (char **) MALLOC((max+1)*sizeof(char *));
|
||||
symnam = (const char **) MALLOC((max+1)*sizeof(char *));
|
||||
if (symnam == 0) no_space();
|
||||
|
||||
/* Note that it is not necessary to initialize the element */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: reader.c,v 1.17 2006/11/24 19:47:00 christos Exp $ */
|
||||
/* $NetBSD: reader.c,v 1.18 2009/04/14 09:41:31 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)reader.c 5.7 (Berkeley) 1/20/91";
|
||||
#else
|
||||
__RCSID("$NetBSD: reader.c,v 1.17 2006/11/24 19:47:00 christos Exp $");
|
||||
__RCSID("$NetBSD: reader.c,v 1.18 2009/04/14 09:41:31 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -64,7 +64,6 @@ static char saw_eof;
|
|||
static int linesize;
|
||||
|
||||
static bucket *goal;
|
||||
static int prec;
|
||||
static int gensym;
|
||||
static char last_was_action;
|
||||
|
||||
|
@ -920,6 +919,7 @@ declare_tokens(int assoc)
|
|||
bucket *bp;
|
||||
int value;
|
||||
char *tag = 0;
|
||||
static int prec;
|
||||
|
||||
if (assoc != TOKEN) ++prec;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: symtab.c,v 1.11 2006/05/24 18:06:58 christos Exp $ */
|
||||
/* $NetBSD: symtab.c,v 1.12 2009/04/14 09:41:31 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)symtab.c 5.3 (Berkeley) 6/1/90";
|
||||
#else
|
||||
__RCSID("$NetBSD: symtab.c,v 1.11 2006/05/24 18:06:58 christos Exp $");
|
||||
__RCSID("$NetBSD: symtab.c,v 1.12 2009/04/14 09:41:31 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -54,13 +54,13 @@ bucket *last_symbol;
|
|||
|
||||
static bucket **symbol_table;
|
||||
|
||||
static int hash(char *);
|
||||
static int hash(const char *);
|
||||
|
||||
|
||||
static int
|
||||
hash(char *name)
|
||||
hash(const char *name)
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
int c, k;
|
||||
|
||||
assert(name && *name);
|
||||
|
@ -74,7 +74,7 @@ hash(char *name)
|
|||
|
||||
|
||||
bucket *
|
||||
make_bucket(char *name)
|
||||
make_bucket(const char *name)
|
||||
{
|
||||
bucket *bp;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: verbose.c,v 1.9 2006/05/24 18:01:43 christos Exp $ */
|
||||
/* $NetBSD: verbose.c,v 1.10 2009/04/14 09:41:31 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)verbose.c 5.3 (Berkeley) 1/20/91";
|
||||
#else
|
||||
__RCSID("$NetBSD: verbose.c,v 1.9 2006/05/24 18:01:43 christos Exp $");
|
||||
__RCSID("$NetBSD: verbose.c,v 1.10 2009/04/14 09:41:31 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -328,7 +328,7 @@ print_shifts(action *p)
|
|||
|
||||
|
||||
static void
|
||||
print_reductions(action *p, int defred)
|
||||
print_reductions(action *p, int prdefred)
|
||||
{
|
||||
int k, anyreds;
|
||||
action *q;
|
||||
|
@ -349,7 +349,7 @@ print_reductions(action *p, int defred)
|
|||
{
|
||||
for (; p; p = p->next)
|
||||
{
|
||||
if (p->action_code == REDUCE && p->number != defred)
|
||||
if (p->action_code == REDUCE && p->number != prdefred)
|
||||
{
|
||||
k = p->number - 2;
|
||||
if (p->suppressed == 0)
|
||||
|
@ -358,8 +358,8 @@ print_reductions(action *p, int defred)
|
|||
}
|
||||
}
|
||||
|
||||
if (defred > 0)
|
||||
fprintf(verbose_file, "\t. reduce %d\n", defred - 2);
|
||||
if (prdefred > 0)
|
||||
fprintf(verbose_file, "\t. reduce %d\n", prdefred - 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,15 +369,15 @@ print_gotos(int stateno)
|
|||
{
|
||||
int i, k;
|
||||
int as;
|
||||
short *to_state;
|
||||
short *state;
|
||||
shifts *sp;
|
||||
|
||||
putc('\n', verbose_file);
|
||||
sp = shift_table[stateno];
|
||||
to_state = sp->shift;
|
||||
state = sp->shift;
|
||||
for (i = 0; i < sp->nshifts; ++i)
|
||||
{
|
||||
k = to_state[i];
|
||||
k = state[i];
|
||||
as = accessing_symbol[k];
|
||||
if (ISVAR(as))
|
||||
fprintf(verbose_file, "\t%s goto %d\n", symbol_name[as], k);
|
||||
|
|
Loading…
Reference in New Issue