Add noreturn
attribute to crash()
Since crash() stops the program, adding the `noreturn` attribute allows the compiler to optimize in certain cases. CLion and ReSharper also use this in its static analysis engine to warn about unreachable code. Additionally, since `assert()` uses `crash()` if the checked pointer is null, this lets the analysis engine correctly discern that the pointer will in fact not be null and stop erroneous null pointer warnings.
This commit is contained in:
parent
28898b026e
commit
8700f483e5
1 changed files with 1 additions and 1 deletions
|
@ -111,7 +111,7 @@ typedef struct Cpu_Capabilities {
|
||||||
#define alignat(x) __attribute__((aligned(x)))
|
#define alignat(x) __attribute__((aligned(x)))
|
||||||
#define COMPILER_HAS_MEMCPY_INTRINSICS 1
|
#define COMPILER_HAS_MEMCPY_INTRINSICS 1
|
||||||
|
|
||||||
inline void
|
inline void __attribute__((noreturn))
|
||||||
crash() {
|
crash() {
|
||||||
__builtin_trap();
|
__builtin_trap();
|
||||||
volatile int *a = 0;
|
volatile int *a = 0;
|
||||||
|
|
Reference in a new issue