diff --git a/include/tradstdc.h b/include/tradstdc.h index c5a9368fb..b607d4a99 100644 --- a/include/tradstdc.h +++ b/include/tradstdc.h @@ -327,13 +327,20 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ /* * Give first priority to standard */ -#ifndef ATTRNORETURN #if defined(__STDC_VERSION__) || defined(__cplusplus) #if (__STDC_VERSION__ > 202300L) || defined(__cplusplus) +#ifndef ATTRNORETURN #define ATTRNORETURN [[noreturn]] #endif -#endif -#endif +#ifndef __has_c_attribute +#define __has_c_attribute(x) 0 +#endif /* __has_c_attribute */ +#if __has_c_attribute(fallthrough) +/* Standard attribute is available, use it. */ +#define FALLTHROUGH [[fallthrough]] +#endif /* __has_c_attribute(fallthrough) */ +#endif /* __STDC_VERSION__ gt 202300L || __cplusplus */ +#endif /* __STDC_VERSION || __cplusplus */ /* * Allow gcc2 to check parameters of printf-like calls with -Wformat; @@ -366,12 +373,21 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ #endif /* !NONNULLS_DEFINED */ /* #pragma message is available */ #define NH_PRAGMA_MESSAGE 1 -#endif -#endif +#endif /* __GNUC__ greater than or equal to 5 */ +#endif /* __GNUC__ */ -#if defined(__clang__) && !defined(DO_DEFINE_NONNULLS) +#if defined(__clang__) +#ifndef FALLTHROUGH +#if defined(__clang_major__) +#if __clang_major__ >= 9 +#define FALLTHROUGH __attribute__((fallthrough)) +#endif /* __clang_major__ greater than or equal to 9 */ +#endif /* __clang_major__ is defined */ +#endif /* FALLTHROUGH */ +#if !defined(DO_DEFINE_NONNULLS) #define DO_DEFINE_NONNULLS #endif +#endif /* __clang__ */ #if defined(DO_DEFINE_NONNULLS) && !defined(NONNULLS_DEFINED) #define NONNULL __attribute__((returns_nonnull)) @@ -405,6 +421,7 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ #define NH_PRAGMA_MESSAGE 1 #endif +/* Fallback implementations */ #ifndef PRINTF_F #define PRINTF_F(f, v) #endif @@ -414,6 +431,9 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ #ifndef UNUSED #define UNUSED #endif +#ifndef FALLTHROUGH +#define FALLTHROUGH +#endif #ifndef ATTRNORETURN #define ATTRNORETURN #endif diff --git a/src/allmain.c b/src/allmain.c index 4d281fe7f..253ac82a4 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -1040,6 +1040,7 @@ argcheck(int argc, char *argv[], enum earlyarg e_arg) extended_opt++; return windows_early_options(extended_opt); } + FALLTHROUGH; /*FALLTHRU*/ #endif default: diff --git a/src/apply.c b/src/apply.c index 271a6cd18..6f1112359 100644 --- a/src/apply.c +++ b/src/apply.c @@ -3772,6 +3772,7 @@ use_grapple(struct obj *obj) (void) thitmonst(mtmp, uwep); return ECMD_TIME; } + FALLTHROUGH; /*FALLTHRU*/ case 3: /* Surface */ if (IS_AIR(levl[cc.x][cc.y].typ) || is_pool(cc.x, cc.y)) @@ -3891,6 +3892,7 @@ do_break_wand(struct obj *obj) discard_broken_wand(); return ECMD_TIME; } + FALLTHROUGH; /*FALLTHRU*/ case WAN_WISHING: case WAN_NOTHING: @@ -3919,6 +3921,7 @@ do_break_wand(struct obj *obj) Soundeffect(se_wall_of_force, 65); pline("A wall of force smashes down around you!"); dmg = d(1 + obj->spe, 6); /* normally 2d12 */ + FALLTHROUGH; /*FALLTHRU*/ case WAN_CANCELLATION: case WAN_POLYMORPH: @@ -4304,6 +4307,7 @@ doapply(void) pline("It rings! ... But no-one answers."); break; } + FALLTHROUGH; /*FALLTHRU*/ default: /* Pole-weapons can strike at a distance */ diff --git a/src/ball.c b/src/ball.c index c3c53c289..d6ba11017 100644 --- a/src/ball.c +++ b/src/ball.c @@ -743,7 +743,8 @@ drag_ball(coordxy x, coordxy y, int *bc_control, SKIP_TO_DRAG; break; } - /* fall through */ + FALLTHROUGH; + /* FALLTHRU */ case 1: case 0: /* do nothing if possible */ diff --git a/src/dbridge.c b/src/dbridge.c index 8e2f081bd..5e739d4fa 100644 --- a/src/dbridge.c +++ b/src/dbridge.c @@ -255,6 +255,7 @@ create_drawbridge(coordxy x, coordxy y, int dir, boolean flag) break; default: impossible("bad direction in create_drawbridge"); + FALLTHROUGH; /*FALLTHRU*/ case DB_WEST: horiz = FALSE; diff --git a/src/display.c b/src/display.c index 9902040a2..0e9cca612 100644 --- a/src/display.c +++ b/src/display.c @@ -528,6 +528,7 @@ display_monster( default: impossible("display_monster: bad m_ap_type value [ = %d ]", (int) mon->m_ap_type); + FALLTHROUGH; /*FALLTHRU*/ case M_AP_NOTHING: show_glyph(x, y, mon_to_glyph(mon, newsym_rn2)); @@ -3566,6 +3567,7 @@ wall_angle(struct rm *lev) case SDOOR: if (lev->horizontal) goto horiz; + FALLTHROUGH; /*FALLTHRU*/ case VWALL: switch (lev->wall_info & WM_MASK) { diff --git a/src/do.c b/src/do.c index f4f7c3e4d..fe07407c1 100644 --- a/src/do.c +++ b/src/do.c @@ -2217,6 +2217,7 @@ revive_corpse(struct obj *corpse) fill_pit(mtmp->mx, mtmp->my); break; } + FALLTHROUGH; /*FALLTHRU*/ default: /* we should be able to handle the other cases... */ diff --git a/src/do_name.c b/src/do_name.c index aa4463cda..d1d53f36e 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -442,6 +442,7 @@ objtyp_is_callable(int i) determine which one was the real one */ if (i == AMULET_OF_YENDOR || i == FAKE_AMULET_OF_YENDOR) break; /* return FALSE */ + FALLTHROUGH; /*FALLTHRU*/ case SCROLL_CLASS: case POTION_CLASS: diff --git a/src/do_wear.c b/src/do_wear.c index e7cc1be64..1b5b57dfd 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -452,6 +452,7 @@ Helmet_on(void) : (uarmh->o_id % 2) ? A_CHAOTIC : A_LAWFUL, A_CG_HELM_ON); /* makeknown(HELM_OF_OPPOSITE_ALIGNMENT); -- below, after Tobjnam() */ + FALLTHROUGH; /*FALLTHRU*/ case DUNCE_CAP: if (uarmh && !uarmh->cursed) { diff --git a/src/dog.c b/src/dog.c index 9c4f85560..6134355f9 100644 --- a/src/dog.c +++ b/src/dog.c @@ -523,7 +523,9 @@ mon_arrive(struct monst *mtmp, int when) } else if (!(u.uevent.qexpelled && (Is_qstart(&u.uz0) || Is_qstart(&u.uz)))) { impossible("mon_arrive: no corresponding portal?"); - } /*FALLTHRU*/ + } + FALLTHROUGH; + /*FALLTHRU*/ default: case MIGR_RANDOM: xlocale = ylocale = 0; @@ -1076,6 +1078,7 @@ dogfood(struct monst *mon, struct obj *obj) && obj->oclass != BALL_CLASS && obj->oclass != CHAIN_CLASS) return APPORT; + FALLTHROUGH; /*FALLTHRU*/ case ROCK_CLASS: return UNDEF; diff --git a/src/dogmove.c b/src/dogmove.c index 2c77a6487..29c0d9bc1 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -76,6 +76,7 @@ droppables(struct monst *mon) if (pickaxe && pickaxe->otyp == PICK_AXE && pickaxe != wep && (!pickaxe->oartifact || obj->oartifact)) return pickaxe; /* drop the one we earlier decided to keep */ + FALLTHROUGH; /*FALLTHRU*/ case PICK_AXE: if (!pickaxe || (obj->oartifact && !pickaxe->oartifact)) { @@ -104,12 +105,14 @@ droppables(struct monst *mon) if (key && key->otyp == LOCK_PICK && (!key->oartifact || obj->oartifact)) return key; /* drop the one we earlier decided to keep */ + FALLTHROUGH; /*FALLTHRU*/ case LOCK_PICK: /* keep lock-pick in preference to credit card */ if (key && key->otyp == CREDIT_CARD && (!key->oartifact || obj->oartifact)) return key; + FALLTHROUGH; /*FALLTHRU*/ case CREDIT_CARD: if (!key || (obj->oartifact && !key->oartifact)) { diff --git a/src/dokick.c b/src/dokick.c index b9d25eaaf..cf8bb405b 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1340,6 +1340,7 @@ dokick(void) pline("%s burps loudly.", Monnam(u.ustuck)); break; } + FALLTHROUGH; /*FALLTHRU*/ default: Your("feeble kick has no effect."); @@ -1484,6 +1485,7 @@ drop_to(coord *cc, schar loc, coordxy x, coordxy y) cc->y = cc->x = 0; break; } + FALLTHROUGH; /*FALLTHRU*/ case MIGR_STAIRS_UP: case MIGR_LADDER_UP: @@ -1800,6 +1802,7 @@ obj_delivery(boolean near_hero) switch (where) { case MIGR_LADDER_UP: isladder = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case MIGR_STAIRS_UP: case MIGR_SSTAIRS: diff --git a/src/dothrow.c b/src/dothrow.c index 30af1e40b..7dcf043f9 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -67,6 +67,7 @@ multishot_class_bonus( case PM_NINJA: if (skill == -P_SHURIKEN || skill == -P_DART) multishot++; + FALLTHROUGH; /*FALLTHRU*/ case PM_SAMURAI: /* role-specific launcher and its ammo */ @@ -175,6 +176,7 @@ throw_obj(struct obj *obj, int shotlimit) switch (P_SKILL(weapon_type(obj))) { case P_EXPERT: multishot++; + FALLTHROUGH; /*FALLTHRU*/ case P_SKILLED: if (!weakmultishot) @@ -1295,6 +1297,7 @@ toss_up(struct obj *obj, boolean hitsroof) Your("%s fails to protect you.", helm_simple_name(uarmh)); goto petrify; } + FALLTHROUGH; /*FALLTHRU*/ case CREAM_PIE: case BLINDING_VENOM: @@ -2572,12 +2575,14 @@ breakmsg(struct obj *obj, boolean in_view) default: /* glass or crystal wand */ if (obj->oclass != WAND_CLASS) impossible("breaking odd object (%d)?", obj->otyp); + FALLTHROUGH; /*FALLTHRU*/ case LENSES: case MIRROR: case CRYSTAL_BALL: case EXPENSIVE_CAMERA: to_pieces = " into a thousand pieces"; + FALLTHROUGH; /*FALLTHRU*/ case POT_WATER: /* really, all potions */ if (!in_view) diff --git a/src/dungeon.c b/src/dungeon.c index e75808a31..dc8557ed4 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -3039,6 +3039,7 @@ count_feat_lastseentyp( } if (is_drawbridge_wall(x, y) < 0) break; + FALLTHROUGH; /*FALLTHRU*/ case DBWALL: case DRAWBRIDGE_DOWN: diff --git a/src/eat.c b/src/eat.c index e2c369ae8..a73cf2080 100644 --- a/src/eat.c +++ b/src/eat.c @@ -848,6 +848,7 @@ cprefx(int pm) make_slimed(10L, (char *) 0); delayed_killer(SLIMED, KILLED_BY_AN, ""); } + FALLTHROUGH; /* Fall through */ default: if (acidic(&mons[pm]) && Stoned) @@ -1164,19 +1165,23 @@ cpostfx(int pm) HSee_invisible |= FROMOUTSIDE; } newsym(u.ux, u.uy); + FALLTHROUGH; /*FALLTHRU*/ case PM_YELLOW_LIGHT: case PM_GIANT_BAT: make_stunned((HStun & TIMEOUT) + 30L, FALSE); + FALLTHROUGH; /*FALLTHRU*/ case PM_BAT: make_stunned((HStun & TIMEOUT) + 30L, FALSE); break; case PM_GIANT_MIMIC: tmp += 10; + FALLTHROUGH; /*FALLTHRU*/ case PM_LARGE_MIMIC: tmp += 20; + FALLTHROUGH; /*FALLTHRU*/ case PM_SMALL_MIMIC: tmp += 20; @@ -1278,6 +1283,7 @@ cpostfx(int pm) } else { pline("For some reason, that tasted bland."); } + FALLTHROUGH; /*FALLTHRU*/ default: check_intrinsics = TRUE; @@ -2143,6 +2149,7 @@ fprefx(struct obj *otmp) break; } iter_mons(garlic_breath); + FALLTHROUGH; /*FALLTHRU*/ default: if (otmp->otyp == SLIME_MOLD && !otmp->cursed diff --git a/src/engrave.c b/src/engrave.c index 8105efeec..88ac6b29e 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -606,6 +606,7 @@ doengrave_sfx_item_WAN(struct _doengrave_ctx *de) "A few ice cubes drop from the wand."); if (!de->oep || (de->oep->engr_type != BURN)) break; + FALLTHROUGH; /*FALLTHRU*/ case WAN_CANCELLATION: case WAN_MAKE_INVISIBLE: @@ -706,6 +707,7 @@ doengrave_sfx_item(struct _doengrave_ctx *de) de->type = DUST; break; } + FALLTHROUGH; /*FALLTHRU*/ /* Objects too large to engrave with */ case BALL_CLASS: diff --git a/src/fountain.c b/src/fountain.c index 1d4150630..979bb0518 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -359,6 +359,7 @@ drinkfountain(void) dofindgem(); break; } + FALLTHROUGH; /*FALLTHRU*/ case 28: /* Water Nymph */ dowaternymph(); @@ -486,6 +487,7 @@ dipfountain(struct obj *obj) dofindgem(); break; } + FALLTHROUGH; /*FALLTHRU*/ case 25: /* Water gushes forth */ dogushforth(FALSE); @@ -699,6 +701,7 @@ drinksink(void) pline("From the murky drain, a hand reaches up... --oops--"); break; } + FALLTHROUGH; /*FALLTHRU*/ default: You("take a sip of %s %s.", @@ -770,6 +773,7 @@ dipsink(struct obj *obj) try_call = TRUE; break; } + FALLTHROUGH; /* FALLTHRU */ case POT_GAIN_LEVEL: case POT_GAIN_ENERGY: diff --git a/src/getpos.c b/src/getpos.c index 0152fba53..36e9d95ea 100644 --- a/src/getpos.c +++ b/src/getpos.c @@ -465,6 +465,7 @@ gather_locs_interesting(coordxy x, coordxy y, int gloc) case GLOC_VALID: if (getpos_getvalid) return (*getpos_getvalid)(x, y); + FALLTHROUGH; /*FALLTHRU*/ case GLOC_INTERESTING: return (gather_locs_interesting(x, y, GLOC_DOOR) diff --git a/src/hack.c b/src/hack.c index 1f66f813b..6f8cce1d1 100644 --- a/src/hack.c +++ b/src/hack.c @@ -571,6 +571,7 @@ moverock_core(coordxy sx, coordxy sy) dopush(sx, sy, rx, ry, otmp, costly); continue; } + FALLTHROUGH; /*FALLTHRU*/ case TELEP_TRAP: rock_disappear_msg(otmp); @@ -2553,6 +2554,7 @@ escape_from_sticky_mon(coordxy x, coordxy y) u.ustuck->mfrozen = 1; u.ustuck->msleeping = 0; } + FALLTHROUGH; /*FALLTHRU*/ default: if (u.ustuck->mtame && !Conflict && !u.ustuck->mconf) @@ -3573,6 +3575,7 @@ check_special_room(boolean newlev) } case TEMPLE: intemple(roomno + ROOMOFFSET); + FALLTHROUGH; /*FALLTHRU*/ default: msg_given = (rt == TEMPLE || rt >= SHOPBASE); @@ -4317,6 +4320,7 @@ spot_checks(coordxy x, coordxy y, schar old_typ) switch (old_typ) { case DRAWBRIDGE_UP: db_ice_now = ((levl[x][y].drawbridgemask & DB_UNDER) == DB_ICE); + FALLTHROUGH; /*FALLTHRU*/ case ICE: if ((new_typ != old_typ) diff --git a/src/insight.c b/src/insight.c index 7a04f4efe..c1e17e954 100644 --- a/src/insight.c +++ b/src/insight.c @@ -1968,6 +1968,8 @@ attributes_enlightenment( switch (u.umortality) { case 0: impossible("dead without dying?"); + FALLTHROUGH; + /* FALLTHRU */ case 1: break; /* just "are dead" */ default: @@ -2624,6 +2626,7 @@ vanqsort_cmp( res = uniq2 - uniq1; break; } /* else both unique or neither unique */ + FALLTHROUGH; /*FALLTHRU*/ case VANQ_ALPHA_MIX: name1 = mons[indx1].pmnames[NEUTRAL]; diff --git a/src/invent.c b/src/invent.c index 1e375fc66..be0dff2cc 100644 --- a/src/invent.c +++ b/src/invent.c @@ -2463,6 +2463,7 @@ askchain( switch (sym) { case 'a': allflag = 1; + FALLTHROUGH; /*FALLTHRU*/ case 'y': tmp = (*fn)(otmp); @@ -2481,10 +2482,13 @@ askchain( cnt += tmp; if (--mx == 0) goto ret; + FALLTHROUGH; /*FALLTHRU*/ case 'n': if (nodot) dud++; + FALLTHROUGH; + /*FALLTHRU*/ default: break; case 'q': @@ -2975,6 +2979,7 @@ itemactions_pushkeys(struct obj *otmp, int act) switch (act) { default: impossible("Unknown item action"); + break; case IA_NONE: break; case IA_UNWIELD: diff --git a/src/makemon.c b/src/makemon.c index 947a8884d..e8c6bf298 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -521,6 +521,7 @@ m_initweap(struct monst *mtmp) */ if (!is_demon(ptr)) break; + FALLTHROUGH; /*FALLTHRU*/ default: /* @@ -704,12 +705,15 @@ m_initinv(struct monst *mtmp) /* MAJOR fall through ... */ case 0: (void) mongets(mtmp, WAN_MAGIC_MISSILE); + FALLTHROUGH; /*FALLTHRU*/ case 1: (void) mongets(mtmp, POT_EXTRA_HEALING); + FALLTHROUGH; /*FALLTHRU*/ case 2: (void) mongets(mtmp, POT_HEALING); + FALLTHROUGH; /*FALLTHRU*/ case 3: (void) mongets(mtmp, WAN_STRIKING); diff --git a/src/mcastu.c b/src/mcastu.c index 8c28b2507..a968d7e0a 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -84,6 +84,7 @@ choose_magic_spell(int spellval) case 23: if (Antimagic || Hallucination) return MGC_PSI_BOLT; + FALLTHROUGH; /*FALLTHRU*/ case 22: case 21: @@ -138,6 +139,7 @@ choose_clerical_spell(int spellnum) case 14: if (rn2(3)) return CLC_OPEN_WOUNDS; + FALLTHROUGH; /*FALLTHRU*/ case 13: return CLC_GEYSER; diff --git a/src/mhitm.c b/src/mhitm.c index 2473c1417..f54dc4ad2 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -405,6 +405,7 @@ mattackm( mswingsm(magr, mdef, mwep); tmp += hitval(mwep, mdef); } + FALLTHROUGH; /*FALLTHRU*/ case AT_CLAW: case AT_KICK: @@ -683,6 +684,7 @@ hitmm( Snprintf(buf, sizeof buf, "%s squeezes", magr_name); break; } + FALLTHROUGH; /*FALLTHRU*/ default: if (!weaponhit || !mwep || !mwep->oartifact) diff --git a/src/mkmaze.c b/src/mkmaze.c index c1e2b6205..2aa526ce0 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -588,6 +588,7 @@ fixup_special(void) sp = find_level(r->rname.str); lev = sp->dlevel; } + FALLTHROUGH; /*FALLTHRU*/ case LR_UPSTAIR: @@ -2073,6 +2074,7 @@ mv_bubble(struct bubble *b, coordxy dx, coordxy dy, boolean ini) break; case 3: b->dy = -b->dy; + FALLTHROUGH; /*FALLTHRU*/ case 2: b->dx = -b->dx; diff --git a/src/mkobj.c b/src/mkobj.c index 73126264e..8a9be1e0d 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -325,6 +325,7 @@ mkbox_cnts(struct obj *box) n = 0; break; } + FALLTHROUGH; /*FALLTHRU*/ case BAG_OF_HOLDING: n = 1; @@ -999,6 +1000,7 @@ mksobj_init(struct obj *otmp, boolean artif) case LARGE_BOX: otmp->olocked = !!(rn2(5)); otmp->otrapped = !(rn2(10)); + FALLTHROUGH; /*FALLTHRU*/ case ICE_BOX: case SACK: @@ -1184,6 +1186,7 @@ mksobj(int otyp, boolean init, boolean artif) if (svm.mvitals[otmp->corpsenm].mvflags & (G_NOCORPSE | G_GONE)) otmp->corpsenm = gu.urole.mnum; } + FALLTHROUGH; /*FALLTHRU*/ case STATUE: case FIGURINE: @@ -1197,6 +1200,7 @@ mksobj(int otyp, boolean init, boolean artif) : is_male(ptr) ? CORPSTAT_MALE : rn2(2) ? CORPSTAT_FEMALE : CORPSTAT_MALE); } + FALLTHROUGH; /*FALLTHRU*/ case EGG: /* case TIN: */ @@ -1210,6 +1214,7 @@ mksobj(int otyp, boolean init, boolean artif) break; case POT_OIL: otmp->age = MAX_OIL_IN_FLASK; /* amount of oil */ + FALLTHROUGH; /*FALLTHRU*/ case POT_WATER: /* POTION_CLASS */ otmp->fromsink = 0; /* overloads corpsenm, which was set to NON_PM */ @@ -2982,6 +2987,7 @@ objlist_sanity(struct obj *objlist, int wheretype, const char *mesg) /* note: ball and chain can also be OBJ_FREE, but not across turns so this sanity check shouldn't encounter that */ bc_ok = TRUE; + FALLTHROUGH; /*FALLTHRU*/ default: if ((obj != uchain && obj != uball) || !bc_ok) { diff --git a/src/mon.c b/src/mon.c index 1c2ecad07..69d206065 100644 --- a/src/mon.c +++ b/src/mon.c @@ -861,7 +861,6 @@ make_corpse(struct monst *mtmp, unsigned int corpseflags) case PM_PAGE: case PM_ABBOT: case PM_ACOLYTE: case PM_HUNTER: case PM_THUG: case PM_NINJA: case PM_ROSHI: case PM_GUIDE: case PM_WARRIOR: case PM_APPRENTICE: - /*FALLTHRU*/ #else default: #endif @@ -3076,7 +3075,8 @@ mondead(struct monst *mtmp) (void) makemon(mtmp->data, stway->sx, stway->sy, NO_MM_FLAGS); break; } - /* fall-through */ + FALLTHROUGH; + /* FALLTHRU */ case 2: /* randomly */ (void) makemon(mtmp->data, 0, 0, NO_MM_FLAGS); break; @@ -4791,12 +4791,14 @@ pickvampshape(struct monst *mon) if (mon_has_special(mon)) break; /* leave mndx as is */ wolfchance = 3; + FALLTHROUGH; /*FALLTHRU*/ case PM_VAMPIRE_LEADER: /* vampire lord or Vlad can become wolf */ if (!rn2(wolfchance) && !uppercase_only) { mndx = PM_WOLF; break; } + FALLTHROUGH; /*FALLTHRU*/ case PM_VAMPIRE: /* any vampire can become fog or bat */ mndx = (!rn2(4) && !uppercase_only) ? PM_FOG_CLOUD : PM_VAMPIRE_BAT; @@ -4900,6 +4902,7 @@ validvamp(struct monst *mon, int *mndx_p, int monclass) *mndx_p = PM_WOLF; break; } + FALLTHROUGH; /*FALLTHRU*/ default: *mndx_p = NON_PM; diff --git a/src/monmove.c b/src/monmove.c index 0b5cde2e1..f27f8bdee 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -887,6 +887,7 @@ dochug(struct monst *mtmp) case MMOVE_NOMOVES: if (scared) panicattk = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case MMOVE_NOTHING: /* no movement, but it can still attack you */ case MMOVE_DONE: /* absolutely no movement */ @@ -1758,6 +1759,7 @@ m_move(struct monst *mtmp, int after) break; default: impossible("unknown shk/gd/pri_move return value (%d)", xm); + FALLTHROUGH; /*FALLTHRU*/ case 0: case 1: diff --git a/src/mthrowu.c b/src/mthrowu.c index 455220098..5c41ea428 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -655,6 +655,7 @@ m_throw( hitu = 0; break; } + FALLTHROUGH; /*FALLTHRU*/ case CREAM_PIE: case BLINDING_VENOM: @@ -851,6 +852,7 @@ spitmm(struct monst *mtmp, struct attack *mattk, struct monst *mtarg) break; default: impossible("bad attack type in spitmm"); + FALLTHROUGH; /*FALLTHRU*/ case AD_ACID: otmp = mksobj(ACID_VENOM, TRUE, FALSE); diff --git a/src/muse.c b/src/muse.c index cb2c72a2b..0cece8f6a 100644 --- a/src/muse.c +++ b/src/muse.c @@ -1201,6 +1201,7 @@ rnd_defensive_item(struct monst *mtmp) goto try_again; if (!rn2(3)) return WAN_TELEPORTATION; + FALLTHROUGH; /*FALLTHRU*/ case 0: case 1: @@ -1209,6 +1210,7 @@ rnd_defensive_item(struct monst *mtmp) case 10: if (!rn2(3)) return WAN_CREATE_MONSTER; + FALLTHROUGH; /*FALLTHRU*/ case 2: return SCR_CREATE_MONSTER; @@ -1968,7 +1970,9 @@ rnd_offensive_item(struct monst *mtmp) if (hard_helmet(mtmp_helmet) || amorphous(pm) || passes_walls(pm) || noncorporeal(pm) || unsolid(pm)) return SCR_EARTH; - } /* fall through */ + } + FALLTHROUGH; + /* FALLTHRU */ case 1: return WAN_STRIKING; case 2: diff --git a/src/music.c b/src/music.c index 241f53aee..82fe8abcc 100644 --- a/src/music.c +++ b/src/music.c @@ -443,6 +443,7 @@ do_earthquake(int force) unblock_point(x, y); if (cansee(x, y)) pline("A secret corridor is revealed."); + FALLTHROUGH; /*FALLTHRU*/ case CORR: case ROOM: @@ -452,6 +453,7 @@ do_earthquake(int force) cvt_sdoor_to_door(&levl[x][y]); /* .typ = DOOR */ if (cansee(x, y)) pline("A secret door is revealed."); + FALLTHROUGH; /*FALLTHRU*/ case DOOR: /* make the door collapse */ /* if already doorless, treat like room or corridor */ diff --git a/src/nhlua.c b/src/nhlua.c index 08de9cfe1..becef1302 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -1996,6 +1996,8 @@ nhl_pcall_handle(lua_State *L, int nargs, int nresults, const char *name, case NHLpa_panic: panic("Lua error %d:%s %s", nud->sid, nud->name ? nud->name : "(unknown)", lua_tostring(L, -1)); + /*NOTREACHED*/ + break; case NHLpa_impossible: impossible("Lua error: %d:%s %s", nud->sid, nud->name ? nud->name : "(unknown)", diff --git a/src/objnam.c b/src/objnam.c index 334d5b7ed..94315442a 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -677,6 +677,7 @@ xname_flags( case WEAPON_CLASS: if (is_poisonable(obj) && obj->opoisoned) Strcpy(buf, "poisoned "); + FALLTHROUGH; /*FALLTHRU*/ case VENOM_CLASS: case TOOL_CLASS: @@ -1391,6 +1392,7 @@ doname_base( ConcatF1(bp, 1, ", %s lit)", arti_light_description(obj)); } } + FALLTHROUGH; /*FALLTHRU*/ case WEAPON_CLASS: if (ispoisoned) @@ -5077,7 +5079,8 @@ readobjnam(char *bp, struct obj *no_wish) break; case SLIME_MOLD: d.otmp->spe = d.ftype; - /* Fall through */ + FALLTHROUGH; + /* FALLTHRU */ case SKELETON_KEY: case CHEST: case LARGE_BOX: @@ -5109,7 +5112,8 @@ readobjnam(char *bp, struct obj *no_wish) /* scroll of mail: 0: delivered in-game via external event (or randomly for fake mail); 1: from bones or wishing; 2: written with marker */ case SCR_MAIL: - /*FALLTHRU*/ + d.otmp->spe = 1; + break; #endif /* splash of venom: 0: normal, and transitory; 1: wishing */ case ACID_VENOM: @@ -5121,6 +5125,7 @@ readobjnam(char *bp, struct obj *no_wish) d.otmp->spe = (rn2(10) ? -1 : 0); break; } + FALLTHROUGH; /*FALLTHRU*/ default: d.otmp->spe = d.spe; diff --git a/src/options.c b/src/options.c index 8abfcdc59..0a9a7dc85 100644 --- a/src/options.c +++ b/src/options.c @@ -3624,6 +3624,7 @@ optfn_scores( allopt[optidx].name); return optn_silenterr; } + FALLTHROUGH; /*FALLTHRU*/ default: config_error_add("Unknown %s parameter '%s'", diff --git a/src/pager.c b/src/pager.c index 079d182a7..d067b3f87 100644 --- a/src/pager.c +++ b/src/pager.c @@ -765,6 +765,7 @@ lookat(coordxy x, coordxy y, char *buf, char *monbuf) Strcpy(buf, "stone"); break; } + FALLTHROUGH; /*FALLTHRU*/ default: Strcpy(buf, defsyms[symidx].explanation); diff --git a/src/pickup.c b/src/pickup.c index df8896fe4..a1c2ccb78 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -870,6 +870,7 @@ pickup(int what) /* should be a long */ lcount = (long) yn_number; if (lcount > obj->quan) lcount = obj->quan; + FALLTHROUGH; /*FALLTHRU*/ default: /* 'y' */ break; @@ -1478,6 +1479,7 @@ query_category( /* assert( n == 1 ); */ break; /* from switch */ } + FALLTHROUGH; /*FALLTHRU*/ case 'q': default: diff --git a/src/polyself.c b/src/polyself.c index 9d619f6bb..38f9b01ea 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -1450,6 +1450,7 @@ dospit(void) break; default: impossible("bad attack type in dospit"); + FALLTHROUGH; /*FALLTHRU*/ case AD_ACID: otmp = mksobj(ACID_VENOM, TRUE, FALSE); diff --git a/src/potion.c b/src/potion.c index 68c9d165e..25989fff5 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1721,16 +1721,19 @@ potionhit(struct monst *mon, struct obj *obj, int how) switch (obj->otyp) { case POT_FULL_HEALING: cureblind = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case POT_EXTRA_HEALING: if (!obj->cursed) cureblind = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case POT_HEALING: if (obj->blessed) cureblind = TRUE; if (mon->data == &mons[PM_PESTILENCE]) goto do_illness; + FALLTHROUGH; /*FALLTHRU*/ case POT_RESTORE_ABILITY: case POT_GAIN_ABILITY: @@ -1960,6 +1963,7 @@ potionbreathe(struct obj *obj) if (u.uhp < u.uhpmax) u.uhp++, disp.botl = TRUE; cureblind = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case POT_EXTRA_HEALING: if (Upolyd && u.mh < u.mhmax) @@ -1968,6 +1972,7 @@ potionbreathe(struct obj *obj) u.uhp++, disp.botl = TRUE; if (!obj->cursed) cureblind = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case POT_HEALING: if (Upolyd && u.mh < u.mhmax) @@ -2116,6 +2121,7 @@ mixtype(struct obj *o1, struct obj *o2) case POT_HEALING: if (o2typ == POT_SPEED) return POT_EXTRA_HEALING; + FALLTHROUGH; /*FALLTHRU*/ case POT_EXTRA_HEALING: case POT_FULL_HEALING: @@ -2123,6 +2129,7 @@ mixtype(struct obj *o1, struct obj *o2) return (o1typ == POT_HEALING) ? POT_EXTRA_HEALING : (o1typ == POT_EXTRA_HEALING) ? POT_FULL_HEALING : POT_GAIN_ABILITY; + FALLTHROUGH; /*FALLTHRU*/ case UNICORN_HORN: switch (o2typ) { diff --git a/src/pray.c b/src/pray.c index 360030e65..b77c4faae 100644 --- a/src/pray.c +++ b/src/pray.c @@ -403,7 +403,8 @@ fix_worst_trouble(int trouble) break; case TROUBLE_STARVING: /* temporarily lost strength recovery now handled by init_uhunger() */ - /*FALLTHRU*/ + FALLTHROUGH; + /* FALLTHRU*/ case TROUBLE_HUNGRY: Your("%s feels content.", body_part(STOMACH)); init_uhunger(); @@ -745,7 +746,9 @@ angrygods(aligntyp resp_god) gods_angry(resp_god); punish((struct obj *) 0); break; - } /* else fall thru */ + } + FALLTHROUGH; + /* FALLTHRU */ case 4: case 5: gods_angry(resp_god); @@ -1127,6 +1130,7 @@ pleased(aligntyp g_align) switch (min(action, 5)) { case 5: pat_on_head = 1; + FALLTHROUGH; /*FALLTHRU*/ case 4: do @@ -1137,8 +1141,9 @@ pleased(aligntyp g_align) case 3: /* up to 10 troubles */ fix_worst_trouble(trouble); + FALLTHROUGH; /*FALLTHRU*/ - case 2: + case 2: /* up to 9 troubles */ while ((trouble = in_trouble()) > 0 && (++tryct < 10)) fix_worst_trouble(trouble); @@ -1234,6 +1239,7 @@ pleased(aligntyp g_align) break; } } + FALLTHROUGH; /*FALLTHRU*/ case 2: if (!Blind) @@ -1335,6 +1341,7 @@ pleased(aligntyp g_align) gcrownu(); break; } + FALLTHROUGH; /*FALLTHRU*/ case 6: give_spell(); @@ -2335,18 +2342,23 @@ maybe_turn_mon_iter(struct monst *mtmp) than zombies. */ case S_LICH: xlev += 2; + FALLTHROUGH; /*FALLTHRU*/ case S_GHOST: xlev += 2; + FALLTHROUGH; /*FALLTHRU*/ case S_VAMPIRE: xlev += 2; + FALLTHROUGH; /*FALLTHRU*/ case S_WRAITH: xlev += 2; + FALLTHROUGH; /*FALLTHRU*/ case S_MUMMY: xlev += 2; + FALLTHROUGH; /*FALLTHRU*/ case S_ZOMBIE: if (u.ulevel >= xlev && !resist(mtmp, '\0', 0, NOTELL)) { @@ -2358,6 +2370,7 @@ maybe_turn_mon_iter(struct monst *mtmp) } break; } /* else flee */ + FALLTHROUGH; /*FALLTHRU*/ default: monflee(mtmp, 0, FALSE, TRUE); @@ -2656,6 +2669,7 @@ blocked_boulder(int dx, int dy) /* this is only approximate since multiple boulders might sink */ if (is_pool_or_lava(nx, ny)) /* does its own isok() check */ break; /* still need Sokoban check below */ + FALLTHROUGH; /*FALLTHRU*/ default: /* more than one boulder--blocked after they push the top one; diff --git a/src/questpgr.c b/src/questpgr.c index 29ef494c8..9f630e05a 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -374,6 +374,7 @@ convert_line(char *in_line, char *out_line) /* pluralize */ case 'P': gc.cvt_buf[0] = highc(gc.cvt_buf[0]); + FALLTHROUGH; /*FALLTHRU*/ case 'p': Strcpy(gc.cvt_buf, makeplural(gc.cvt_buf)); @@ -382,6 +383,7 @@ convert_line(char *in_line, char *out_line) /* append possessive suffix */ case 'S': gc.cvt_buf[0] = highc(gc.cvt_buf[0]); + FALLTHROUGH; /*FALLTHRU*/ case 's': Strcpy(gc.cvt_buf, s_suffix(gc.cvt_buf)); @@ -403,8 +405,9 @@ convert_line(char *in_line, char *out_line) Strcat(cc, gc.cvt_buf); cc += strlen(gc.cvt_buf); break; - } /* else fall through */ - + } + FALLTHROUGH; + /* FALLTHRU */ default: *cc++ = *c; break; diff --git a/src/role.c b/src/role.c index 7055ff5b7..3d036f1cb 100644 --- a/src/role.c +++ b/src/role.c @@ -1357,6 +1357,7 @@ clearrolefilter(int which) switch (which) { case RS_filter: gr.rfilter.mask = 0; /* clear race, gender, and alignment filters */ + FALLTHROUGH; /*FALLTHRU*/ case RS_ROLE: for (i = 0; i < SIZE(roles) - 1; ++i) diff --git a/src/rumors.c b/src/rumors.c index 11545fb6d..31fb19a82 100644 --- a/src/rumors.c +++ b/src/rumors.c @@ -563,6 +563,7 @@ outrumor( return; case BY_COOKIE: pline(fortune_msg); + FALLTHROUGH; /* FALLTHRU */ case BY_PAPER: pline("It reads:"); diff --git a/src/selvar.c b/src/selvar.c index 1951edfb8..5d08ca95e 100644 --- a/src/selvar.c +++ b/src/selvar.c @@ -582,6 +582,7 @@ selection_do_gradient( switch (gtyp) { default: impossible("Unrecognized gradient type! Defaulting to radial..."); + FALLTHROUGH; /* FALLTHRU */ case SEL_GRADIENT_RADIAL: { for (dx = 0; dx < COLNO; dx++) diff --git a/src/shk.c b/src/shk.c index 0ec28f217..d9077322f 100644 --- a/src/shk.c +++ b/src/shk.c @@ -4068,6 +4068,7 @@ sellobj( switch (gs.sell_response ? gs.sell_response : nyaq(qbuf)) { case 'q': gs.sell_response = 'n'; + FALLTHROUGH; /*FALLTHRU*/ case 'n': if (container) @@ -4078,6 +4079,7 @@ sellobj( break; case 'a': gs.sell_response = 'y'; + FALLTHROUGH; /*FALLTHRU*/ case 'y': if (container) diff --git a/src/sit.c b/src/sit.c index 82fccb6e9..1f919d922 100644 --- a/src/sit.c +++ b/src/sit.c @@ -158,6 +158,7 @@ throne_sit_effect(void) default: case 2: /* more than 1 eye */ eye = makeplural(eye); + FALLTHROUGH; /*FALLTHRU*/ case 1: /* one eye (Cyclops, floating eye) */ Your("%s %s...", eye, vtense(eye, "tingle")); @@ -517,6 +518,7 @@ attrcurse(void) ret = FIRE_RES; break; } + FALLTHROUGH; /*FALLTHRU*/ case 2: if (HTeleportation & INTRINSIC) { @@ -525,6 +527,7 @@ attrcurse(void) ret = TELEPORT; break; } + FALLTHROUGH; /*FALLTHRU*/ case 3: if (HPoison_resistance & INTRINSIC) { @@ -533,6 +536,7 @@ attrcurse(void) ret = POISON_RES; break; } + FALLTHROUGH; /*FALLTHRU*/ case 4: if (HTelepat & INTRINSIC) { @@ -543,6 +547,7 @@ attrcurse(void) ret = TELEPAT; break; } + FALLTHROUGH; /*FALLTHRU*/ case 5: if (HCold_resistance & INTRINSIC) { @@ -551,6 +556,7 @@ attrcurse(void) ret = COLD_RES; break; } + FALLTHROUGH; /*FALLTHRU*/ case 6: if (HInvis & INTRINSIC) { @@ -559,6 +565,7 @@ attrcurse(void) ret = INVIS; break; } + FALLTHROUGH; /*FALLTHRU*/ case 7: if (HSee_invisible & INTRINSIC) { @@ -574,6 +581,7 @@ attrcurse(void) ret = SEE_INVIS; break; } + FALLTHROUGH; /*FALLTHRU*/ case 8: if (HFast & INTRINSIC) { @@ -582,6 +590,7 @@ attrcurse(void) ret = FAST; break; } + FALLTHROUGH; /*FALLTHRU*/ case 9: if (HStealth & INTRINSIC) { @@ -590,6 +599,7 @@ attrcurse(void) ret = STEALTH; break; } + FALLTHROUGH; /*FALLTHRU*/ case 10: /* intrinsic protection is just disabled, not set back to 0 */ @@ -599,6 +609,7 @@ attrcurse(void) ret = PROTECTION; break; } + FALLTHROUGH; /*FALLTHRU*/ case 11: if (HAggravate_monster & INTRINSIC) { @@ -607,6 +618,7 @@ attrcurse(void) ret = AGGRAVATE_MONSTER; break; } + FALLTHROUGH; /*FALLTHRU*/ default: break; diff --git a/src/sounds.c b/src/sounds.c index eac50772a..5a5e9fd66 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -264,6 +264,7 @@ dosounds(void) break; } } + FALLTHROUGH; /*FALLTHRU*/ case 0: Soundeffect(se_guards_footsteps, 30); @@ -631,7 +632,6 @@ cry_sound(struct monst *mtmp) ret = "hiss"; break; case MS_ROAR: /* baby dragons; have them growl instead of roar */ - /*FALLTHRU*/ case MS_GROWL: /* (none) */ ret = "growl"; break; @@ -870,6 +870,7 @@ domonnoise(struct monst *mtmp) } break; } + FALLTHROUGH; /*FALLTHRU*/ case MS_GROWL: Soundeffect((mtmp->mpeaceful ? se_snarl : se_growl), 80); @@ -1019,6 +1020,7 @@ domonnoise(struct monst *mtmp) } break; } + FALLTHROUGH; /*FALLTHRU*/ case MS_HUMANOID: if (!mtmp->mpeaceful) { @@ -1141,7 +1143,8 @@ domonnoise(struct monst *mtmp) (void) demon_talk(mtmp); break; } - /* fall through */ + FALLTHROUGH; + /* FALLTHRU */ case MS_CUSS: if (!mtmp->mpeaceful) cuss(mtmp); diff --git a/src/spell.c b/src/spell.c index 65ef028b1..3ef28cafa 100644 --- a/src/spell.c +++ b/src/spell.c @@ -1441,11 +1441,13 @@ spelleffects(int spell_otyp, boolean atme, boolean force) } break; } /* else */ + FALLTHROUGH; /*FALLTHRU*/ /* these spells are all duplicates of wand effects */ case SPE_FORCE_BOLT: physical_damage = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case SPE_SLEEP: case SPE_MAGIC_MISSILE: @@ -1510,6 +1512,7 @@ spelleffects(int spell_otyp, boolean atme, boolean force) /* high skill yields effect equivalent to blessed scroll */ if (role_skill >= P_SKILLED) pseudo->blessed = 1; + FALLTHROUGH; /*FALLTHRU*/ case SPE_CHARM_MONSTER: case SPE_MAGIC_MAPPING: @@ -1526,6 +1529,7 @@ spelleffects(int spell_otyp, boolean atme, boolean force) /* high skill yields effect equivalent to blessed potion */ if (role_skill >= P_SKILLED) pseudo->blessed = 1; + FALLTHROUGH; /*FALLTHRU*/ case SPE_INVISIBILITY: (void) peffects(pseudo); diff --git a/src/steed.c b/src/steed.c index 2c7be9c2e..84a6e9287 100644 --- a/src/steed.c +++ b/src/steed.c @@ -589,6 +589,7 @@ dismount_steed( switch (reason) { case DISMOUNT_THROWN: verb = "are thrown"; + FALLTHROUGH; /*FALLTHRU*/ case DISMOUNT_KNOCKED: case DISMOUNT_FELL: diff --git a/src/timeout.c b/src/timeout.c index cb9800994..4ec9f9c6b 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -214,6 +214,7 @@ vomiting_dialogue(void) make_stunned((HStun & TIMEOUT) + (long) d(2, 4), FALSE); if (!Popeye(VOMITING)) stop_occupation(); + FALLTHROUGH; /*FALLTHRU*/ case 9: make_confused((HConfusion & TIMEOUT) + (long) d(2, 4), FALSE); @@ -1441,6 +1442,7 @@ burn_object(anything *arg, long timeout) switch (obj->where) { case OBJ_INVENT: need_invupdate = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case OBJ_MINVENT: pline("%spotion of oil has burnt away.", whose); @@ -1504,6 +1506,7 @@ burn_object(anything *arg, long timeout) switch (obj->where) { case OBJ_INVENT: need_invupdate = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case OBJ_MINVENT: if (obj->otyp == BRASS_LANTERN) @@ -1583,6 +1586,7 @@ burn_object(anything *arg, long timeout) switch (obj->where) { case OBJ_INVENT: need_invupdate = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case OBJ_MINVENT: pline("%scandelabrum's flame%s.", whose, @@ -1598,6 +1602,7 @@ burn_object(anything *arg, long timeout) case OBJ_INVENT: /* no need_invupdate for update_inventory() necessary; useupall() -> freeinv() handles it */ + FALLTHROUGH; /*FALLTHRU*/ case OBJ_MINVENT: pline("%s %s consumed!", Yname2(obj), diff --git a/src/topten.c b/src/topten.c index f38de9244..cb968a726 100644 --- a/src/topten.c +++ b/src/topten.c @@ -110,11 +110,13 @@ formatkiller( switch (svk.killer.format) { default: impossible("bad killer format? (%d)", svk.killer.format); + FALLTHROUGH; /*FALLTHRU*/ case NO_KILLER_PREFIX: break; case KILLED_BY_AN: kname = an(kname); + FALLTHROUGH; /*FALLTHRU*/ case KILLED_BY: (void) strncat(buf, killed_by_prefix[how], siz - 1); diff --git a/src/trap.c b/src/trap.c index a39ba8ddc..da39e4428 100644 --- a/src/trap.c +++ b/src/trap.c @@ -513,6 +513,7 @@ maketrap(coordxy x, coordxy y, int typ) case PIT: case SPIKED_PIT: ttmp->conjoined = 0; + FALLTHROUGH; /*FALLTHRU*/ case HOLE: case TRAPDOOR: @@ -1126,10 +1127,13 @@ m_harmless_trap(struct monst *mtmp, struct trap *ttmp) return TRUE; break; case PIT: + FALLTHROUGH; /*FALLTHRU*/ case SPIKED_PIT: + FALLTHROUGH; /*FALLTHRU*/ case HOLE: + FALLTHROUGH; /*FALLTHRU*/ case TRAPDOOR: if (is_clinger(mdat) && !Sokoban) @@ -2190,6 +2194,7 @@ trapeffect_web( mtmp->mtrapped = 1; break; } + FALLTHROUGH; /*FALLTHRU*/ default: if (mptr->mlet == S_GIANT @@ -2721,6 +2726,7 @@ immune_to_trap(struct monst *mon, unsigned ttype) if (pm->msize <= MZ_SMALL || amorphous(pm) || is_whirly(pm) || unsolid(pm)) return TRAP_CLEARLY_IMMUNE; + FALLTHROUGH; /*FALLTHRU*/ case SQKY_BOARD: case LANDMINE: @@ -2809,6 +2815,7 @@ immune_to_trap(struct monst *mon, unsigned ttype) for monsters, only replicates fire trap, so fall through */ if (is_you) return TRAP_NOT_IMMUNE; + FALLTHROUGH; /*FALLTHRU*/ case FIRE_TRAP: /* can always destroy items being carried */ /* harmful if not resistant or if carrying anything that could burn */ @@ -3244,10 +3251,12 @@ launch_obj( /* use otrapped as a flag to ohitmon */ singleobj->otrapped = 1; style &= ~LAUNCH_KNOWN; + FALLTHROUGH; /*FALLTHRU*/ case ROLL: roll: delaycnt = 2; + FALLTHROUGH; /*FALLTHRU*/ default: if (!delaycnt) @@ -3352,6 +3361,7 @@ launch_obj( /* if trap doesn't work, skip "disappears" message */ if (newlev == depth(&u.uz)) break; + FALLTHROUGH; /*FALLTHRU*/ case TELEP_TRAP: if (cansee(x, y)) @@ -4050,6 +4060,7 @@ float_down( case TRAPDOOR: if (!Can_fall_thru(&u.uz) || u.ustuck) break; + FALLTHROUGH; /*FALLTHRU*/ default: if (!u.utrap) /* not already in the trap */ diff --git a/src/uhitm.c b/src/uhitm.c index da34794a9..9aaa11332 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -3772,6 +3772,7 @@ mhitm_ad_deth( mhm->damage = 0; return; } + FALLTHROUGH; /*FALLTHRU*/ default: /* case 16: ... case 5: */ You_feel("your life force draining away..."); @@ -5385,10 +5386,12 @@ hmonas(struct monst *mon) case AT_CLAW: if (uwep && !cantwield(gy.youmonst.data) && !weapon_used) goto use_weapon; + FALLTHROUGH; /*FALLTHRU*/ case AT_TUCH: if (uwep && gy.youmonst.data->mlet == S_LICH && !weapon_used) goto use_weapon; + FALLTHROUGH; /*FALLTHRU*/ case AT_KICK: case AT_BITE: @@ -5632,6 +5635,7 @@ hmonas(struct monst *mon) || gy.youmonst.data->mlet == S_ORC || gy.youmonst.data->mlet == S_GNOME) && !weapon_used) goto use_weapon; + FALLTHROUGH; /*FALLTHRU*/ case AT_NONE: @@ -6016,6 +6020,8 @@ passive_obj( } break; } + FALLTHROUGH; + /* FALLTHRU */ default: break; } diff --git a/src/weapon.c b/src/weapon.c index d65c64945..5234c2781 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -1466,7 +1466,9 @@ weapon_hit_bonus(struct obj *weapon) } else if (type <= P_LAST_WEAPON) { switch (P_SKILL(type)) { default: - impossible(bad_skill, P_SKILL(type)); /* fall through */ + impossible(bad_skill, P_SKILL(type)); + FALLTHROUGH; + /* FALLTHRU */ case P_ISRESTRICTED: case P_UNSKILLED: bonus = -4; @@ -1487,7 +1489,9 @@ weapon_hit_bonus(struct obj *weapon) skill = P_SKILL(wep_type); switch (skill) { default: - impossible(bad_skill, skill); /* fall through */ + impossible(bad_skill, skill); + FALLTHROUGH; + /* FALLTHRU */ case P_ISRESTRICTED: case P_UNSKILLED: bonus = -9; @@ -1561,7 +1565,8 @@ weapon_dam_bonus(struct obj *weapon) switch (P_SKILL(type)) { default: impossible("weapon_dam_bonus: bad skill %d", P_SKILL(type)); - /* fall through */ + FALLTHROUGH; + /* FALLTHRU */ case P_ISRESTRICTED: case P_UNSKILLED: bonus = -2; diff --git a/src/wizard.c b/src/wizard.c index aefba556d..8db22f060 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -284,8 +284,8 @@ strategy(struct monst *mtmp) case 1: /* the wiz is less cautious */ if (mtmp->data != &mons[PM_WIZARD_OF_YENDOR]) return (unsigned long) STRAT_HEAL; - /* else fall through */ - + FALLTHROUGH; + /* FALLTHRU */ case 2: dstrat = STRAT_HEAL; break; @@ -399,6 +399,7 @@ tactics(struct monst *mtmp) mtmp->mhp += rnd(8); return 1; } + FALLTHROUGH; /*FALLTHRU*/ case STRAT_NONE: /* harass */ diff --git a/src/wizcmds.c b/src/wizcmds.c index 12f51758c..c7cdd707e 100644 --- a/src/wizcmds.c +++ b/src/wizcmds.c @@ -1065,6 +1065,7 @@ wiz_intrinsic(void) so needs more than simple incr_itimeout() but we want the pline() issued with that */ make_glib((int) newtimeout); + FALLTHROUGH; /*FALLTHRU*/ default: def_feedback: diff --git a/src/zap.c b/src/zap.c index dede87a0d..59c871edc 100644 --- a/src/zap.c +++ b/src/zap.c @@ -177,6 +177,7 @@ bhitm(struct monst *mtmp, struct obj *otmp) switch (otyp) { case WAN_STRIKING: zap_type_text = "wand"; + FALLTHROUGH; /*FALLTHRU*/ case SPE_FORCE_BOLT: reveal_invis = TRUE; @@ -1096,6 +1097,7 @@ revive(struct obj *corpse, boolean by_hero) obfree(corpse, (struct obj *) 0); break; } + FALLTHROUGH; /*FALLTHRU*/ case OBJ_FREE: case OBJ_MIGRATING: @@ -2056,6 +2058,7 @@ stone_to_flesh_obj(struct obj *obj) /* nonnull */ smell = TRUE; break; case WEAPON_CLASS: /* crysknife */ + FALLTHROUGH; /*FALLTHRU*/ default: res = 0; @@ -2869,6 +2872,7 @@ zapyourself(struct obj *obj, boolean ordinary) case WAN_LIGHT: /* (broken wand) */ /* assert( !ordinary ); */ damage = d(obj->spe, 25); + FALLTHROUGH; /*FALLTHRU*/ case EXPENSIVE_CAMERA: if (!damage) @@ -3243,6 +3247,7 @@ zap_updown(struct obj *obj) /* wand or spell, nonnull */ case WAN_STRIKING: case SPE_FORCE_BOLT: striking = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case WAN_LOCKING: case SPE_WIZARD_LOCK: @@ -4924,6 +4929,7 @@ dobuzz( switch (bounce) { case 0: dx = -dx; + FALLTHROUGH; /*FALLTHRU*/ case 1: dy = -dy; @@ -5256,6 +5262,7 @@ zap_over_floor( break; case ZT_LIGHTNING: + FALLTHROUGH; /*FALLTHRU*/ case ZT_ACID: if (lev->typ == IRONBARS) { diff --git a/sys/msdos/video.c b/sys/msdos/video.c index e172513ee..6397fa8d8 100644 --- a/sys/msdos/video.c +++ b/sys/msdos/video.c @@ -293,6 +293,7 @@ term_end_attr(int attr) switch (attr) { case ATR_INVERSE: inversed = 0; + FALLTHROUGH; /*FALLTHRU*/ case ATR_ULINE: case ATR_BOLD: @@ -341,6 +342,7 @@ term_start_attr(int attr) break; case ATR_INVERSE: inversed = 1; + FALLTHROUGH; /*FALLTHRU*/ default: g_attribute = iflags.grmode ? attrib_gr_normal : attrib_text_normal; diff --git a/sys/unix/hints/include/compiler.370 b/sys/unix/hints/include/compiler.370 index 3e95e151b..ae3dc8d19 100755 --- a/sys/unix/hints/include/compiler.370 +++ b/sys/unix/hints/include/compiler.370 @@ -78,20 +78,29 @@ CXX=g++ -std=gnu++11 GCCGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9) GCCGTEQ11 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 11) GCCGTEQ12 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 12) +GCCGTEQ14 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 14) ifeq "$(GCCGTEQ9)" "1" # flags present in gcc version greater than or equal to 9 can go here CFLAGS+=-Wformat-overflow CFLAGS+=-Wmissing-parameter-type endif # GCC greater than or equal to 9 #ifeq "$(GCCGTEQ11)" "1" +CFLAGS+=-Wimplicit-fallthrough #endif #ifeq "$(GCCGTEQ12)" "1" #endif +#ifeq "$(GCCGTEQ14)" "1" +CFLAGS+=-std=gnu23 +#endif # end of gcc-specific else # gcc or clang? CXX=clang++ -std=gnu++11 # clang-specific follows +CLANGGTEQ12 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 12) CLANGGTEQ14 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 14) +ifeq "$(CLANGGTEQ12)" "1" +CFLAGS+=-Wimplicit-fallthrough +endif ifeq "$(CLANGGTEQ14)" "1" ifneq "$(VIEWDEPRECATIONS)" "1" CFLAGS+=-Wno-deprecated-declarations diff --git a/sys/unix/hints/include/cross-pre2.370 b/sys/unix/hints/include/cross-pre2.370 index fa5f0911c..8a7142985 100644 --- a/sys/unix/hints/include/cross-pre2.370 +++ b/sys/unix/hints/include/cross-pre2.370 @@ -142,6 +142,7 @@ MSDOS_TARGET_CFLAGS = -c -O -I../include -I../sys/msdos -I../win/share \ -Wall -Wextra -Wno-missing-field-initializers -Wreturn-type -Wunused \ -Wformat -Wswitch -Wshadow -Wwrite-strings \ -Wimplicit -Wimplicit-function-declaration -Wimplicit-int \ + -Wimplicit-fallthrough \ -Wmissing-parameter-type -Wold-style-definition -Wstrict-prototypes MSDOS_TARGET_CXXFLAGS = -c -O -I../include -I../sys/msdos -I../win/share \ $(LUAINCL) -DDLB $(PDCURSESDEF) \ diff --git a/sys/vms/vmsunix.c b/sys/vms/vmsunix.c index f2c1bb0df..090ce9e64 100644 --- a/sys/vms/vmsunix.c +++ b/sys/vms/vmsunix.c @@ -241,6 +241,7 @@ vms_define(const char *name, const char *value, int flag) switch (flag) { case ENV_JOB: /* job logical name */ tbl_dsc.len = strlen(tbl_dsc.adr = "LNM$JOB"); + FALLTHROUGH; /*FALLTHRU*/ case ENV_SUP: /* supervisor-mode process logical name */ result = lib$set_logical(&nam_dsc, &val_dsc, &tbl_dsc); diff --git a/sys/windows/Makefile.nmake b/sys/windows/Makefile.nmake index 95b8bae17..07646b7f0 100644 --- a/sys/windows/Makefile.nmake +++ b/sys/windows/Makefile.nmake @@ -1131,10 +1131,18 @@ scall = # 4777 format string requires an argument of type 'type', # but variadic argument 'position' has type 'type' # 4820 padding in struct +# 5262 enable fallthrough warnings that lack [[fallthrough]] +# ctmpflags = $(ctmpflags:-W3=-W4) -wd4100 -wd4244 -wd4245 -wd4310 -wd4706 -w44777 -wd4820 !IF ($(VSVER) >= 2019) ctmpflags = $(ctmpflags) -w44774 !ENDIF +!IF ($(VSVER) >= 2022) +!IF ($(MAKEVERSION) >= 1440338120) +# warning 5262 became available starting in Visual Studio 2022 version 17.4. +ctmpflags = $(ctmpflags) -w45262 /std:clatest +!ENDIF +!ENDIF !ENDIF #More verbose warning output options below @@ -2880,6 +2888,8 @@ $(OTTY)sfstruct.o: sfstruct.c $(HACK_H) $(OTTY)shk.o: shk.c $(HACK_H) $(OTTY)shknam.o: shknam.c $(HACK_H) $(OTTY)sit.o: sit.c $(HACK_H) $(INCL)\artifact.h + $(Q)$(CC) $(CFLAGS) /EP $(@B).c > $(OTTY)$(@B).c.preproc + $(Q)$(CC) $(CFLAGS) -Fo$@ $(@B).c $(OTTY)sounds.o: sounds.c $(HACK_H) $(OTTY)sp_lev.o: sp_lev.c $(HACK_H) $(INCL)\sp_lev.h $(OTTY)spell.o: spell.c $(HACK_H) diff --git a/sys/windows/consoletty.c b/sys/windows/consoletty.c index 5f624bec8..30fe4cff7 100644 --- a/sys/windows/consoletty.c +++ b/sys/windows/consoletty.c @@ -1087,6 +1087,7 @@ CtrlHandler(DWORD ctrltype) /* case CTRL_C_EVENT: */ case CTRL_BREAK_EVENT: term_clear_screen(); + FALLTHROUGH; case CTRL_CLOSE_EVENT: case CTRL_LOGOFF_EVENT: case CTRL_SHUTDOWN_EVENT: @@ -1335,7 +1336,8 @@ xputc_core(int ch) case '\n': if (console.cursor.Y < console.height - 1) console.cursor.Y++; - /* fall through */ + FALLTHROUGH; + /* FALLTHRU */ case '\r': console.cursor.X = 1; break; @@ -1879,6 +1881,7 @@ toggle_mouse_support(void) #endif /* VIRTUAL_TERMINAL_SEQUENCES */ break; case 0: + FALLTHROUGH; /*FALLTHRU*/ default: #ifndef VIRTUAL_TERMINAL_SEQUENCES diff --git a/sys/windows/windmain.c b/sys/windows/windmain.c index 0cbded52d..df7e009b1 100644 --- a/sys/windows/windmain.c +++ b/sys/windows/windmain.c @@ -630,7 +630,7 @@ process_options(int argc, char * argv[]) break; } else raw_printf("\nUnknown switch: %s", argv[0]); - /* FALL THROUGH */ + FALLTHROUGH; case '?': nhusage(); nethack_exit(EXIT_SUCCESS); diff --git a/util/makedefs.c b/util/makedefs.c index 6dfb582f2..cbb466848 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -846,7 +846,8 @@ do_grep_control(char *buf) break; case '!': /* if not ID */ isif = 0; - /* FALLTHROUGH */ + FALLTHROUGH; + /* FALLTHRU */ case '?': /* if ID */ if (grep_sp == GREP_STACK_SIZE - 2) { Fprintf(stderr, "stack overflow at line %d.", grep_lineno); @@ -2302,6 +2303,7 @@ do_objs(void) n_glass_gems++; break; } + FALLTHROUGH; /*FALLTHRU*/ case VENOM_CLASS: /* fall-through from gem class is ok; objects[] used to have @@ -2311,6 +2313,7 @@ do_objs(void) so strip the extra "splash of " off to keep same macros */ if (!strncmp(objnam, "SPLASH_OF_", 10)) objnam += 10; + FALLTHROUGH; /*FALLTHRU*/ default: Fprintf(ofp, "#define\t"); diff --git a/win/Qt/qt_bind.cpp b/win/Qt/qt_bind.cpp index d66377f3b..e6546447c 100644 --- a/win/Qt/qt_bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -271,6 +271,7 @@ void NetHackQtBind::qt_askname() // success; handle plname[] verification below prior to returning break; } + FALLTHROUGH; /*FALLTHRU*/ case -2: // Quit @@ -726,6 +727,7 @@ char NetHackQtBind::qt_more() switch (ch) { case '\0': // hypothetical ch = '\033'; + FALLTHROUGH; /*FALLTHRU*/ case ' ': case '\n': diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index 5dbe9d796..a0e93d093 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -1556,6 +1556,7 @@ menu_get_selections(WINDOW *win, nhmenu *menu, int how) break; } } + FALLTHROUGH; /*FALLTHRU*/ default: if (curletter > 0 && curletter < 256 diff --git a/win/curses/cursinit.c b/win/curses/cursinit.c index de1811e7f..fcf13ec19 100644 --- a/win/curses/cursinit.c +++ b/win/curses/cursinit.c @@ -114,6 +114,7 @@ curses_create_main_windows(void) case 3: noperminv_borders = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case 1: /* On */ borders = TRUE; @@ -121,6 +122,7 @@ curses_create_main_windows(void) case 4: noperminv_borders = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case 2: /* Auto */ borders = (term_cols >= 80 + 2 && term_rows >= 24 + 2); diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 73a939f2a..71b9f31f6 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -291,7 +291,7 @@ curses_break_str(const char *str, int width, int line_num) char *retstr; int curline = 0; int strsize = (int) strlen(str) + 1; -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) && !defined(_MSC_VER) char substr[strsize]; char curstr[strsize]; char tmpstr[strsize]; @@ -363,7 +363,7 @@ curses_str_remainder(const char *str, int width, int line_num) char *retstr; int curline = 0; int strsize = strlen(str) + 1; -#if __STDC_VERSION__ >= 199901L +#if (__STDC_VERSION__ >= 199901L) && !defined(_MSC_VER) char substr[strsize]; char tmpstr[strsize]; @@ -801,6 +801,7 @@ curses_convert_keys(int key) a value for ^H greater than 255 is passed back to core's readchar() and stripping the value down to 0..255 yields ^G! */ ret = C('H'); + FALLTHROUGH; /*FALLTHRU*/ default: if (modifiers_available) diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index 15168f845..90a9d93c9 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -415,6 +415,7 @@ draw_horizontal(boolean border) w -= (t - 30); /* '+= strlen()' below will add 't'; * functional result being 'w += 30' */ } + FALLTHROUGH; /*FALLTHRU*/ case BL_ALIGN: case BL_LEVELDESC: @@ -1231,6 +1232,7 @@ curs_vert_status_vals(int win_width) if (fld_width < hp_width + 3) /* +3: " " gap and "("...")" */ Sprintf(leadingspace, "%*s", (hp_width + 3) - fld_width, " "); + FALLTHROUGH; /*FALLTHRU*/ case BL_VERS: case BL_EXP: diff --git a/win/curses/curswins.c b/win/curses/curswins.c index fa99b58c4..19c6c380a 100644 --- a/win/curses/curswins.c +++ b/win/curses/curswins.c @@ -98,6 +98,7 @@ curses_create_window(int wid, int width, int height, orient orientation) switch (orientation) { default: impossible("curses_create_window: Bad orientation"); + FALLTHROUGH; /*FALLTHRU*/ case CENTER: startx = (term_cols / 2) - (width / 2); diff --git a/win/tty/termcap.c b/win/tty/termcap.c index 4cb40d4ea..2c6a5bd88 100644 --- a/win/tty/termcap.c +++ b/win/tty/termcap.c @@ -1341,6 +1341,7 @@ s_atr2str(int n) /* if italic isn't available, fall through to underline */ if (ZH && *ZH) return ZH; + FALLTHROUGH; /*FALLTHRU*/ case ATR_BLINK: case ATR_ULINE: @@ -1351,6 +1352,7 @@ s_atr2str(int n) if (nh_US && *nh_US) return nh_US; } + FALLTHROUGH; /*FALLTHRU*/ case ATR_BOLD: if (MD && *MD) @@ -1378,15 +1380,18 @@ e_atr2str(int n) /* send ZR unless we didn't have ZH and substituted US */ if (ZR && *ZR && ZH && *ZH) return ZR; + FALLTHROUGH; /*FALLTHRU*/ case ATR_ULINE: if (nh_UE && *nh_UE) return nh_UE; + FALLTHROUGH; /*FALLTHRU*/ case ATR_BOLD: case ATR_BLINK: if (nh_HE && *nh_HE) return nh_HE; + FALLTHROUGH; /*FALLTHRU*/ case ATR_DIM: case ATR_INVERSE: diff --git a/win/tty/wintty.c b/win/tty/wintty.c index 17dcd1cc2..693592fbb 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -665,6 +665,7 @@ tty_askname(void) case -1: bail("Until next time then..."); /* quit */ /*NOTREACHED*/ + break; case 0: break; /* no game chosen; start new game */ case 1: @@ -1084,6 +1085,7 @@ tty_clear_nhwindow(winid window) case NHW_MAP: /* cheap -- clear the whole thing and tell nethack to redraw botl */ disp.botlx = TRUE; + FALLTHROUGH; /*FALLTHRU*/ case NHW_BASE: /* if erasing_tty_screen is True, calling sequence is @@ -1721,6 +1723,7 @@ process_menu_window(winid window, struct WinDesc *cw) break; case MENU_EXPLICIT_CHOICE: morc = really_morc; + FALLTHROUGH; /*FALLTHRU*/ default: if (cw->how == PICK_NONE || !strchr(resp, morc)) { @@ -1878,12 +1881,14 @@ tty_display_nhwindow( tty_display_nhwindow(WIN_MESSAGE, TRUE); return; } + FALLTHROUGH; /*FALLTHRU*/ case NHW_BASE: (void) fflush(stdout); break; case NHW_TEXT: cw->maxcol = ttyDisplay->cols; /* force full-screen mode */ + FALLTHROUGH; /*FALLTHRU*/ case NHW_MENU: cw->active = 1; @@ -1951,6 +1956,7 @@ tty_dismiss_nhwindow(winid window) if (ttyDisplay->toplin != TOPLINE_EMPTY) tty_display_nhwindow(WIN_MESSAGE, TRUE); nhassert(ttyDisplay->toplin == TOPLINE_EMPTY); + FALLTHROUGH; /*FALLTHRU*/ case NHW_STATUS: case NHW_BASE: @@ -4438,6 +4444,7 @@ tty_status_update( switch (fldidx) { case BL_RESET: reset_state = FORCE_RESET; + FALLTHROUGH; /*FALLTHRU*/ case BL_FLUSH: if (make_things_fit(reset_state) || truncation_expected) { @@ -4458,6 +4465,7 @@ tty_status_update( break; case BL_GOLD: text = decode_mixed(goldbuf, text); + FALLTHROUGH; /*FALLTHRU*/ default: attrmask = (color >> 8) & 0x00FF; @@ -4506,6 +4514,7 @@ tty_status_update( break; case BL_LEVELDESC: dlvl_shrinklvl = 0; /* caller is passing full length string */ + FALLTHROUGH; /*FALLTHRU*/ case BL_HUNGER: /* The core sends trailing blanks for some fields. diff --git a/win/win32/mhdlg.c b/win/win32/mhdlg.c index afa55c1c9..f190f000d 100644 --- a/win/win32/mhdlg.c +++ b/win/win32/mhdlg.c @@ -146,7 +146,8 @@ GetlinDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) (WPARAM) sizeof(wbuf2), (LPARAM) wbuf2); NH_W2A(wbuf2, data->result, data->result_size); - /* Fall through. */ + FALLTHROUGH; + /* FALLTHRU */ /* cancel button was pressed */ case IDCANCEL: @@ -246,7 +247,8 @@ ExtCmdDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) hWnd, IDC_EXTCMD_LIST, LB_GETCURSEL, (WPARAM) 0, (LPARAM) 0); if (*data->selection == LB_ERR) *data->selection = -1; - /* Fall through. */ + FALLTHROUGH; + /* FALLTHRU */ /* CANCEL button ws clicked */ case IDCANCEL: