Prefer compiler warnings to assertions for unhandled switch cases
Using 'default:' cases can hide logical errors which would lead to i3 crashes for users. With this change the compiler will print a warning when a case is not handled. For example, if I add a new value in the Font.type enum: ../../i3/libi3/font.c: In function ‘draw_text’: ../../i3/libi3/font.c:378:5: warning: enumeration value ‘NEWFONT’ not handled in switch [-Wswitch] switch (savedFont->type) { ^~~~~~
This commit is contained in:
@ -44,9 +44,6 @@ static bool tiling_resize_for_border(Con *con, border_t border, xcb_button_press
|
||||
case BORDER_BOTTOM:
|
||||
search_direction = D_DOWN;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
bool res = resize_find_tiling_participants(&first, &second, search_direction, false);
|
||||
|
Reference in New Issue
Block a user