summaryrefslogtreecommitdiffhomepage
path: root/dev/LibC++
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-08-28 09:06:29 +0200
committerGitHub <noreply@github.com>2025-08-28 09:06:29 +0200
commit891bc2653b911a4553a39d03bae4d62d866dbd07 (patch)
tree3d32f48d0c181fa7cc31173b122dbfc885c67217 /dev/LibC++
parent5467549fa5d656afd0c6bf12c6c3928a8c919591 (diff)
parenta7b43769b2f6dae5abdda4cb2649e43b02fbeea7 (diff)
Merge pull request #10 from nekernel-org/dev
v0.0.3e1 — Ogre
Diffstat (limited to 'dev/LibC++')
-rw-r--r--dev/LibC++/__abi+unreachable.cc3
-rw-r--r--dev/LibC++/base_process.h17
-rw-r--r--dev/LibC++/utility.h12
3 files changed, 23 insertions, 9 deletions
diff --git a/dev/LibC++/__abi+unreachable.cc b/dev/LibC++/__abi+unreachable.cc
index fb1d336..f72e749 100644
--- a/dev/LibC++/__abi+unreachable.cc
+++ b/dev/LibC++/__abi+unreachable.cc
@@ -12,5 +12,6 @@ static const int32_t __unreachable_code = 34;
extern "C" void __compilerkit_unreachable(void) {
std::base_process::signal(__unreachable_code);
- while (1);
+ while (1)
+ ;
} \ No newline at end of file
diff --git a/dev/LibC++/base_process.h b/dev/LibC++/base_process.h
index 126ac60..034240f 100644
--- a/dev/LibC++/base_process.h
+++ b/dev/LibC++/base_process.h
@@ -12,7 +12,10 @@
/// @param code the exit code.
/// @return the return > 0 for non successful.
extern "C" int exit_(int code);
-extern "C" int signal_(int code);
+
+/// @brief CRT signal handler.
+/// @param code the signal code.
+extern "C" void signal_(int code);
/// @brief Standard C++ namespace
namespace std::base_process {
@@ -21,7 +24,17 @@ inline int signal(int code) {
return -1;
}
-inline int exit(int code) {
+extern "C" void (*__atexit_cdecl_ptr)(void);
+extern "C" void (**__atexit_lst_ptr)(void);
+extern "C" size_t __atexit_lst_cnt;
+
+inline int32_t exit(const int32_t& code) {
+ for (auto idx = 0UL; idx < __atexit_lst_cnt; ++idx) {
+ __atexit_lst_ptr[idx]();
+ }
+
+ if (__atexit_cdecl_ptr) __atexit_cdecl_ptr();
+
exit_(code);
return -1;
}
diff --git a/dev/LibC++/utility.h b/dev/LibC++/utility.h
index 4f1d2d7..082d73d 100644
--- a/dev/LibC++/utility.h
+++ b/dev/LibC++/utility.h
@@ -1,7 +1,7 @@
/* -------------------------------------------
- \
- Copyright (C) 2024-2025 Amlal El Mahrouss, all rights reserved. \
- \
+
+ Copyright (C) 2024-2025 Amlal El Mahrouss, all rights reserved.
+
------------------------------------------- */
#ifndef LIBCXX_UTILITY_H
@@ -13,8 +13,8 @@ namespace std {
/// @param arg the object.
/// @return object's rvalue
template <typename Args>
-inline Args&& forward(Args& arg) {
- return static_cast<Args&&>(arg);
+inline auto forward(Args& arg) -> Args&& {
+ return static_cast<const Args&&>(arg);
}
/// @brief Move object.
@@ -22,7 +22,7 @@ inline Args&& forward(Args& arg) {
/// @param arg the object.
/// @return object's rvalue
template <typename Args>
-inline Args&& move(Args&& arg) {
+inline auto move(Args&& arg) -> Args&& {
return static_cast<Args&&>(arg);
}
} // namespace std