From: Timo Sirainen Date: Thu, 5 Oct 2017 10:42:07 +0000 (+0300) Subject: global: Remove dead code X-Git-Tag: 2.3.0.rc1~898 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=12c57531519d66e237e865c6ee3f7eadfe148550;p=thirdparty%2Fdovecot%2Fcore.git global: Remove dead code Found with clang static analyzer. --- diff --git a/src/auth/db-dict.c b/src/auth/db-dict.c index a4c3b53ce7..89903f841f 100644 --- a/src/auth/db-dict.c +++ b/src/auth/db-dict.c @@ -176,7 +176,7 @@ static const char *parse_setting(const char *key, const char *value, field->value = p_strdup(ctx->conn->pool, value); return NULL; } - return t_strconcat("Unknown setting: ", key, NULL); + i_unreached(); } static bool parse_section(const char *type, const char *name, diff --git a/src/auth/db-ldap.c b/src/auth/db-ldap.c index 311d5f5c78..c03fecaf4b 100644 --- a/src/auth/db-ldap.c +++ b/src/auth/db-ldap.c @@ -1665,7 +1665,7 @@ db_ldap_field_ptr_expand(const char *data, void *context, suffix = strchr(t_strcut(data, ':'), '@'); if ((ret = db_ldap_field_expand(data, ctx, &field_name, error_r)) <= 0) - return ret; + i_unreached(); if (field_name[0] == '\0') { *value_r = ""; return 1; diff --git a/src/doveadm/dsync/dsync-mailbox-tree.c b/src/doveadm/dsync/dsync-mailbox-tree.c index 71874a3243..0be8341fb3 100644 --- a/src/doveadm/dsync/dsync-mailbox-tree.c +++ b/src/doveadm/dsync/dsync-mailbox-tree.c @@ -522,5 +522,5 @@ dsync_mailbox_delete_type_to_string(enum dsync_mailbox_delete_type type) case DSYNC_MAILBOX_DELETE_TYPE_UNSUBSCRIBE: return "unsubscribe"; } - return t_strdup_printf("unknown #%u", type); + i_unreached(); } diff --git a/src/lib-http/http-client-peer.c b/src/lib-http/http-client-peer.c index 1de86455c1..98d2ae8c53 100644 --- a/src/lib-http/http-client-peer.c +++ b/src/lib-http/http-client-peer.c @@ -97,7 +97,6 @@ int http_client_peer_addr_cmp return null_strcmp(peer1->a.un.path, peer2->a.un.path); } i_unreached(); - return 0; } /* diff --git a/src/lib-http/test-http-server-errors.c b/src/lib-http/test-http-server-errors.c index 81db670d4d..6767ba3d95 100644 --- a/src/lib-http/test-http-server-errors.c +++ b/src/lib-http/test-http-server-errors.c @@ -726,7 +726,6 @@ static void test_server_timeout(void *context ATTR_UNUSED) { i_fatal("Server timed out"); - io_loop_stop(ioloop); } static void diff --git a/src/lib-ldap/ldap-connection.c b/src/lib-ldap/ldap-connection.c index 546777849f..4777354c03 100644 --- a/src/lib-ldap/ldap-connection.c +++ b/src/lib-ldap/ldap-connection.c @@ -402,7 +402,7 @@ ldap_connection_connect_parse(struct ldap_connection *conn, default: i_unreached(); } - return LDAP_SUCCESS; + i_unreached(); } static diff --git a/src/lib-storage/index/imapc/imapc-list.c b/src/lib-storage/index/imapc/imapc-list.c index 16fca00699..653b53ed7d 100644 --- a/src/lib-storage/index/imapc/imapc-list.c +++ b/src/lib-storage/index/imapc/imapc-list.c @@ -475,7 +475,6 @@ imapc_list_get_temp_prefix(struct mailbox_list *_list, bool global) } else { i_panic("imapc: Can't return a temp prefix for '%s'", _list->ns->prefix); - return NULL; } } diff --git a/src/lib-storage/index/index-mail.c b/src/lib-storage/index/index-mail.c index a6cadf7c83..fae86d59d0 100644 --- a/src/lib-storage/index/index-mail.c +++ b/src/lib-storage/index/index-mail.c @@ -1540,7 +1540,6 @@ int index_mail_get_special(struct mail *_mail, return 0; default: i_unreached(); - return -1; } } diff --git a/src/lib-storage/index/shared/shared-list.c b/src/lib-storage/index/shared/shared-list.c index b0deb7b640..38c70a411b 100644 --- a/src/lib-storage/index/shared/shared-list.c +++ b/src/lib-storage/index/shared/shared-list.c @@ -82,7 +82,6 @@ shared_list_get_temp_prefix(struct mailbox_list *list, bool global ATTR_UNUSED) { i_panic("shared mailbox list: Can't return a temp prefix for '%s'", list->ns->prefix); - return NULL; } static const char * diff --git a/src/lib-storage/mail-search-mime.c b/src/lib-storage/mail-search-mime.c index 4a4b95607e..efd1cad584 100644 --- a/src/lib-storage/mail-search-mime.c +++ b/src/lib-storage/mail-search-mime.c @@ -307,10 +307,8 @@ bool mail_search_mime_arg_one_equals(const struct mail_search_mime_arg *arg1, case SEARCH_MIME_DEPTH_MAX: case SEARCH_MIME_INDEX: return arg1->value.number == arg2->value.number; - break; } i_unreached(); - return FALSE; } bool mail_search_mime_arg_equals(const struct mail_search_mime_arg *arg1, diff --git a/src/lib-storage/mail-search.c b/src/lib-storage/mail-search.c index 5af50d907a..66db4c4cda 100644 --- a/src/lib-storage/mail-search.c +++ b/src/lib-storage/mail-search.c @@ -665,7 +665,6 @@ bool mail_search_arg_one_equals(const struct mail_search_arg *arg1, } i_unreached(); - return FALSE; } bool mail_search_arg_equals(const struct mail_search_arg *arg1, diff --git a/src/lib/failures.c b/src/lib/failures.c index 738828bef7..f669339235 100644 --- a/src/lib/failures.c +++ b/src/lib/failures.c @@ -290,7 +290,8 @@ void i_panic(const char *format, ...) va_start(args, format); fatal_handler(&ctx, format, args); - va_end(args); + i_unreached(); + /*va_end(args);*/ } void i_fatal(const char *format, ...) @@ -304,7 +305,8 @@ void i_fatal(const char *format, ...) va_start(args, format); fatal_handler(&ctx, format, args); - va_end(args); + i_unreached(); + /*va_end(args);*/ } void i_fatal_status(int status, const char *format, ...) @@ -318,7 +320,8 @@ void i_fatal_status(int status, const char *format, ...) va_start(args, format); fatal_handler(&ctx, format, args); - va_end(args); + i_unreached(); + /*va_end(args);*/ } void i_error(const char *format, ...) diff --git a/src/lib/test-array.c b/src/lib/test-array.c index da7225a942..52f2f6f80d 100644 --- a/src/lib/test-array.c +++ b/src/lib/test-array.c @@ -306,7 +306,7 @@ enum fatal_test_state fatal_array(unsigned int stage) /* allocation big enough, but memory not initialised */ useless_ptr = array_idx(&ad, 0); return FATAL_TEST_FAILURE; - } break; + } case 1: { ARRAY(double) ad; @@ -315,7 +315,7 @@ enum fatal_test_state fatal_array(unsigned int stage) /* actual out of range address requested */ useless_ptr = array_idx(&ad, 2); return FATAL_TEST_FAILURE; - } break; + } case 2: { ARRAY(double) ad; @@ -325,7 +325,7 @@ enum fatal_test_state fatal_array(unsigned int stage) array_append(&as, tmps, 2); array_copy(&ad.arr, 1, &as.arr, 0, 4); return FATAL_TEST_FAILURE; - } break; + } } test_end(); /* Forces the compiler to check the value of useless_ptr, so that it diff --git a/src/master/main.c b/src/master/main.c index cb19b68678..cc9a169203 100644 --- a/src/master/main.c +++ b/src/master/main.c @@ -82,7 +82,7 @@ void process_exec(const char *cmd) argv[0]); if (strncmp(argv[0], PACKAGE, strlen(PACKAGE)) != 0) argv[0] = t_strconcat(PACKAGE"-", argv[0], NULL); - (void)execv_const(executable, argv); + execv_const(executable, argv); } int get_uidgid(const char *user, uid_t *uid_r, gid_t *gid_r,