diff --git a/pscp.c b/pscp.c index e53f1dee..bcf18dcf 100644 --- a/pscp.c +++ b/pscp.c @@ -127,14 +127,10 @@ static void tell_user(FILE *stream, const char *fmt, ...) sfree(str2); } -/* - * In pscp, all agent requests should be synchronous, so this is a - * never-called stub. - */ void agent_schedule_callback(void (*callback)(void *, void *, int), void *callback_ctx, void *data, int len) { - assert(!"We shouldn't be here"); + unreachable("all PSCP agent requests should be synchronous"); } /* diff --git a/psftp.c b/psftp.c index 73f58f3e..c0d2f9df 100644 --- a/psftp.c +++ b/psftp.c @@ -2428,14 +2428,10 @@ static bool verbose = false; void ldisc_echoedit_update(Ldisc *ldisc) { } -/* - * In psftp, all agent requests should be synchronous, so this is a - * never-called stub. - */ void agent_schedule_callback(void (*callback)(void *, void *, int), void *callback_ctx, void *data, int len) { - assert(!"We shouldn't be here"); + unreachable("all PSFTP agent requests should be synchronous"); } /* diff --git a/ssh2transport.c b/ssh2transport.c index 1ed0edd7..e577c5ac 100644 --- a/ssh2transport.c +++ b/ssh2transport.c @@ -314,8 +314,8 @@ static struct kexinit_algorithm *ssh2_kexinit_addalg(struct kexinit_algorithm list[i].name = name; return &list[i]; } - assert(!"No space in KEXINIT list"); - return NULL; + + unreachable("Should never run out of space in KEXINIT list"); } bool ssh2_common_filter_queue(PacketProtocolLayer *ppl) diff --git a/sshshare.c b/sshshare.c index c70d5da1..4d124187 100644 --- a/sshshare.c +++ b/sshshare.c @@ -1292,8 +1292,7 @@ void share_got_pkt_from_server(ssh_sharing_connstate *cs, int type, break; default: - assert(!"This packet type should never have come from ssh.c"); - break; + unreachable("This packet type should never have come from ssh.c"); } } diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index b2f44242..cd3f8092 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -357,7 +357,7 @@ char *dlg_editbox_get(union control *ctrl, dlgparam *dp) return dupstr(gtk_entry_get_text(GTK_ENTRY(uc->entry))); } - assert(!"We shouldn't get here"); + unreachable("bad control type in editbox_get"); } #if !GTK_CHECK_VERSION(2,4,0) @@ -395,7 +395,7 @@ void dlg_listbox_clear(union control *ctrl, dlgparam *dp) return; } #endif - assert(!"We shouldn't get here"); + unreachable("bad control type in listbox_clear"); } void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index) @@ -429,7 +429,7 @@ void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index) return; } #endif - assert(!"We shouldn't get here"); + unreachable("bad control type in listbox_del"); } void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text) @@ -587,7 +587,7 @@ void dlg_listbox_addwithid(union control *ctrl, dlgparam *dp, goto done; } #endif - assert(!"We shouldn't get here"); + unreachable("bad control type in listbox_addwithid"); done: dp->flags &= ~FLAG_UPDATING_COMBO_LIST; } @@ -626,7 +626,7 @@ int dlg_listbox_getid(union control *ctrl, dlgparam *dp, int index) return ret; } #endif - assert(!"We shouldn't get here"); + unreachable("bad control type in listbox_getid"); return -1; /* placate dataflow analysis */ } @@ -711,7 +711,7 @@ int dlg_listbox_index(union control *ctrl, dlgparam *dp) return ret; } #endif - assert(!"We shouldn't get here"); + unreachable("bad control type in listbox_index"); return -1; /* placate dataflow analysis */ } @@ -768,7 +768,7 @@ bool dlg_listbox_issel(union control *ctrl, dlgparam *dp, int index) return ret; } #endif - assert(!"We shouldn't get here"); + unreachable("bad control type in listbox_issel"); return false; /* placate dataflow analysis */ } @@ -837,7 +837,7 @@ void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index) return; } #endif - assert(!"We shouldn't get here"); + unreachable("bad control type in listbox_select"); } void dlg_text_set(union control *ctrl, dlgparam *dp, char const *text) @@ -884,8 +884,7 @@ void dlg_label_change(union control *ctrl, dlgparam *dp, char const *text) shortcut_highlight(uc->label, ctrl->listbox.shortcut); break; default: - assert(!"This shouldn't happen"); - break; + unreachable("bad control type in label_change"); } } @@ -1016,8 +1015,7 @@ void dlg_set_focus(union control *ctrl, dlgparam *dp) break; } #endif - assert(!"We shouldn't get here"); - break; + unreachable("bad control type in set_focus"); } } @@ -2730,8 +2728,7 @@ gint win_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data) break; } #endif - assert(!"We shouldn't get here"); - break; + unreachable("bad listbox type in win_key_press"); } break; } diff --git a/windows/winctrls.c b/windows/winctrls.c index f30ccf39..3389ce00 100644 --- a/windows/winctrls.c +++ b/windows/winctrls.c @@ -1658,9 +1658,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc, sfree(escaped); break; default: - assert(!"Can't happen"); - num_ids = 0; /* placate gcc */ - break; + unreachable("bad control type in winctrl_layout"); } /* @@ -2096,8 +2094,7 @@ int dlg_radiobutton_get(union control *ctrl, dlgparam *dp) for (i = 0; i < c->ctrl->radio.nbuttons; i++) if (IsDlgButtonChecked(dp->hwnd, c->base_id + 1 + i)) return i; - assert(!"No radio button was checked?!"); - return 0; + unreachable("no radio button was checked"); } void dlg_checkbox_set(union control *ctrl, dlgparam *dp, bool checked) @@ -2286,8 +2283,7 @@ void dlg_label_change(union control *ctrl, dlgparam *dp, char const *text) id = c->base_id; break; default: - assert(!"Can't happen"); - break; + unreachable("bad control type in label_change"); } if (escaped) { SetDlgItemText(dp->hwnd, id, escaped); diff --git a/windows/winpgnt.c b/windows/winpgnt.c index 83c516c2..718feb9f 100644 --- a/windows/winpgnt.c +++ b/windows/winpgnt.c @@ -1119,14 +1119,10 @@ void spawn_cmd(const char *cmdline, const char *args, int show) } } -/* - * This is a can't-happen stub, since Pageant never makes - * asynchronous agent requests. - */ void agent_schedule_callback(void (*callback)(void *, void *, int), void *callback_ctx, void *data, int len) { - assert(!"We shouldn't get here"); + unreachable("all Pageant's own agent requests should be synchronous"); } void cleanup_exit(int code)