SkUNREACHABLE should fail, not be UB.

The use of __builtin_unreachable() and __assume(false) are actually
injections of undefined behavior. They do not crash and they may allow
the compiler to assume that any values which could cause that location
to be reached cannot occur. They should only be used after code which
cannot return but the compiler cannot know that (such as inline assembly
which does not return and calls to functions which should have been
declared noreturn but were not).

Replace their use with __builtin_trap() and __failfast(). These are
similar to __builtin_debugtrap() or __debugbreak() but also indicate
that execution should not be resumed.

Change-Id: I46c1362f4e86944cc8e03f6f5837875ac71b69f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297024
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
1 file changed