From 4cd70811e7e335fe568f62c564ac2bef0515694f Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 7 Jul 2017 15:42:48 +0300 Subject: Fix GCC 7.1 warnings (incrementing/decrementing booleans). --- ChangeLog | 13 +++++++++++++ awk.h | 2 +- awkgram.c | 2 +- awkgram.y | 2 +- builtin.c | 4 ++-- cmd.h | 2 +- debug.c | 12 ++++++------ msg.c | 2 +- 8 files changed, 26 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 17a6f566..4c34f193 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-07-07 Arnold D. Robbins + + Remove warnings from GCC 7.1 compilation. + + * awk.h (fatal_tag_valid): Change type to int. + * awkgram.y (yylex): Set did_newline to true instead of using ++. + * builtin.c (format_tree): Set lj to true instead of using ++. + * cmd.h (pager_quit_tag_valid): Change type to int. + * debug.c (pager_quit_tag_valid): Change type to int. + (do_clear): Make bp_found an int, change uses. + (do_run): Treat fatal_tag_valid as an int. + * msg.c (fatal_tag_valid): Change type to int. + 2017-01-27 Andrew J. Schorr * interpret.h [UNFIELD]: Fix condition for assignment from diff --git a/awk.h b/awk.h index ff622898..27fb2751 100644 --- a/awk.h +++ b/awk.h @@ -1282,7 +1282,7 @@ DEREF(NODE *r) #define fatal (*(set_loc(__FILE__, __LINE__), r_fatal)) extern jmp_buf fatal_tag; -extern bool fatal_tag_valid; +extern int fatal_tag_valid; #define PUSH_BINDING(stack, tag, val) \ if (val++) \ diff --git a/awkgram.c b/awkgram.c index dbfc5e6e..7191c1e7 100644 --- a/awkgram.c +++ b/awkgram.c @@ -5737,7 +5737,7 @@ retry: lastline = sourceline; return lasttok = c; } - did_newline++; + did_newline = true; --lexptr; /* pick up } next time */ return lasttok = NEWLINE; diff --git a/awkgram.y b/awkgram.y index 4eab3d6f..b0dd2830 100644 --- a/awkgram.y +++ b/awkgram.y @@ -3398,7 +3398,7 @@ retry: lastline = sourceline; return lasttok = c; } - did_newline++; + did_newline = true; --lexptr; /* pick up } next time */ return lasttok = NEWLINE; diff --git a/builtin.c b/builtin.c index 18c01f6e..1eb2e3eb 100644 --- a/builtin.c +++ b/builtin.c @@ -943,7 +943,7 @@ check_pos: *cur = get_number_si(arg); if (*cur < 0 && cur == &fw) { *cur = -*cur; - lj++; + lj = true; } if (cur == &prec) { if (*cur >= 0) @@ -970,7 +970,7 @@ check_pos: goto retry; } fill = sp; /* if left justified then other */ - lj++; /* filling is ignored */ + lj = true; /* filling is ignored */ goto check_pos; case '.': if (cur != &fw) diff --git a/cmd.h b/cmd.h index 11844157..f663586c 100644 --- a/cmd.h +++ b/cmd.h @@ -36,7 +36,7 @@ extern NODE *get_function(void); extern int gprintf(FILE *fp, const char *format, ...); extern jmp_buf pager_quit_tag; -extern bool pager_quit_tag_valid; +extern int pager_quit_tag_valid; extern bool output_is_tty; extern int input_fd; diff --git a/debug.c b/debug.c index da8f2fa9..c7271785 100644 --- a/debug.c +++ b/debug.c @@ -270,7 +270,7 @@ static void save_options(const char *file); /* pager */ jmp_buf pager_quit_tag; -bool pager_quit_tag_valid = false; +int pager_quit_tag_valid = 0; static int screen_width = INT_MAX; /* no of columns */ static int screen_height = INT_MAX; /* no of rows */ static int pager_lines_printed = 0; /* no of lines printed so far */ @@ -2458,7 +2458,7 @@ do_clear(CMDARG *arg, int cmd ATTRIBUTE_UNUSED) NODE *func; SRCFILE *s = cur_srcfile; char *src = cur_srcfile->src; - bool bp_found = false; + int bp_found = 0; if (arg == NULL) { /* clear */ CHECK_PROG_RUNNING(); @@ -2510,7 +2510,7 @@ func: fprintf(out_fp, ", %d", b->number); delete_breakpoint(b); } - if (! bp_found) + if (bp_found == 0) fprintf(out_fp, _("No breakpoint(s) at entry to function `%s'\n"), func->vname); else @@ -2537,7 +2537,7 @@ delete_bp: } } - if (! bp_found) + if (bp_found == 0) fprintf(out_fp, _("No breakpoint at file `%s', line #%d\n"), src, (int) lineno); else @@ -2954,11 +2954,11 @@ do_run(CMDARG *arg ATTRIBUTE_UNUSED, int cmd ATTRIBUTE_UNUSED) fprintf(out_fp, _("Starting program: \n")); prog_running = true; - fatal_tag_valid = true; + fatal_tag_valid = 1; if (setjmp(fatal_tag) == 0) (void) interpret(code_block); - fatal_tag_valid = false; + fatal_tag_valid = 0; prog_running = false; fprintf(out_fp, (! exiting && exit_val != EXIT_SUCCESS) ? _("Program exited abnormally with exit value: %d\n") diff --git a/msg.c b/msg.c index 16fef73a..b89254e6 100644 --- a/msg.c +++ b/msg.c @@ -33,7 +33,7 @@ static const char *srcfile = NULL; static int srcline; jmp_buf fatal_tag; -bool fatal_tag_valid = false; +int fatal_tag_valid = 0; /* err --- print an error message with source line and file and record */ -- cgit v1.2.3