Mark LibC's assertion faillure helper with __NORETURN.
This commit is contained in:
parent
8b4b684d6d
commit
9bd09454e3
Notes:
sideshowbarker
2024-07-19 18:33:54 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9bd09454e3f
3 changed files with 3 additions and 3 deletions
LibC
|
@ -4,11 +4,10 @@
|
|||
|
||||
extern "C" {
|
||||
|
||||
extern void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func)
|
||||
void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func)
|
||||
{
|
||||
fprintf(stderr, "ASSERTION FAILED: %s\n%s:%u in %s\n", msg, file, line, func);
|
||||
abort();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func);
|
||||
void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func) __NORETURN;
|
||||
|
||||
#define assert(expr) ((expr) ? (void)0 : __assertion_failed(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__))
|
||||
#define CRASH() do { asm volatile("ud2"); } while(0)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#define ALWAYS_INLINE inline __attribute__ ((always_inline))
|
||||
#define __NORETURN __attribute__ ((noreturn))
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
|
|
Loading…
Add table
Reference in a new issue