LibC: Turn CRASH() into a function and add noreturn attribute
This way CRASH() can be used in functions that are themselves marked as noreturn.
This commit is contained in:
parent
d5e1250061
commit
44486e8818
Notes:
sideshowbarker
2024-07-18 20:28:03 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/44486e88189 Pull-request: https://github.com/SerenityOS/serenity/pull/6276
2 changed files with 9 additions and 4 deletions
|
@ -53,3 +53,9 @@ void __assertion_failed(const char* msg)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __crash()
|
||||||
|
{
|
||||||
|
asm volatile("ud2");
|
||||||
|
__builtin_unreachable();
|
||||||
|
}
|
||||||
|
|
|
@ -45,10 +45,9 @@ __attribute__((noreturn)) void __assertion_failed(const char* msg);
|
||||||
# define VERIFY_NOT_REACHED() CRASH()
|
# define VERIFY_NOT_REACHED() CRASH()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CRASH() \
|
__attribute__((noreturn)) void __crash();
|
||||||
do { \
|
|
||||||
asm volatile("ud2"); \
|
#define CRASH() __crash()
|
||||||
} while (0)
|
|
||||||
#define VERIFY assert
|
#define VERIFY assert
|
||||||
#define TODO VERIFY_NOT_REACHED
|
#define TODO VERIFY_NOT_REACHED
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue