diff --git a/src/builtin.cpp b/src/builtin.cpp index 2740c119e..a3a167963 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -2857,9 +2857,6 @@ static const wcstring hist_cmd_to_string(hist_cmd_t hist_cmd) { return L"merge"; case HIST_SAVE: return L"save"; - default: - DIE("unhandled hist_cmd_t constant"); - break; } } diff --git a/src/complete.cpp b/src/complete.cpp index f557146c1..1ed733258 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -1146,31 +1146,35 @@ bool completer_t::try_complete_variable(const wcstring &str) { } switch (c) { - case L'\\': + case L'\\': { in_pos++; break; - - case L'$': + } + case L'$': { if (mode == e_unquoted || mode == e_double_quoted) { variable_start = in_pos; } break; - - case L'\'': + } + case L'\'': { if (mode == e_single_quoted) { mode = e_unquoted; } else if (mode == e_unquoted) { mode = e_single_quoted; } break; - - case L'"': + } + case L'"': { if (mode == e_double_quoted) { mode = e_unquoted; } else if (mode == e_unquoted) { mode = e_double_quoted; } break; + } + default: { + break; // all other chars ignored here + } } } diff --git a/src/env.cpp b/src/env.cpp index e5c61eb7b..7d84992d0 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -283,10 +283,6 @@ static void universal_callback(fish_message_type_t type, const wchar_t *name) { str = L"ERASE"; break; } - default: { - DIE("unhandled fish_message_type_t constant"); - break; - } } if (str) { diff --git a/src/exec.cpp b/src/exec.cpp index b3d3f5cc1..bd6ae4560 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -282,10 +282,6 @@ static bool io_transmogrify(const io_chain_t &in_chain, io_chain_t *out_chain, out.reset(new io_fd_t(in->fd, fd, false)); break; } - default: { - DIE("unhandled io_mode constant"); - break; - } } if (out.get() != NULL) result_chain.push_back(out); diff --git a/src/expand.cpp b/src/expand.cpp index bee4c3ad7..4bb30bdd4 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -984,6 +984,9 @@ static expand_error_t expand_brackets(const wcstring &instr, expand_flags_t flag if (bracket_count == 1) last_sep = pos; break; } + default: { + break; // we ignore all other characters here + } } } @@ -1072,6 +1075,10 @@ static int expand_cmdsubst(const wcstring &input, std::vector *out case 1: { break; } + default: { + DIE("unhandled parse_ret value"); + break; + } } const wcstring subcmd(paran_begin + 1, paran_end - paran_begin - 1); @@ -1295,6 +1302,9 @@ static void remove_internal_separator(wcstring *str, bool conv) { str->at(idx) = L'*'; break; } + default: { + break; // we ignore all other characters + } } } } diff --git a/src/highlight.cpp b/src/highlight.cpp index 0558d9336..260a8cac4 100644 --- a/src/highlight.cpp +++ b/src/highlight.cpp @@ -579,6 +579,9 @@ static void color_argument_internal(const wcstring &buffstr, mode = e_double_quoted; break; } + default: { + break; // we ignore all other characters + } } } break; @@ -632,6 +635,9 @@ static void color_argument_internal(const wcstring &buffstr, in_pos -= 1; break; } + default: { + break; // we ignore all other characters + } } break; } @@ -1247,6 +1253,9 @@ static void highlight_universal_internal(const wcstring &buffstr, } break; } + default: { + break; // we ignore all other characters + } } if ((*str == L'\0')) break; str++; diff --git a/src/pager.cpp b/src/pager.cpp index 73256c4eb..4a952c205 100644 --- a/src/pager.cpp +++ b/src/pager.cpp @@ -613,10 +613,6 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio // These do nothing. return false; } - default: { - DIE("unhandled selection_direction_t constant"); - break; - } } } diff --git a/src/parser.cpp b/src/parser.cpp index 8a7eefe01..914fcf036 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -868,10 +868,6 @@ wcstring block_t::description() const { result.append(L"breakpoint"); break; } - default: { - DIE("unhandled block_type_t constant"); - break; - } } if (this->src_lineno >= 0) { diff --git a/src/proc.cpp b/src/proc.cpp index 6fdebdc15..0a2439cd8 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -900,13 +900,11 @@ void job_continue(job_t *j, bool cont) { process_mark_finished_children(false); break; } - case 0: { // No FDs are ready. Look for finished processes. process_mark_finished_children(false); break; } - case -1: { // If there is no funky IO magic, we can use waitpid instead of handling // child deaths through signals. This gives a rather large speed boost (A @@ -917,6 +915,10 @@ void job_continue(job_t *j, bool cont) { process_mark_finished_children(true); break; } + default: { + DIE("unexpected return value from select_try()"); + break; + } } } } diff --git a/src/reader.cpp b/src/reader.cpp index 2fd5a3b77..11b091282 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -882,9 +882,8 @@ static bool command_ends_paging(wchar_t c, bool focused_on_search_field) { case R_REPAINT: case R_SUPPRESS_AUTOSUGGESTION: case R_BEGINNING_OF_HISTORY: - case R_END_OF_HISTORY: - default: { - // These commands never do. + case R_END_OF_HISTORY: { + // These commands never end paging. return false; } case R_EXECUTE: { @@ -923,6 +922,7 @@ static bool command_ends_paging(wchar_t c, bool focused_on_search_field) { // These commands operate on the search field if that's where the focus is. return !focused_on_search_field; } + default: { return false; } } } diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 41743d7ae..a8b2886b1 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -266,6 +266,9 @@ void tokenizer_t::read_string() { do_loop = 0; break; } + default: { + break; // ignore other chars + } } break; } @@ -286,6 +289,9 @@ void tokenizer_t::read_string() { do_loop = 0; break; } + default: { + break; // ignore other chars + } } break; } @@ -707,10 +713,7 @@ bool move_word_state_machine_t::consume_char_path_components(wchar_t c) { break; } case s_end: - default: { - // We won't get here, but keep the compiler happy. - break; - } + default: { break; } } } return consumed; @@ -761,10 +764,6 @@ bool move_word_state_machine_t::consume_char(wchar_t c) { case move_word_style_whitespace: { return consume_char_whitespace(c); } - default: { - DIE("unhandled style"); - break; - } } }