]> git.cameronkatri.com Git - bsdgames-darwin.git/commitdiff
- add or adjust /* FALLTHROUGH */ where appropriate
authormrg <mrg@NetBSD.org>
Sun, 3 Feb 2019 03:19:25 +0000 (03:19 +0000)
committermrg <mrg@NetBSD.org>
Sun, 3 Feb 2019 03:19:25 +0000 (03:19 +0000)
- add __unreachable() after functions that can return but won't in
  this case, and thus can't be marked __dead easily

15 files changed:
backgammon/teachgammon/teach.c
battlestar/command2.c
battlestar/command3.c
larn/main.c
larn/monster.c
larn/movem.c
larn/object.c
mille/move.c
phantasia/fight.c
phantasia/main.c
phantasia/misc.c
quiz/quiz.c
rogue/play.c
rogue/room.c
sail/pl_5.c

index f9805dc88bc5c9107a1968561c1fc51c38eb95cd..d2947923cd1adadcf810a1ed3f7fd52b48ec1a9f 100644 (file)
@@ -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;
index 158e546a009b14f56d4a5b1a27be394b52077bb0..530bcfde44835cfe19ed5235df34a7028b6c2731 100644 (file)
@@ -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;
index 62b09d2383c5fa8c44543b38b5b77c66136f0443..f4ccb6d916e3b5375bc05ef0260798aaf19ddda6 100644 (file)
@@ -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:
index 1b442d6d9b95611fbd626c4f2f2769b9513b5db2..7b619f878fe270cfa566cf59b9876f9c4116689f 100644 (file)
@@ -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;
index 35a329e5d9c087be9a06fbb263de11669243ab51..9f19f39f229c40cb58a76c15f85109d26eb2cfed 100644 (file)
@@ -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.
  */
 #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:
index b9745fcc43f570f91fc6baf3c36fd3d1c942af16..ef6ee3406e87fc8be2750671dda6eb0d17a59615 100644 (file)
@@ -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;
index a8e144969cd1dc09bc9506b6ddcf861bfbf61bfc..942b6bce3e522d1eacb08a799ae299108b605a1a 100644 (file)
@@ -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)) {
index c8631f0a7285b58e61065eb10dcd9c9a5cf0e367..1528aa38173be1a2217071f8c45ca14bde31c0c4 100644 (file)
@@ -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");
index 1f01b9deeb91424b64bea73d0974a2d52c3abef8..0a1ab064dc5f03af6967f298469bdfe3563ed018 100644 (file)
@@ -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;
index bd17453e0660bd1987ea8ef407e89592ca4589de..c8850da86a4eaf591a9bed9c4991efab21d353a8 100644 (file)
@@ -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 */
index 597853769e0cecb5207c3f5a2507375ea4c8accb..180d6137337ad8a075cf7ef1666377a1242e1782 100644 (file)
@@ -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)
                        /*
index b2e76ba65ada3d2fe842836f478772ff83260c88..74b41e8ff5f99ce900c322d651dfaf3de92ad322 100644 (file)
@@ -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;
index 88245384fac8714f014abbf803aa47476e43c773..04f8a89fc1ae70b12927edba41cc8d4d7b4c4278 100644 (file)
@@ -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':
index 0071489f180b966978edc03821561b78a0968759..7a75499ce3cc0b2eccd42b7dcb63dbfa4058de8d 100644 (file)
@@ -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();
index d149b9330330688cb1c074bf17b3dc89da0017ad..240ac0b9d90df16b786287762048e7a8749104c3 100644 (file)
@@ -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;