summaryrefslogtreecommitdiffstats
path: root/larn
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2019-02-03 03:19:25 +0000
committermrg <mrg@NetBSD.org>2019-02-03 03:19:25 +0000
commitdc6514954049bf3d7c993996025a81414423c89b (patch)
tree62f1a633c2e85d4bfcee4a574b5fa5c66ba88816 /larn
parent2d315c293c005d7227edf8d5800e4f9dc2795baa (diff)
downloadbsdgames-darwin-dc6514954049bf3d7c993996025a81414423c89b.tar.gz
bsdgames-darwin-dc6514954049bf3d7c993996025a81414423c89b.tar.zst
bsdgames-darwin-dc6514954049bf3d7c993996025a81414423c89b.zip
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in this case, and thus can't be marked __dead easily
Diffstat (limited to 'larn')
-rw-r--r--larn/main.c6
-rw-r--r--larn/monster.c12
-rw-r--r--larn/movem.c6
-rw-r--r--larn/object.c8
4 files changed, 24 insertions, 8 deletions
diff --git a/larn/main.c b/larn/main.c
index 1b442d6d..7b619f87 100644
--- a/larn/main.c
+++ b/larn/main.c
@@ -1,9 +1,9 @@
-/* $NetBSD: main.c,v 1.25 2012/06/19 05:30:43 dholland Exp $ */
+/* $NetBSD: main.c,v 1.26 2019/02/03 03:19:25 mrg Exp $ */
/* main.c */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: main.c,v 1.25 2012/06/19 05:30:43 dholland Exp $");
+__RCSID("$NetBSD: main.c,v 1.26 2019/02/03 03:19:25 mrg Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -793,6 +793,7 @@ parse(void)
savegame(savefilename);
wizard = 1;
died(-257); /* save the game - doesn't return */
+ __unreachable();
case 'Z':
yrepcount = 0;
@@ -918,6 +919,7 @@ parse(void)
case 'g':
cursors();
lprintf("\nThe stuff you are carrying presently weighs %ld pounds", (long) packweight());
+ /* FALLTHROUGH */
case ' ':
yrepcount = 0;
nomove = 1;
diff --git a/larn/monster.c b/larn/monster.c
index 35a329e5..9f19f39f 100644
--- a/larn/monster.c
+++ b/larn/monster.c
@@ -1,4 +1,4 @@
-/* $NetBSD: monster.c,v 1.18 2012/06/19 05:30:43 dholland Exp $ */
+/* $NetBSD: monster.c,v 1.19 2019/02/03 03:19:25 mrg Exp $ */
/*
* monster.c Larn is copyrighted 1986 by Noah Morgan.
@@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: monster.c,v 1.18 2012/06/19 05:30:43 dholland Exp $");
+__RCSID("$NetBSD: monster.c,v 1.19 2019/02/03 03:19:25 mrg Exp $");
#endif /* not lint */
#include <string.h>
@@ -1011,20 +1011,28 @@ dirsub(int *x, int *y)
switch (ttgetch()) {
case 'b':
i++;
+ /* FALLTHROUGH */
case 'n':
i++;
+ /* FALLTHROUGH */
case 'y':
i++;
+ /* FALLTHROUGH */
case 'u':
i++;
+ /* FALLTHROUGH */
case 'h':
i++;
+ /* FALLTHROUGH */
case 'k':
i++;
+ /* FALLTHROUGH */
case 'l':
i++;
+ /* FALLTHROUGH */
case 'j':
i++;
+ /* FALLTHROUGH */
goto out;
};
out:
diff --git a/larn/movem.c b/larn/movem.c
index b9745fcc..ef6ee340 100644
--- a/larn/movem.c
+++ b/larn/movem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: movem.c,v 1.9 2012/06/19 05:30:43 dholland Exp $ */
+/* $NetBSD: movem.c,v 1.10 2019/02/03 03:19:25 mrg Exp $ */
/*
* movem.c (move monster) Larn is copyrighted 1986 by Noah Morgan.
@@ -12,7 +12,7 @@
*/
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: movem.c,v 1.9 2012/06/19 05:30:43 dholland Exp $");
+__RCSID("$NetBSD: movem.c,v 1.10 2019/02/03 03:19:25 mrg Exp $");
#endif /* not lint */
#include "header.h"
@@ -185,6 +185,7 @@ movemt(int i, int j)
case OMIRROR:
if (mitem[m][k] == VAMPIRE)
goto smm;
+ /* FALLTHROUGH */
default:
screen[m][k] = 0;
break;
@@ -437,6 +438,7 @@ movsphere(void)
case 1:
case 2: /* change direction to a random one */
sp->dir = rnd(8);
+ /* FALLTHROUGH */
default: /* move in normal direction */
dir = sp->dir;
len = sp->lifetime;
diff --git a/larn/object.c b/larn/object.c
index a8e14496..942b6bce 100644
--- a/larn/object.c
+++ b/larn/object.c
@@ -1,10 +1,10 @@
-/* $NetBSD: object.c,v 1.16 2012/06/19 05:30:43 dholland Exp $ */
+/* $NetBSD: object.c,v 1.17 2019/02/03 03:19:25 mrg Exp $ */
/* object.c Larn is copyrighted 1986 by Noah Morgan. */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: object.c,v 1.16 2012/06/19 05:30:43 dholland Exp $");
+__RCSID("$NetBSD: object.c,v 1.17 2019/02/03 03:19:25 mrg Exp $");
#endif /* not lint */
#include "header.h"
#include "extern.h"
@@ -148,6 +148,7 @@ lookforobject(void)
item[playerx][playery] = OTELEPORTER;
know[playerx][playery] = 1;
+ /* FALLTHROUGH */
case OTELEPORTER:
lprcat("\nZaaaappp! You've been teleported!\n");
beep();
@@ -404,6 +405,7 @@ lookforobject(void)
item[playerx][playery] = OTRAPARROW;
know[playerx][playery] = 0;
+ /* FALLTHROUGH */
case OTRAPARROW:
lprcat("\nYou are hit by an arrow");
beep(); /* for an arrow trap */
@@ -418,6 +420,7 @@ lookforobject(void)
item[playerx][playery] = ODARTRAP;
know[playerx][playery] = 0;
+ /* FALLTHROUGH */
case ODARTRAP:
lprcat("\nYou are hit by a dart");
beep(); /* for a dart trap */
@@ -434,6 +437,7 @@ lookforobject(void)
item[playerx][playery] = OTRAPDOOR;
know[playerx][playery] = 1;
+ /* FALLTHROUGH */
case OTRAPDOOR:
lastnum = 272; /* a trap door */
if ((level == MAXLEVEL - 1) || (level == MAXLEVEL + MAXVLEVEL - 1)) {