summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2023-04-22 22:50:32 +0300
committerArnold D. Robbins <arnold@skeeve.com>2023-04-22 22:50:32 +0300
commit58503d8bf67a6563cb163b9988e707533d6d257e (patch)
treebc30d7bea0e445454841afcb5fe33b5cafd9e32a
parent93d8f65d4730cf93a66877c1cba71e3e7f888d9a (diff)
downloadgawk-58503d8bf67a6563cb163b9988e707533d6d257e.tar.gz
Fix a few -Wextra compilation warnings.
-rw-r--r--ChangeLog6
-rw-r--r--awkgram.c3
-rw-r--r--awkgram.y3
-rw-r--r--builtin.c2
-rw-r--r--debug.c6
-rw-r--r--eval.c1
-rw-r--r--interpret.h3
-rw-r--r--profile.c3
8 files changed, 16 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 1dac0a9b..1955fdcf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-04-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y, builtin.c, debug.c, eval.c, interpret.h,
+ profile.c: Fix some implicit fall through warnings.
+ Thanks to "Jannick" <thirdedition@gmx.net> for the report.
+
2023-04-21 Arnold D. Robbins <arnold@skeeve.com>
* array.c (asort_actual): Initialize `value' to avoid
diff --git a/awkgram.c b/awkgram.c
index 352dac5a..180d29c7 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -6369,10 +6369,11 @@ retry:
case '{':
if (++in_braces == 1)
firstline = sourceline;
+ /* fall through */
case ';':
case ',':
case '[':
- return lasttok = c;
+ return lasttok = c;
case ']':
c = nextc(true);
pushback();
diff --git a/awkgram.y b/awkgram.y
index cf43b621..74be2340 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -3867,10 +3867,11 @@ retry:
case '{':
if (++in_braces == 1)
firstline = sourceline;
+ /* fall through */
case ';':
case ',':
case '[':
- return lasttok = c;
+ return lasttok = c;
case ']':
c = nextc(true);
pushback();
diff --git a/builtin.c b/builtin.c
index efd62902..0e609220 100644
--- a/builtin.c
+++ b/builtin.c
@@ -955,7 +955,7 @@ check_pos:
zero_flag = true;
if (lj)
goto retry;
- /* FALL through */
+ /* fall through */
case '1':
case '2':
case '3':
diff --git a/debug.c b/debug.c
index 683f3a69..117fe690 100644
--- a/debug.c
+++ b/debug.c
@@ -2517,8 +2517,7 @@ do_clear(CMDARG *arg, int cmd ATTRIBUTE_UNUSED)
src = s->src;
if (arg->type == D_func)
goto func;
- /* else
- fall through */
+ /* fall through */
case D_int: /* clear lineno */
lineno = (int) arg->a_int;
if (lineno <= 0 || lineno > s->srclines) {
@@ -3375,8 +3374,7 @@ do_until(CMDARG *arg, int cmd)
src = s->src;
if (arg->type == D_func)
goto func;
- /* else
- fall through */
+ /* fall through */
case D_int: /* until lineno */
lineno = arg->a_int;
if (lineno <= 0 || lineno > s->srclines) {
diff --git a/eval.c b/eval.c
index 7c8fde16..b46e3aae 100644
--- a/eval.c
+++ b/eval.c
@@ -1155,6 +1155,7 @@ r_get_lhs(NODE *n, bool reference)
case Node_var_array:
fatal(_("attempt to use array `%s' in a scalar context"),
array_vname(n));
+ return NULL; // silence compiler warnings
case Node_array_ref:
if (n->orig_array->type == Node_var_array)
fatal(_("attempt to use array `%s' in a scalar context"),
diff --git a/interpret.h b/interpret.h
index 70195d96..9ffa5bbd 100644
--- a/interpret.h
+++ b/interpret.h
@@ -275,8 +275,7 @@ uninitialized_scalar:
PUSH(m);
break;
}
- /* else
- fall through */
+ /* fall through */
case Op_push_array:
PUSH(pc->memory);
break;
diff --git a/profile.c b/profile.c
index 54e61417..aa091c58 100644
--- a/profile.c
+++ b/profile.c
@@ -712,8 +712,7 @@ cleanup:
case Op_push_re:
if (pc->memory->type != Node_regex && (pc->memory->flags & REGEX) == 0)
break;
- /* else
- fall through */
+ /* fall through */
case Op_match_rec:
{
if (pc->memory->type == Node_regex) {