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 --- backgammon/teachgammon/teach.c | 12 ++++++++++-- battlestar/command2.c | 5 +++-- battlestar/command3.c | 6 ++++-- larn/main.c | 6 ++++-- larn/monster.c | 12 ++++++++++-- larn/movem.c | 6 ++++-- larn/object.c | 8 ++++++-- mille/move.c | 7 +++++-- phantasia/fight.c | 5 +++-- phantasia/main.c | 15 ++++++++++++--- phantasia/misc.c | 3 ++- quiz/quiz.c | 5 +++-- rogue/play.c | 5 +++-- rogue/room.c | 5 +++-- sail/pl_5.c | 5 +++-- 15 files changed, 75 insertions(+), 30 deletions(-) diff --git a/backgammon/teachgammon/teach.c b/backgammon/teachgammon/teach.c index f9805dc8..d2947923 100644 --- a/backgammon/teachgammon/teach.c +++ b/backgammon/teachgammon/teach.c @@ -1,4 +1,4 @@ -/* $NetBSD: teach.c,v 1.24 2013/09/13 20:46:50 joerg Exp $ */ +/* $NetBSD: teach.c,v 1.25 2019/02/03 03:19:25 mrg Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\ #if 0 static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: teach.c,v 1.24 2013/09/13 20:46:50 joerg Exp $"); +__RCSID("$NetBSD: teach.c,v 1.25 2019/02/03 03:19:25 mrg Exp $"); #endif #endif /* not lint */ @@ -98,34 +98,42 @@ main(int argc __unused, char *argv[]) if ((i = wrtext(intro2)) != 0) break; + /* FALLTHROUGH */ case 3: if ((i = wrtext(moves)) != 0) break; + /* FALLTHROUGH */ case 4: if ((i = wrtext(removepiece)) != 0) break; + /* FALLTHROUGH */ case 5: if ((i = wrtext(hits)) != 0) break; + /* FALLTHROUGH */ case 6: if ((i = wrtext(endgame)) != 0) break; + /* FALLTHROUGH */ case 7: if ((i = wrtext(doubl)) != 0) break; + /* FALLTHROUGH */ case 8: if ((i = wrtext(stragy)) != 0) break; + /* FALLTHROUGH */ case 9: if ((i = wrtext(prog)) != 0) break; + /* FALLTHROUGH */ case 10: if ((i = wrtext(lastch)) != 0) break; diff --git a/battlestar/command2.c b/battlestar/command2.c index 158e546a..530bcfde 100644 --- a/battlestar/command2.c +++ b/battlestar/command2.c @@ -1,4 +1,4 @@ -/* $NetBSD: command2.c,v 1.3 2005/07/01 06:04:54 jmc Exp $ */ +/* $NetBSD: command2.c,v 1.4 2019/02/03 03:19:25 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: command2.c,v 1.3 2005/07/01 06:04:54 jmc Exp $"); +__RCSID("$NetBSD: command2.c,v 1.4 2019/02/03 03:19:25 mrg Exp $"); #endif #endif /* not lint */ @@ -271,6 +271,7 @@ murder(void) puts("Your fantasy is over."); die(); } + /* FALLTHROUGH */ case -1: puts("Kill what?"); break; diff --git a/battlestar/command3.c b/battlestar/command3.c index 62b09d23..f4ccb6d9 100644 --- a/battlestar/command3.c +++ b/battlestar/command3.c @@ -1,4 +1,4 @@ -/* $NetBSD: command3.c,v 1.4 2018/02/04 08:48:05 mrg Exp $ */ +/* $NetBSD: command3.c,v 1.5 2019/02/03 03:19:25 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)com3.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: command3.c,v 1.4 2018/02/04 08:48:05 mrg Exp $"); +__RCSID("$NetBSD: command3.c,v 1.5 2019/02/03 03:19:25 mrg Exp $"); #endif #endif /* not lint */ @@ -145,9 +145,11 @@ bury(void) case NORMGOD: printf("She screams as you wrestle her into "); puts("the hole."); + /* FALLTHROUGH */ case TIMER: power += 7; ego -= 10; + /* FALLTHROUGH */ case AMULET: case MEDALION: case TALISMAN: 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)) { diff --git a/mille/move.c b/mille/move.c index c8631f0a..1528aa38 100644 --- a/mille/move.c +++ b/mille/move.c @@ -1,4 +1,4 @@ -/* $NetBSD: move.c,v 1.18 2011/08/31 16:24:56 plunky Exp $ */ +/* $NetBSD: move.c,v 1.19 2019/02/03 03:19:25 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: move.c,v 1.18 2011/08/31 16:24:56 plunky Exp $"); +__RCSID("$NetBSD: move.c,v 1.19 2019/02/03 03:19:25 mrg Exp $"); #endif #endif /* not lint */ @@ -232,12 +232,15 @@ mustpick: case C_200: if (pp->nummiles[C_200] == 2) return error("only two 200's per hand"); + /* FALLTHROUGH */ case C_100: case C_75: if (pp->speed == C_LIMIT) return error("limit of 50"); + /* FALLTHROUGH */ case C_50: if (pp->mileage + Value[card] > End) return error("puts you over %d", End); + /* FALLTHROUGH */ case C_25: if (!pp->can_go) return error("cannot move now"); diff --git a/phantasia/fight.c b/phantasia/fight.c index 1f01b9de..0a1ab064 100644 --- a/phantasia/fight.c +++ b/phantasia/fight.c @@ -1,4 +1,4 @@ -/* $NetBSD: fight.c,v 1.13 2009/08/31 08:27:16 dholland Exp $ */ +/* $NetBSD: fight.c,v 1.14 2019/02/03 03:19:25 mrg Exp $ */ /* * fight.c Phantasia monster fighting routines @@ -1316,6 +1316,7 @@ awardtreasure(void) /* fall through to treasure type 9 if * no treasure from above */ + /* FALLTHROUGH */ case 9: /* treasure type 9 */ switch (whichtreasure) { case 1: @@ -1326,8 +1327,8 @@ awardtreasure(void) ++Player.p_crowns; break; } - /* fall through otherwise */ + /* FALLTHROUGH */ case 2: addstr("You've been blessed!\n"); Player.p_blessing = TRUE; diff --git a/phantasia/main.c b/phantasia/main.c index bd17453e..c8850da8 100644 --- a/phantasia/main.c +++ b/phantasia/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.23 2009/08/31 08:27:16 dholland Exp $ */ +/* $NetBSD: main.c,v 1.24 2019/02/03 03:19:25 mrg Exp $ */ /* * Phantasia 3.3.2 -- Interterminal fantasy game @@ -108,11 +108,13 @@ main(int argc, char **argv) case 'a': /* all users */ activelist(); cleanup(TRUE); + __unreachable(); /* NOTREACHED */ case 'p': /* purge old players */ purgeoldplayers(); cleanup(TRUE); + __unreachable(); /* NOTREACHED */ case 'S': /* set 'Wizard' */ @@ -126,11 +128,13 @@ main(int argc, char **argv) case 'm': /* monsters */ monstlist(); cleanup(TRUE); + __unreachable(); /* NOTREACHED */ case 'b': /* scoreboard */ scorelist(); cleanup(TRUE); + __unreachable(); /* NOTREACHED */ } @@ -143,15 +147,18 @@ main(int argc, char **argv) if (examine) { changestats(FALSE); cleanup(TRUE); + __unreachable(); /* NOTREACHED */ } if (!noheader) { titlelist(); purgeoldplayers(); /* clean up old characters */ } - if (headeronly) + if (headeronly) { cleanup(TRUE); - /* NOTREACHED */ + __unreachable(); + /* NOTREACHED */ + } do /* get the player structure filled */ @@ -167,6 +174,7 @@ main(int argc, char **argv) case 'Q': cleanup(TRUE); + __unreachable(); /* NOTREACHED */ default: @@ -544,6 +552,7 @@ procmain(void) case '5': /* good-bye */ leavegame(); + __unreachable(); /* NOTREACHED */ case '6': /* cloak */ diff --git a/phantasia/misc.c b/phantasia/misc.c index 59785376..180d6137 100644 --- a/phantasia/misc.c +++ b/phantasia/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.21 2011/09/01 07:18:50 plunky Exp $ */ +/* $NetBSD: misc.c,v 1.22 2019/02/03 03:19:25 mrg Exp $ */ /* * misc.c Phantasia miscellaneous support routines @@ -729,6 +729,7 @@ altercoordinates(double xnew, double ynew, int operation) ynew = Player.p_y - ROLL(1.0, 5.0); /* fall through for check */ + /* FALLTHROUGH */ case A_SPECIFIC: /* just move player */ if (Beyond && fabs(xnew) < D_BEYOND && fabs(ynew) < D_BEYOND) /* diff --git a/quiz/quiz.c b/quiz/quiz.c index b2e76ba6..74b41e8f 100644 --- a/quiz/quiz.c +++ b/quiz/quiz.c @@ -1,4 +1,4 @@ -/* $NetBSD: quiz.c,v 1.27 2014/03/23 00:07:15 dholland Exp $ */ +/* $NetBSD: quiz.c,v 1.28 2019/02/03 03:19:25 mrg Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\ #if 0 static char sccsid[] = "@(#)quiz.c 8.3 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: quiz.c,v 1.27 2014/03/23 00:07:15 dholland Exp $"); +__RCSID("$NetBSD: quiz.c,v 1.28 2019/02/03 03:19:25 mrg Exp $"); #endif #endif /* not lint */ @@ -318,6 +318,7 @@ next_cat(const char *s) case ':': if (!esc) return (s); + /* FALLTHROUGH */ default: esc = 0; break; diff --git a/rogue/play.c b/rogue/play.c index 88245384..04f8a89f 100644 --- a/rogue/play.c +++ b/rogue/play.c @@ -1,4 +1,4 @@ -/* $NetBSD: play.c,v 1.9 2008/01/14 03:50:02 dholland Exp $ */ +/* $NetBSD: play.c,v 1.10 2019/02/03 03:19:25 mrg Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)play.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: play.c,v 1.9 2008/01/14 03:50:02 dholland Exp $"); +__RCSID("$NetBSD: play.c,v 1.10 2019/02/03 03:19:25 mrg Exp $"); #endif #endif /* not lint */ @@ -219,6 +219,7 @@ CH: break; case 'Q': quit(0); + __unreachable(); case '0': case '1': case '2': diff --git a/rogue/room.c b/rogue/room.c index 0071489f..7a75499c 100644 --- a/rogue/room.c +++ b/rogue/room.c @@ -1,4 +1,4 @@ -/* $NetBSD: room.c,v 1.13 2009/08/12 08:44:45 dholland Exp $ */ +/* $NetBSD: room.c,v 1.14 2019/02/03 03:19:25 mrg Exp $ */ /* * Copyright (c) 1988, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)room.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: room.c,v 1.13 2009/08/12 08:44:45 dholland Exp $"); +__RCSID("$NetBSD: room.c,v 1.14 2019/02/03 03:19:25 mrg Exp $"); #endif #endif /* not lint */ @@ -571,6 +571,7 @@ CH: opt_go(++i); break; } + /* FALLTHROUGH */ default: if (options[i].is_bool) { sound_bell(); diff --git a/sail/pl_5.c b/sail/pl_5.c index d149b933..240ac0b9 100644 --- a/sail/pl_5.c +++ b/sail/pl_5.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_5.c,v 1.25 2009/03/15 03:33:56 dholland Exp $ */ +/* $NetBSD: pl_5.c,v 1.26 2019/02/03 03:19:25 mrg Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)pl_5.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_5.c,v 1.25 2009/03/15 03:33:56 dholland Exp $"); +__RCSID("$NetBSD: pl_5.c,v 1.26 2019/02/03 03:19:25 mrg Exp $"); #endif #endif /* not lint */ @@ -78,6 +78,7 @@ acceptmove(void) switch (*p) { case 'l': dir -= 2; + /* FALLTHROUGH */ case 'r': if (++dir == 0) dir = 8; -- cgit v1.2.3-56-ge451