mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Replace assert(false) with an unreachable() macro.
Taking a leaf out of the LLVM code base: this macro still includes an assert(false) so that the message will show up in a typical build, but it follows it up with a call to a function explicitly marked as no- return. So this ought to do a better job of convincing compilers that once a code path hits this function it _really doesn't_ have to still faff about with making up a bogus return value or filling in a variable that 'might be used uninitialised' in the following code that won't be reached anyway. I've gone through the existing code looking for the assert(false) / assert(0) idiom and replaced all the ones I found with the new macro, which also meant I could remove a few pointless return statements and variable initialisations that I'd already had to put in to placate compiler front ends.
This commit is contained in:
@ -142,17 +142,17 @@ struct ssh_rportfwd *ssh2_rportfwd_alloc(
|
||||
int addressfamily, const char *log_description, PortFwdRecord *pfr,
|
||||
ssh_sharing_connstate *share_ctx)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
void ssh2_rportfwd_remove(ConnectionLayer *cl, struct ssh_rportfwd *rpf)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
SshChannel *ssh2_session_open(ConnectionLayer *cl, Channel *chan)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
SshChannel *ssh2_serverside_x11_open(
|
||||
@ -202,19 +202,19 @@ SshChannel *ssh2_serverside_agent_open(ConnectionLayer *cl, Channel *chan)
|
||||
|
||||
void ssh2channel_start_shell(SshChannel *sc, bool want_reply)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
void ssh2channel_start_command(
|
||||
SshChannel *sc, bool want_reply, const char *command)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
bool ssh2channel_start_subsystem(
|
||||
SshChannel *sc, bool want_reply, const char *subsystem)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
void ssh2channel_send_exit_status(SshChannel *sc, int status)
|
||||
@ -262,38 +262,38 @@ void ssh2channel_request_x11_forwarding(
|
||||
SshChannel *sc, bool want_reply, const char *authproto,
|
||||
const char *authdata, int screen_number, bool oneshot)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
void ssh2channel_request_agent_forwarding(SshChannel *sc, bool want_reply)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
void ssh2channel_request_pty(
|
||||
SshChannel *sc, bool want_reply, Conf *conf, int w, int h)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
bool ssh2channel_send_env_var(
|
||||
SshChannel *sc, bool want_reply, const char *var, const char *value)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
bool ssh2channel_send_serial_break(SshChannel *sc, bool want_reply, int length)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
bool ssh2channel_send_signal(
|
||||
SshChannel *sc, bool want_reply, const char *signame)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
||||
void ssh2channel_send_terminal_size_change(SshChannel *sc, int w, int h)
|
||||
{
|
||||
assert(false && "Should never be called in the server");
|
||||
unreachable("Should never be called in the server");
|
||||
}
|
||||
|
Reference in New Issue
Block a user