Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fd8a393

Browse files
committed
Make gcc -Wall happy
1 parent bda7ca7 commit fd8a393

6 files changed

Lines changed: 29 additions & 20 deletions

File tree

Parser/grammar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ findlabel(ll, type, str)
159159
}
160160
fprintf(stderr, "Label %d/'%s' not found\n", type, str);
161161
fatal("grammar.c:findlabel()");
162-
/*NOTREACHED*/
162+
return 0; /* Make gcc -Wall happy */
163163
}
164164

165165
/* Forward */

Parser/intrcheck.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ intrcheck()
125125
#include <stdio.h>
126126
#include <string.h>
127127
#include <signal.h>
128+
#ifdef HAVE_UNISTD_H
129+
#include <unistd.h>
130+
#endif
128131

129132
static int interrupted;
130133

Parser/myreadline.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ PERFORMANCE OF THIS SOFTWARE.
5454
extern char *readline();
5555
extern int rl_initialize();
5656
extern int rl_insert();
57+
extern int rl_bind_key();
58+
extern void add_history();
5759
extern char *rl_readline_name;
5860

5961
#include <setjmp.h>

Parser/pgen.c

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,14 @@ typedef struct _nfa {
6666
} nfa;
6767

6868
/* Forward */
69-
static compile_rhs PROTO((labellist *ll, nfa *nf, node *n, int *pa, int *pb));
70-
static compile_alt PROTO((labellist *ll, nfa *nf, node *n, int *pa, int *pb));
71-
static compile_item PROTO((labellist *ll, nfa *nf, node *n, int *pa, int *pb));
72-
static compile_atom PROTO((labellist *ll, nfa *nf, node *n, int *pa, int *pb));
69+
static void compile_rhs PROTO((labellist *ll,
70+
nfa *nf, node *n, int *pa, int *pb));
71+
static void compile_alt PROTO((labellist *ll,
72+
nfa *nf, node *n, int *pa, int *pb));
73+
static void compile_item PROTO((labellist *ll,
74+
nfa *nf, node *n, int *pa, int *pb));
75+
static void compile_atom PROTO((labellist *ll,
76+
nfa *nf, node *n, int *pa, int *pb));
7377

7478
static int
7579
addnfastate(nf)
@@ -128,7 +132,7 @@ typedef struct _nfagrammar {
128132
} nfagrammar;
129133

130134
/* Forward */
131-
static compile_rule PROTO((nfagrammar *gr, node *n));
135+
static void compile_rule PROTO((nfagrammar *gr, node *n));
132136

133137
static nfagrammar *
134138
newnfagrammar()
@@ -195,7 +199,7 @@ metacompile(n)
195199
return gr;
196200
}
197201

198-
static
202+
static void
199203
compile_rule(gr, n)
200204
nfagrammar *gr;
201205
node *n;
@@ -216,7 +220,7 @@ compile_rule(gr, n)
216220
REQ(n, NEWLINE);
217221
}
218222

219-
static
223+
static void
220224
compile_rhs(ll, nf, n, pa, pb)
221225
labellist *ll;
222226
nfa *nf;
@@ -253,7 +257,7 @@ compile_rhs(ll, nf, n, pa, pb)
253257
}
254258
}
255259

256-
static
260+
static void
257261
compile_alt(ll, nf, n, pa, pb)
258262
labellist *ll;
259263
nfa *nf;
@@ -284,7 +288,7 @@ compile_alt(ll, nf, n, pa, pb)
284288
}
285289
}
286290

287-
static
291+
static void
288292
compile_item(ll, nf, n, pa, pb)
289293
labellist *ll;
290294
nfa *nf;
@@ -325,7 +329,7 @@ compile_item(ll, nf, n, pa, pb)
325329
}
326330
}
327331

328-
static
332+
static void
329333
compile_atom(ll, nf, n, pa, pb)
330334
labellist *ll;
331335
nfa *nf;
@@ -437,12 +441,12 @@ typedef struct _ss_dfa {
437441
} ss_dfa;
438442

439443
/* Forward */
440-
static printssdfa PROTO((int xx_nstates, ss_state *xx_state, int nbits,
441-
labellist *ll, char *msg));
442-
static simplify PROTO((int xx_nstates, ss_state *xx_state));
443-
static convert PROTO((dfa *d, int xx_nstates, ss_state *xx_state));
444+
static void printssdfa PROTO((int xx_nstates, ss_state *xx_state, int nbits,
445+
labellist *ll, char *msg));
446+
static void simplify PROTO((int xx_nstates, ss_state *xx_state));
447+
static void convert PROTO((dfa *d, int xx_nstates, ss_state *xx_state));
444448

445-
static
449+
static void
446450
makedfa(gr, nf, d)
447451
nfagrammar *gr;
448452
nfa *nf;
@@ -548,7 +552,7 @@ makedfa(gr, nf, d)
548552
/* XXX cleanup */
549553
}
550554

551-
static
555+
static void
552556
printssdfa(xx_nstates, xx_state, nbits, ll, msg)
553557
int xx_nstates;
554558
ss_state *xx_state;
@@ -629,7 +633,7 @@ renamestates(xx_nstates, xx_state, from, to)
629633
}
630634
}
631635

632-
static
636+
static void
633637
simplify(xx_nstates, xx_state)
634638
int xx_nstates;
635639
ss_state *xx_state;
@@ -661,7 +665,7 @@ simplify(xx_nstates, xx_state)
661665

662666
/* Convert the DFA into a grammar that can be used by our parser */
663667

664-
static
668+
static void
665669
convert(d, xx_nstates, xx_state)
666670
dfa *d;
667671
int xx_nstates;

Parser/pgenmain.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ main(argc, argv)
101101
printnonterminals(g, fp);
102102
fclose(fp);
103103
goaway(0);
104+
return 0; /* Make gcc -Wall happy */
104105
}
105106

106107
grammar *

Parser/tokenizer.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ tok_nextc(tok)
279279
int curstart = tok->start == NULL ? -1 :
280280
tok->start - tok->buf;
281281
int curvalid = tok->inp - tok->buf;
282-
int cursize = tok->end - tok->buf;
283282
int newsize = curvalid + BUFSIZ;
284283
char *newbuf = tok->buf;
285284
RESIZE(newbuf, char, newsize);

0 commit comments

Comments
 (0)