From 9e746d42d2e3faa526f12ba222f5ee6924dd30f9 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 26 Dec 2025 10:08:33 +0100 Subject: feat! breaking API changes, use header guards and libSystem fixes. Signed-off-by: Amlal El Mahrouss --- src/libSystem/SystemKit/Err.h | 5 ++++- src/libSystem/SystemKit/Jail.h | 5 ++++- src/libSystem/SystemKit/Macros.h | 5 ++++- src/libSystem/SystemKit/Syscall.h | 5 ++++- src/libSystem/SystemKit/Verify.h | 10 +++++----- 5 files changed, 21 insertions(+), 9 deletions(-) (limited to 'src/libSystem/SystemKit') diff --git a/src/libSystem/SystemKit/Err.h b/src/libSystem/SystemKit/Err.h index ea36abde..7e8dbee4 100644 --- a/src/libSystem/SystemKit/Err.h +++ b/src/libSystem/SystemKit/Err.h @@ -4,7 +4,8 @@ ======================================== */ -#pragma once +#ifndef SYSTEMKIT_ERR_H +#define SYSTEMKIT_ERR_H #include @@ -56,3 +57,5 @@ inline constexpr ErrRef kErrorUnimplemented = -1; /// @brief The last error reported by the system to the process. IMPORT_C ErrRef kLastError; + +#endif diff --git a/src/libSystem/SystemKit/Jail.h b/src/libSystem/SystemKit/Jail.h index f28968b4..acf392b4 100644 --- a/src/libSystem/SystemKit/Jail.h +++ b/src/libSystem/SystemKit/Jail.h @@ -4,7 +4,8 @@ ======================================== */ -#pragma once +#ifndef SYSTEMKIT_JAIL_H +#define SYSTEMKIT_JAIL_H #include @@ -34,3 +35,5 @@ struct JAIL { /// @brief Get the current jail /// @return Pointer to the current jail structure, or NULL if not in a jail IMPORT_C struct JAIL* JailGetCurrent(Void); + +#endif diff --git a/src/libSystem/SystemKit/Macros.h b/src/libSystem/SystemKit/Macros.h index b30db701..dab30384 100644 --- a/src/libSystem/SystemKit/Macros.h +++ b/src/libSystem/SystemKit/Macros.h @@ -7,7 +7,8 @@ Purpose: libsci Macros header. ======================================== */ -#pragma once +#ifndef SYSTEMKIT_MACROS_H +#define SYSTEMKIT_MACROS_H /***********************************************************************************/ /// @file libSystem/Macros.h @@ -124,3 +125,5 @@ typedef nullPtr NullPtr; #define LIBSYS_UNUSED(X) ((void) X) IMPORT_C void _rtl_assert(Bool expr, const Char* origin); + +#endif diff --git a/src/libSystem/SystemKit/Syscall.h b/src/libSystem/SystemKit/Syscall.h index 58d7d7f1..1d30782f 100644 --- a/src/libSystem/SystemKit/Syscall.h +++ b/src/libSystem/SystemKit/Syscall.h @@ -4,7 +4,8 @@ ======================================== */ -#pragma once +#ifndef SYSTEMKIT_SYSCALL_H +#define SYSTEMKIT_SYSCALL_H #include #include @@ -19,3 +20,5 @@ IMPORT_C UInt64 libsys_hash_64(const Char* path); #ifndef SYSCALL_HASH #define SYSCALL_HASH(str) libsys_hash_64(str) #endif // !SYSCALL_HASH + +#endif diff --git a/src/libSystem/SystemKit/Verify.h b/src/libSystem/SystemKit/Verify.h index c584ac82..0bdfd2ca 100644 --- a/src/libSystem/SystemKit/Verify.h +++ b/src/libSystem/SystemKit/Verify.h @@ -7,7 +7,8 @@ ======================================== */ -#pragma once +#ifndef SYSTEMKIT_VERIFY_H +#define SYSTEMKIT_VERIFY_H #include @@ -15,14 +16,11 @@ namespace LibSystem::Verify { /// @author 0xf00sec, and Amlal El Mahrouss /// @brief safe cast operator. template -inline R sys_safe_cast(const T* ptr) { +inline R* sys_safe_cast(const T* ptr) { ::_rtl_assert(ptr, "safe cast failed!"); return static_cast(const_cast(ptr)); } -template -inline Void sys_safe_cast(const T* ptr) = delete; - template struct is_castable { using return_type = U; @@ -45,3 +43,5 @@ constexpr R* sys_constexpr_cast(T* ptr) { return static_cast(ptr); } } // namespace LibSystem::Verify + +#endif -- cgit v1.2.3