Skip to content

Commit

Permalink
Add -Wextra as a default to config.mak, change types to respond to ne…
Browse files Browse the repository at this point in the history
…w warnings
  • Loading branch information
cmgraff committed Aug 11, 2017
1 parent 0f9188b commit f287377
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Builtin builtins[] = {
int
perform_builtin(struct AST *n)
{
int i;
size_t i;

if (n->type != NODE_COMMAND || !n->node.tokens[0])
return 0;
Expand Down
2 changes: 1 addition & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LIBS =

# flags
CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_GNU_SOURCE
CFLAGS = -g -std=c99 -Wall ${INCS} ${CPPFLAGS}
CFLAGS = -g -std=c99 -Wall -Wextra ${INCS} ${CPPFLAGS}
LDFLAGS = -g ${LIBS}

# compiler and linker
Expand Down
4 changes: 2 additions & 2 deletions region.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ region_malloc(region *r, size_t size)
void *
region_realloc(region *r, void *v, size_t size)
{
int i;
size_t i;

for (i = 0; i < r->len; i++)
if (r->pointers[i] == v)
Expand All @@ -40,7 +40,7 @@ region_realloc(region *r, void *v, size_t size)
void
region_free(region *r)
{
int i;
size_t i;

for (i = 0; i < r->len; i++)
efree(r->pointers[i]);
Expand Down
1 change: 1 addition & 0 deletions s.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ int debug = 0;
void
handler_sigint(int sig)
{
sig = sig; /* get rid of compiler warnings from -Wextra */
/* signal(sig, SIG_IGN); */
}

Expand Down
8 changes: 5 additions & 3 deletions tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ char escs[][2] = {
static int
is_esc(int c)
{
int i;
size_t i;
for (i = 0; i < LEN(escs); i++)
if (escs[i][0] == c)
return 1;
Expand Down Expand Up @@ -80,7 +80,9 @@ skip_newline(string_port *stream)
static int
read_token(char *tok_buf, string_port *stream, int *out_should_expand)
{
int len = 0, escape_char, i, var = 0;
size_t len = 0;
size_t i = 0;
int escape_char, var = 0;
char c, quote;

/* TOK(c) adds a character c to the buffer, erroring if it went over the limit */
Expand Down Expand Up @@ -176,7 +178,7 @@ read_token(char *tok_buf, string_port *stream, int *out_should_expand)
goto st_string;
} else if (escape_char && is_esc(c)) {
escape_char = 0;
for (i = 0; i < LEN(escs); i++)
for (i = 0; i < (size_t)LEN(escs); i++)
if (escs[i][0] == c) {
TOK(escs[i][1]);
goto st_string;
Expand Down

0 comments on commit f287377

Please sign in to comment.