Handle unreachable code in different ways 08/231708/9
authorLukasz Pawelczyk <l.pawelczyk@samsung.com>
Thu, 23 Apr 2020 13:24:52 +0000 (15:24 +0200)
committerLukasz Pawelczyk <l.pawelczyk@samsung.com>
Fri, 26 Jun 2020 15:36:20 +0000 (17:36 +0200)
commitbc963892606c473daa79c05bf0eb88ef2bfbef89
treeb8c3cc68fdcf72832633064e3829e48694bcd486
parentb53ca9724fada52c7b499fbbcf4be8435f5fc0e4
Handle unreachable code in different ways

The idea is to remove unreachable code where possible. To change it to
asserts where it makes sense. To mark it with explicit assert(false)
where unreachable code can't be removed.

There are cases where unreachable code needs to exist to silence
compiler warnings. Eg. default cases for switch. Mark them with
assert(false) so it's immediately visible that the flow should never
reach them (e.g. because the check has been performed earlier and it's
internal function).

Change-Id: I7d53c9772fe54b5c4dfd0f7205eec633fe4b9c20
src/crypto.c
src/digest.c
src/encrypt.c
src/key.c
src/rsa.c
src/sign.c
src/simple.c