lint: missing break in switch statement

This commit is contained in:
Kurtis Rader 2016-11-01 22:36:30 -07:00
parent f6047f02d6
commit 4f4d34e664
13 changed files with 61 additions and 31 deletions

View file

@ -665,6 +665,7 @@ static int builtin_block(parser_t &parser, io_streams_t &streams, wchar_t **argv
}
case GLOBAL: {
block = NULL;
break;
}
case UNSET: {
while (block != NULL && block->type() != FUNCTION_CALL &&
@ -672,6 +673,7 @@ static int builtin_block(parser_t &parser, io_streams_t &streams, wchar_t **argv
// Set it in function scope
block = parser.block_at_index(++block_idx);
}
break;
}
default: {
DIE("unexpected scope");
@ -962,7 +964,10 @@ static wcstring functions_def(const wcstring &name) {
append_format(out, L" --on-event %ls", next->str_param1.c_str());
break;
}
default: { DIE("unexpected next->type"); }
default: {
DIE("unexpected next->type");
break;
}
}
}
@ -1361,7 +1366,7 @@ static int builtin_echo(parser_t &parser, io_streams_t &streams, wchar_t **argv)
}
default: {
DIE("unexpected character in builtin_echo argument");
abort();
break;
}
}
}
@ -2854,7 +2859,7 @@ static const wcstring hist_cmd_to_string(hist_cmd_t hist_cmd) {
return L"save";
default:
DIE("unhandled hist_cmd_t constant");
abort();
break;
}
}
@ -3014,7 +3019,10 @@ static int builtin_history(parser_t &parser, io_streams_t &streams, wchar_t **ar
w.nextchar = NULL;
break;
}
default: { DIE("unexpected retval from wgetopt_long"); }
default: {
DIE("unexpected retval from wgetopt_long");
break;
}
}
}

View file

@ -508,42 +508,45 @@ void builtin_printf_state_t::print_direc(const wchar_t *start, size_t length, wc
case L'G': {
long double arg = string_to_scalar_type<long double>(argument, this);
if (!have_field_width) {
if (!have_precision)
if (!have_precision) {
this->append_format_output(fmt.c_str(), arg);
else
this->append_format_output(fmt.c_str(), precision, arg);
} else {
if (!have_precision)
this->append_format_output(fmt.c_str(), precision, arg);
}
} else {
if (!have_precision) {
this->append_format_output(fmt.c_str(), field_width, arg);
else
} else {
this->append_format_output(fmt.c_str(), field_width, precision, arg);
}
}
break;
}
case L'c': {
if (!have_field_width)
if (!have_field_width) {
this->append_format_output(fmt.c_str(), *argument);
else
} else {
this->append_format_output(fmt.c_str(), field_width, *argument);
}
break;
}
case L's': {
if (!have_field_width) {
if (!have_precision) {
this->append_format_output(fmt.c_str(), argument);
} else
this->append_format_output(fmt.c_str(), precision, argument);
} else {
if (!have_precision)
this->append_format_output(fmt.c_str(), precision, argument);
}
} else {
if (!have_precision) {
this->append_format_output(fmt.c_str(), field_width, argument);
else
} else {
this->append_format_output(fmt.c_str(), field_width, precision, argument);
}
}
break;
}
default: {
// TODO: Determine if this should call DIE()
// WTF
DIE("unexpected opt");
break;
}
@ -615,7 +618,10 @@ int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wch
modify_allowed_format_specifiers(ok, "cs", false);
break;
}
default: { goto no_more_flag_characters; }
default: {
goto no_more_flag_characters;
break;
}
}
}
no_more_flag_characters:;
@ -693,7 +699,10 @@ int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wch
f += print_esc(f, false);
break;
}
default: { this->append_output(*f); }
default: {
this->append_output(*f);
break;
}
}
}
return save_argc - argc;

View file

@ -519,7 +519,7 @@ expression *test_parser::parse_expression(unsigned int start, unsigned int end)
switch (argc) {
case 0: {
DIE("argc should not be zero"); // should have been caught by the above test
abort();
break;
}
case 1: {
return error(L"Missing argument at index %u", start + 1);

View file

@ -285,7 +285,7 @@ static void universal_callback(fish_message_type_t type, const wchar_t *name) {
}
default: {
DIE("unhandled fish_message_type_t constant");
abort();
break;
}
}

View file

@ -230,7 +230,10 @@ static wcstring event_desc_compact(const event_t &event) {
res = format_string(L"EVENT_GENERIC(%ls)", event.str_param1.c_str());
break;
}
default: { res = format_string(L"unknown/illegal event(%x)", event.type); }
default: {
res = format_string(L"unknown/illegal event(%x)", event.type);
break;
}
}
if (event.function_name.size()) {
return format_string(L"%ls: \"%ls\"", res.c_str(), event.function_name.c_str());

View file

@ -284,7 +284,7 @@ static bool io_transmogrify(const io_chain_t &in_chain, io_chain_t *out_chain,
}
default: {
DIE("unhandled io_mode constant");
abort();
break;
}
}
@ -827,7 +827,7 @@ void exec_job(parser_t &parser, job_t *j) {
case INTERNAL_EXEC:
// We should have handled exec up above.
DIE("INTERNAL_EXEC process found in pipeline, where it should never be. Aborting.");
abort();
break;
}
if (exec_error) {
@ -1089,7 +1089,7 @@ void exec_job(parser_t &parser, job_t *j) {
case INTERNAL_EXEC: {
// We should have handled exec up above.
DIE("INTERNAL_EXEC process found in pipeline, where it should never be. Aborting.");
abort();
break;
}
}

View file

@ -982,6 +982,7 @@ static expand_error_t expand_brackets(const wcstring &instr, expand_flags_t flag
}
case BRACKET_SEP: {
if (bracket_count == 1) last_sep = pos;
break;
}
}
}

View file

@ -314,6 +314,7 @@ static int fish_parse_opt(int argc, char **argv, std::vector<std::string> *cmds)
case 0: {
fwprintf(stderr, _(L"getopt_long() unexpectedly returned zero\n"));
exit(127);
break;
}
case 'c': {
cmds->push_back(optarg);
@ -358,6 +359,7 @@ static int fish_parse_opt(int argc, char **argv, std::vector<std::string> *cmds)
case 'v': {
fwprintf(stdout, _(L"%s, version %s\n"), PACKAGE_NAME, get_fish_version());
exit(0);
break;
}
case 'D': {
char *end;
@ -377,6 +379,7 @@ static int fish_parse_opt(int argc, char **argv, std::vector<std::string> *cmds)
default: {
// We assume getopt_long() has already emitted a diagnostic msg.
exit(1);
break;
}
}
}

View file

@ -616,7 +616,7 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
}
default: {
DIE("unhandled selection_direction_t constant");
abort();
break;
}
}
}
@ -649,10 +649,11 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
switch (direction) {
case direction_page_north: {
if (current_row > page_height)
if (current_row > page_height) {
current_row = current_row - page_height;
else
} else {
current_row = 0;
}
break;
}
case direction_north: {
@ -712,7 +713,7 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
}
default: {
DIE("unknown cardinal direction");
abort();
break;
}
}

View file

@ -333,7 +333,7 @@ static inline parse_token_type_t parse_token_type_from_tokenizer_token(
fprintf(stderr, "Bad token type %d passed to %s\n", (int)tokenizer_token_type,
__FUNCTION__);
DIE("bad token type");
abort();
break;
}
}
return result;

View file

@ -870,7 +870,7 @@ wcstring block_t::description() const {
}
default: {
DIE("unhandled block_type_t constant");
abort();
break;
}
}

View file

@ -84,6 +84,7 @@ static bool path_get_path_core(const wcstring &cmd, wcstring *out_path,
default: {
debug(1, MISSING_COMMAND_ERR_MSG, nxt_path.c_str());
wperror(L"access");
break;
}
}
}

View file

@ -219,6 +219,7 @@ void tokenizer_t::read_string() {
if (!tok_is_string_character(*(this->buff), is_first)) {
do_loop = 0;
}
break;
}
}
break;
@ -319,7 +320,7 @@ void tokenizer_t::read_string() {
}
default: {
DIE("unexpected mode in read_string");
abort();
break;
}
}
return;
@ -760,7 +761,10 @@ bool move_word_state_machine_t::consume_char(wchar_t c) {
case move_word_style_whitespace: {
return consume_char_whitespace(c);
}
default: { abort(); }
default: {
DIE("unhandled style");
break;
}
}
}