From dc6514954049bf3d7c993996025a81414423c89b Mon Sep 17 00:00:00 2001 From: mrg Date: Sun, 3 Feb 2019 03:19:25 +0000 Subject: - 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 --- larn/main.c | 6 ++++-- larn/monster.c | 12 ++++++++++-- larn/movem.c | 6 ++++-- larn/object.c | 8 ++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) (limited to 'larn') 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 #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 @@ -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 #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 @@ -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 #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 #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)) { -- cgit v1.2.3-56-ge451