shithub: puzzles

Download patch

ref: b0adb79178a5a00e843c6ac27ce0e1bcd2bec9d8
parent: 178a86197b8b769bac35a7032313572551614a4d
author: Simon Tatham <anakin@pobox.com>
date: Fri Jul 29 07:34:02 EDT 2005

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.

[originally from svn r6148]

--- a/rect.c
+++ b/rect.c
@@ -1348,6 +1348,8 @@
                                 r1.x++;
                             r1.w--;
                             break;
+                          default:     /* should never happen */
+                            assert(!"invalid direction");
                         }
                         if (r1.h > 0 && r1.w > 0)
                             place_rect(params2, grid, r1);