simon-git: putty (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Thu Jan 3 08:15:59 GMT 2019


TL;DR:
  0112936e Replace assert(false) with an unreachable() macro.

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2019-01-03 08:15:59

commit 0112936ef7bc7bf4de39a17ce8b4cc37a9825f83
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=0112936ef7bc7bf4de39a17ce8b4cc37a9825f83;hp=61dec9a07ad9c7ba3f8e267116e8faeabb7d791b
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Jan 3 08:12:19 2019 +0000

    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.

 cmdgen.c                |  8 ++++----
 import.c                | 11 +++++------
 misc.h                  | 18 ++++++++++++++++++
 nocmdline.c             |  2 +-
 portfwd.c               |  2 +-
 ssh1connection-client.c |  6 ++----
 ssh1connection-server.c |  5 ++---
 ssh1login.c             |  3 +--
 ssh2connection-client.c | 12 +++++-------
 ssh2connection-server.c | 26 +++++++++++++-------------
 ssh2transport.c         |  2 +-
 sshaes.c                | 18 +++++++++---------
 sshcommon.c             |  8 ++++----
 sshpubk.c               |  2 +-
 sshsh256.c              |  2 +-
 sshsha.c                |  2 +-
 sshverstring.c          |  9 ++++-----
 terminal.c              |  2 +-
 unix/gtkwin.c           |  2 +-
 unix/uxnet.c            |  4 ++--
 unix/uxpgnt.c           |  4 ++--
 windows/window.c        |  2 +-
 windows/winnet.c        |  2 +-
 windows/winpgen.c       |  4 +++-
 windows/winpgnt.c       |  4 +++-
 windows/winpgntc.c      |  2 +-
 x11fwd.c                |  2 +-
 27 files changed, 89 insertions(+), 75 deletions(-)



More information about the tartarus-commits mailing list