https://clang.llvm.org/docs/LanguageExtensions.html
__builtin_unreachable
__builtin_unreachable
is used to indicate that a specific point in the program cannot be reached, even if the compiler might otherwise think it can. This is useful to improve optimization and eliminates certain warnings. For example, without the __builtin_unreachable
in the example below, the compiler assumes that the inline asm can fall through and prints a “function declared ‘noreturn
’ should not return” warning.
Syntax:
Example of use:
Description:
The
__builtin_unreachable()
builtin has completely undefined behavior. Since it has undefined behavior, it is a statement that it is never reached and the optimizer can take advantage of this to produce better code. This builtin takes no arguments and produces a void result.
Query for this feature with
__has_builtin(__builtin_unreachable)
.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.