Add 'fall through' comments and fix actual bug

To document when switch cases fall through intentionally, hiding the
warning by GCC at the same time.

Moved the break statement outside of the if conditional in keybindings.c
as I believe this was an actual bug found by GCC's warnings.
This commit is contained in:
Matthew Brush 2017-12-20 17:18:03 -08:00
parent 1b5deea612
commit fce58626b1
4 changed files with 6 additions and 1 deletions

View File

@ -284,10 +284,13 @@ static void parse_keyfile_style(GKeyFile *kf, gchar **list,
{
case 4:
style->italic = utils_atob(list[3]);
/* fall through */
case 3:
style->bold = utils_atob(list[2]);
/* fall through */
case 2:
parse_color(kf, list[1], &style->background);
/* fall through */
case 1:
parse_color(kf, list[0], &style->foreground);
}

View File

@ -2614,8 +2614,8 @@ static gboolean cb_func_document_action(guint key_id)
{
gint line = sci_get_current_line(doc->editor->sci);
editor_toggle_fold(doc->editor, line, 0);
break;
}
break;
case GEANY_KEYS_DOCUMENT_REMOVE_MARKERS:
on_remove_markers1_activate(NULL, NULL);
break;

View File

@ -1879,6 +1879,7 @@ static void search_finished(GPid child_pid, gint status, gpointer user_data)
}
case 1:
msg = _("No matches found.");
/* fall through */
default:
msgwin_msg_add_string(COLOR_BLUE, -1, NULL, msg);
ui_set_statusbar(FALSE, "%s", msg);

View File

@ -648,6 +648,7 @@ static void word_count(gchar *text, guint *chars, guint *lines, guint *words)
{
case '\n':
(*lines)++;
/* fall through */
case '\r':
case '\f':
case '\t':