remove unreachable break statements

Found with clang's -Wunreachable-code-break

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-04-04 19:42:23 -07:00 committed by ridiculousfish
parent 6ab2da0e25
commit d9ad5a2627
36 changed files with 0 additions and 50 deletions

View file

@ -137,7 +137,6 @@ int parse_help_only_cmd_opts(struct help_only_cmd_opts_t &opts, int *optind, int
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -398,7 +398,6 @@ static int parse_cmd_opts(argparse_cmd_opts_t &opts, int *optind, //!OCLINT(hig
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -404,7 +404,6 @@ int parse_cmd_opts(bind_cmd_opts_t &opts, int *optind, //!OCLINT(high ncss meth
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -61,7 +61,6 @@ static int parse_cmd_opts(block_cmd_opts_t &opts, int *optind, //!OCLINT(high n
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }
@ -125,7 +124,6 @@ int builtin_block(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
} }
default: { default: {
DIE("unexpected scope"); DIE("unexpected scope");
break;
} }
} }
if (block) { if (block) {

View file

@ -54,7 +54,6 @@ static int parse_cmd_opts(builtin_cmd_opts_t &opts, int *optind, int argc, wchar
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -63,7 +63,6 @@ static int parse_cmd_opts(command_cmd_opts_t &opts, int *optind, int argc, wchar
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -74,7 +74,6 @@ static void replace_part(const wchar_t *begin, const wchar_t *end, const wchar_t
} }
default: { default: {
DIE("unexpected append_mode"); DIE("unexpected append_mode");
break;
} }
} }
out.append(end); out.append(end);
@ -275,7 +274,6 @@ int builtin_commandline(parser_t &parser, io_streams_t &streams, wchar_t **argv)
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }
@ -414,7 +412,6 @@ int builtin_commandline(parser_t &parser, io_streams_t &streams, wchar_t **argv)
} }
default: { default: {
DIE("unexpected buffer_part"); DIE("unexpected buffer_part");
break;
} }
} }

View file

@ -261,7 +261,6 @@ int builtin_complete(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -48,7 +48,6 @@ static int parse_cmd_opts(contains_cmd_opts_t &opts, int *optind, int argc, wcha
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -56,7 +56,6 @@ static int parse_cmd_opts(echo_cmd_opts_t &opts, int *optind, int argc, wchar_t
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -49,7 +49,6 @@ static int parse_cmd_opts(exit_cmd_opts_t &opts, int *optind, //!OCLINT(high nc
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -164,7 +164,6 @@ static int parse_cmd_opts(function_cmd_opts_t &opts, int *optind, //!OCLINT(hig
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -120,7 +120,6 @@ static int parse_cmd_opts(functions_cmd_opts_t &opts, int *optind, //!OCLINT(hi
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }
@ -194,7 +193,6 @@ static wcstring functions_def(const wcstring &name) {
case event_type_t::any: case event_type_t::any:
default: { default: {
DIE("unexpected next->type"); DIE("unexpected next->type");
break;
} }
} }
} }

View file

@ -191,7 +191,6 @@ static int parse_cmd_opts(history_cmd_opts_t &opts, int *optind, //!OCLINT(high
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }
@ -306,7 +305,6 @@ int builtin_history(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
} }
case HIST_UNDEF: { case HIST_UNDEF: {
DIE("Unexpected HIST_UNDEF seen"); DIE("Unexpected HIST_UNDEF seen");
break;
} }
} }

View file

@ -105,7 +105,6 @@ static void builtin_jobs_print(const job_t *j, int mode, int header, io_streams_
} }
default: { default: {
DIE("unexpected mode"); DIE("unexpected mode");
break;
} }
} }
} }
@ -165,7 +164,6 @@ int builtin_jobs(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -76,7 +76,6 @@ static int parse_cmd_opts(math_cmd_opts_t &opts, int *optind, //!OCLINT(high nc
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -570,7 +570,6 @@ void builtin_printf_state_t::print_direc(const wchar_t *start, size_t length, wc
} }
default: { default: {
DIE("unexpected opt"); DIE("unexpected opt");
break;
} }
} }
} }

View file

@ -43,7 +43,6 @@ int builtin_pwd(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -186,7 +186,6 @@ static int parse_cmd_opts(read_cmd_opts_t &opts, int *optind, //!OCLINT(high nc
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -48,7 +48,6 @@ static int parse_cmd_opts(return_cmd_opts_t &opts, int *optind, //!OCLINT(high
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -163,7 +163,6 @@ static int parse_cmd_opts(set_cmd_opts_t &opts, int *optind, //!OCLINT(high ncs
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }
@ -336,7 +335,6 @@ static void handle_env_return(int retval, const wchar_t *cmd, const wchar_t *key
} }
default: { default: {
DIE("unexpected vars.set() ret val"); DIE("unexpected vars.set() ret val");
break;
} }
} }
} }
@ -572,7 +570,6 @@ static void show_scope(const wchar_t *var_name, int scope, io_streams_t &streams
} }
default: { default: {
DIE("invalid scope"); DIE("invalid scope");
break;
} }
} }

View file

@ -145,7 +145,6 @@ int builtin_set_color(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -259,7 +259,6 @@ static int parse_cmd_opts(status_cmd_opts_t &opts, int *optind, //!OCLINT(high
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

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

View file

@ -253,7 +253,6 @@ int builtin_ulimit(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -205,7 +205,6 @@ int builtin_wait(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
} }
default: { default: {
DIE("unexpected retval from wgetopt_long"); DIE("unexpected retval from wgetopt_long");
break;
} }
} }
} }

View file

@ -867,7 +867,6 @@ static bool exec_process_in_job(parser_t &parser, process_t *p, const std::share
// We should have handled exec up above. // We should have handled exec up above.
DIE("process_type_t::exec process found in pipeline, where it should never be. " DIE("process_type_t::exec process found in pipeline, where it should never be. "
"Aborting."); "Aborting.");
break;
} }
} }
return true; return true;

View file

@ -615,7 +615,6 @@ static expand_result_t expand_cmdsubst(wcstring input, parser_t &parser,
} }
default: { default: {
DIE("unhandled parse_ret value"); DIE("unhandled parse_ret value");
break;
} }
} }

View file

@ -346,7 +346,6 @@ static int fish_parse_opt(int argc, char **argv, fish_cmd_opts_t *opts) {
printf("%*ls %ls\n", -name_width, cat->name, _(cat->description)); printf("%*ls %ls\n", -name_width, cat->name, _(cat->description));
} }
exit(0); exit(0);
break;
} }
case 'p': { case 'p': {
s_profiling_output_filename = optarg; s_profiling_output_filename = optarg;
@ -360,7 +359,6 @@ static int fish_parse_opt(int argc, char **argv, fish_cmd_opts_t *opts) {
case 'v': { case 'v': {
std::fwprintf(stdout, _(L"%s, version %s\n"), PACKAGE_NAME, get_fish_version()); std::fwprintf(stdout, _(L"%s, version %s\n"), PACKAGE_NAME, get_fish_version());
exit(0); exit(0);
break;
} }
case 'D': { case 'D': {
char *end; char *end;
@ -381,7 +379,6 @@ static int fish_parse_opt(int argc, char **argv, fish_cmd_opts_t *opts) {
default: { default: {
// We assume getopt_long() has already emitted a diagnostic msg. // We assume getopt_long() has already emitted a diagnostic msg.
exit(1); exit(1);
break;
} }
} }
} }

View file

@ -573,12 +573,10 @@ int main(int argc, char *argv[]) {
case 'h': { case 'h': {
print_help("fish_indent", 1); print_help("fish_indent", 1);
exit(0); exit(0);
break;
} }
case 'v': { case 'v': {
std::fwprintf(stderr, _(L"%ls, version %s\n"), program_name, get_fish_version()); std::fwprintf(stderr, _(L"%ls, version %s\n"), program_name, get_fish_version());
exit(0); exit(0);
break;
} }
case 'w': { case 'w': {
output_type = output_type_file; output_type = output_type_file;
@ -634,7 +632,6 @@ int main(int argc, char *argv[]) {
default: { default: {
// We assume getopt_long() has already emitted a diagnostic msg. // We assume getopt_long() has already emitted a diagnostic msg.
exit(1); exit(1);
break;
} }
} }
} }
@ -708,7 +705,6 @@ int main(int argc, char *argv[]) {
} }
case output_type_pygments_csv: { case output_type_pygments_csv: {
DIE("pygments_csv should have been handled above"); DIE("pygments_csv should have been handled above");
break;
} }
} }

View file

@ -732,7 +732,6 @@ bool pager_t::select_next_completion_in_direction(selection_motion_t direction,
} }
default: { default: {
DIE("unknown cardinal direction"); DIE("unknown cardinal direction");
break;
} }
} }

View file

@ -869,7 +869,6 @@ end_execution_reason_t parse_execution_context_t::expand_arguments_from_nodes(
} }
default: { default: {
DIE("unexpected expand_string() return value"); DIE("unexpected expand_string() return value");
break;
} }
} }
@ -1009,7 +1008,6 @@ end_execution_reason_t parse_execution_context_t::apply_variable_assignments(
default: { default: {
DIE("unexpected expand_string() return value"); DIE("unexpected expand_string() return value");
break;
} }
} }
wcstring_list_t vals; wcstring_list_t vals;

View file

@ -178,7 +178,6 @@ RESOLVE(statement) {
return production_for<decorated>(); return production_for<decorated>();
} }
} }
break;
} }
case parse_token_type_pipe: case parse_token_type_pipe:
case parse_token_type_redirection: case parse_token_type_redirection:

View file

@ -1014,7 +1014,6 @@ parser_test_error_bits_t parse_util_detect_errors_in_argument(tnode_t<grammar::a
} }
default: { default: {
DIE("unexpected parse_util_locate_cmdsubst() return value"); DIE("unexpected parse_util_locate_cmdsubst() return value");
break;
} }
} }
} }

View file

@ -345,7 +345,6 @@ static size_t wchar_to_utf8_internal(const utf8_wchar_t *in, size_t insize, char
} }
default: { default: {
DIE("unexpected utff8 len"); DIE("unexpected utff8 len");
break;
} }
} }

View file

@ -306,7 +306,6 @@ static bool wildcard_complete_internal(const wchar_t *str, const wchar_t *wc,
} }
default: { default: {
DIE("unreachable code reached"); DIE("unreachable code reached");
break;
} }
} }