summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC
diff options
context:
space:
mode:
authorMichel Hermier <michel.hermier@gmail.com>2021-12-16 17:58:07 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-18 21:01:10 -0800
commit0bfb7f9675f181b6f20ec692ce184f5058be5f1a (patch)
tree2186945a217fe7cd98fc9b322caca6a77969970f /Userland/Libraries/LibC
parent2c62d51e251f541e3dfac1a762badc2e353d81cd (diff)
downloadserenity-0bfb7f9675f181b6f20ec692ce184f5058be5f1a.zip
LibC: Move `_abort` next to `abort`
It should be now the only user of it, and it is more logical to have it in `stdlib.h` than in `assert.h`
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r--Userland/Libraries/LibC/assert.cpp6
-rw-r--r--Userland/Libraries/LibC/assert.h2
-rw-r--r--Userland/Libraries/LibC/stdlib.cpp6
-rw-r--r--Userland/Libraries/LibC/stdlib.h2
4 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Libraries/LibC/assert.cpp b/Userland/Libraries/LibC/assert.cpp
index dcbe0c30b5..20f0f2dc36 100644
--- a/Userland/Libraries/LibC/assert.cpp
+++ b/Userland/Libraries/LibC/assert.cpp
@@ -33,9 +33,3 @@ void __assertion_failed(const char* msg)
abort();
}
}
-
-void _abort()
-{
- asm volatile("ud2");
- __builtin_unreachable();
-}
diff --git a/Userland/Libraries/LibC/assert.h b/Userland/Libraries/LibC/assert.h
index 5e1072aaf8..86c042281c 100644
--- a/Userland/Libraries/LibC/assert.h
+++ b/Userland/Libraries/LibC/assert.h
@@ -23,8 +23,6 @@ __attribute__((noreturn)) void __assertion_failed(const char* msg);
# define assert(expr) ((void)(0))
#endif
-__attribute__((noreturn)) void _abort();
-
#ifndef __cplusplus
# define static_assert _Static_assert
#endif
diff --git a/Userland/Libraries/LibC/stdlib.cpp b/Userland/Libraries/LibC/stdlib.cpp
index 663682acb8..c39cf39e5d 100644
--- a/Userland/Libraries/LibC/stdlib.cpp
+++ b/Userland/Libraries/LibC/stdlib.cpp
@@ -209,6 +209,12 @@ int atexit(void (*handler)())
return __cxa_atexit(__atexit_to_cxa_atexit, (void*)handler, nullptr);
}
+void _abort()
+{
+ asm volatile("ud2");
+ __builtin_unreachable();
+}
+
void abort()
{
// For starters, send ourselves a SIGABRT.
diff --git a/Userland/Libraries/LibC/stdlib.h b/Userland/Libraries/LibC/stdlib.h
index b67030e1c3..5fe5fd2a8a 100644
--- a/Userland/Libraries/LibC/stdlib.h
+++ b/Userland/Libraries/LibC/stdlib.h
@@ -16,6 +16,8 @@ __BEGIN_DECLS
#define EXIT_FAILURE 1
#define MB_CUR_MAX 4
+__attribute__((noreturn)) void _abort();
+
__attribute__((malloc)) __attribute__((alloc_size(1))) void* malloc(size_t);
__attribute__((malloc)) __attribute__((alloc_size(1, 2))) void* calloc(size_t nmemb, size_t);
size_t malloc_size(void*);