lint: problems with default in switch statements

This commit is contained in:
Kurtis Rader 2016-11-02 18:29:14 -07:00
parent 72e687296b
commit f05fe4e292
11 changed files with 44 additions and 39 deletions

View file

@ -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;
}
}

View file

@ -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
}
}
}

View file

@ -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) {

View file

@ -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);

View file

@ -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<completion_t> *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
}
}
}
}

View file

@ -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++;

View file

@ -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;
}
}
}

View file

@ -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) {

View file

@ -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;
}
}
}
}

View file

@ -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; }
}
}

View file

@ -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;
}
}
}