From: simon Date: Fri, 29 Jul 2005 11:34:02 +0000 (+0000) Subject: Ben Hutchings reports that gcc 4 gives an optimiser warning because X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/commitdiff_plain/91cb8434eb76a57ab2906b80114a2870a11dcede?hp=00a32916a74a7d590410655f2c965053a5f71de4 Ben Hutchings reports that gcc 4 gives an optimiser warning because it can't tell that one branch of a particular switch is always taken. Adding a default clause with an automatic assertion failure apparently fixes it. git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6148 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/rect.c b/rect.c index a7113af..439ae1f 100644 --- a/rect.c +++ b/rect.c @@ -1348,6 +1348,8 @@ static char *new_game_desc(game_params *params, random_state *rs, r1.x++; r1.w--; break; + default: /* should never happen */ + assert(!"invalid direction"); } if (r1.h > 0 && r1.w > 0) place_rect(params2, grid, r1);