mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
LibC: Simplify ASSERT() to reduce code size
Instead of pushing the message, file name, line# and function name separately, we now mash the message, file name and line# into a string constant and pass that. This means that the failure path only has to push a single address onto the stack, reducing the code size and causing the compiler to inline many more functions containing an assertions (e.g RefPtr::operator*()) Obviously if you wanted minimal size, you could turn assertions off entirely, but I really like running with assertions, so let's make a little effort to reduce their impact. :^)
This commit is contained in:
parent
8ebee4bce6
commit
038fdc2017
2 changed files with 7 additions and 5 deletions
|
@ -32,10 +32,10 @@
|
|||
extern "C" {
|
||||
|
||||
#ifdef DEBUG
|
||||
void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func)
|
||||
void __assertion_failed(const char* msg)
|
||||
{
|
||||
dbgprintf("USERSPACE(%d) ASSERTION FAILED: %s\n%s:%u in %s\n", getpid(), msg, file, line, func);
|
||||
fprintf(stderr, "ASSERTION FAILED: %s\n%s:%u in %s\n", msg, file, line, func);
|
||||
dbgprintf("USERSPACE(%d) ASSERTION FAILED: %s\n", getpid(), msg);
|
||||
fprintf(stderr, "ASSERTION FAILED: %s\n", msg);
|
||||
abort();
|
||||
for (;;)
|
||||
;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue