From fce58626b1605981655090fcea06824f29aaa823 Mon Sep 17 00:00:00 2001 From: Matthew Brush Date: Wed, 20 Dec 2017 17:18:03 -0800 Subject: [PATCH] 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. --- src/highlighting.c | 3 +++ src/keybindings.c | 2 +- src/search.c | 1 + src/tools.c | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/highlighting.c b/src/highlighting.c index 2f8acee0..f7cb63db 100644 --- a/src/highlighting.c +++ b/src/highlighting.c @@ -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); } diff --git a/src/keybindings.c b/src/keybindings.c index 5be9d63e..a50a10ce 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -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; diff --git a/src/search.c b/src/search.c index 7f78bc69..629cef44 100644 --- a/src/search.c +++ b/src/search.c @@ -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); diff --git a/src/tools.c b/src/tools.c index 70639481..364f9da1 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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':