diff options
| -rw-r--r-- | .clang-tidy | 2 | ||||
| -rw-r--r-- | .vscode/settings.json | 5 | ||||
| -rw-r--r-- | libs/kstd/CMakeLists.txt | 34 | ||||
| -rw-r--r-- | libs/kstd/kstd/allocator (renamed from libs/kstd/include/kstd/allocator) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/asm_ptr (renamed from libs/kstd/include/kstd/asm_ptr) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/concepts.hpp (renamed from libs/kstd/include/kstd/bits/concepts.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/flat_map.hpp (renamed from libs/kstd/include/kstd/bits/flat_map.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/arg.hpp (renamed from libs/kstd/include/kstd/bits/format/arg.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/args.hpp (renamed from libs/kstd/include/kstd/bits/format/args.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/context.hpp (renamed from libs/kstd/include/kstd/bits/format/context.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/error.hpp (renamed from libs/kstd/include/kstd/bits/format/error.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter.hpp (renamed from libs/kstd/include/kstd/bits/format/formatter.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter/bool.hpp (renamed from libs/kstd/include/kstd/bits/format/formatter/bool.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter/byte.hpp (renamed from libs/kstd/include/kstd/bits/format/formatter/byte.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter/char.hpp (renamed from libs/kstd/include/kstd/bits/format/formatter/char.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter/cstring.hpp (renamed from libs/kstd/include/kstd/bits/format/formatter/cstring.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter/integral.hpp (renamed from libs/kstd/include/kstd/bits/format/formatter/integral.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter/ordering.hpp (renamed from libs/kstd/include/kstd/bits/format/formatter/ordering.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter/pointer.hpp (renamed from libs/kstd/include/kstd/bits/format/formatter/pointer.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter/range.hpp (renamed from libs/kstd/include/kstd/bits/format/formatter/range.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/formatter/string_view.hpp (renamed from libs/kstd/include/kstd/bits/format/formatter/string_view.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/fwd.hpp (renamed from libs/kstd/include/kstd/bits/format/fwd.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/output_buffer.hpp (renamed from libs/kstd/include/kstd/bits/format/output_buffer.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/parse_context.hpp (renamed from libs/kstd/include/kstd/bits/format/parse_context.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/specifiers.hpp (renamed from libs/kstd/include/kstd/bits/format/specifiers.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/string.hpp (renamed from libs/kstd/include/kstd/bits/format/string.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/format/vformat.hpp (renamed from libs/kstd/include/kstd/bits/format/vformat.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/observer_ptr.hpp (renamed from libs/kstd/include/kstd/bits/observer_ptr.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/observer_ptr.test.cpp (renamed from libs/kstd/tests/src/observer_ptr.cpp) | 2 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/print_sink.hpp (renamed from libs/kstd/include/kstd/bits/print_sink.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/shared_ptr.hpp (renamed from libs/kstd/include/kstd/bits/shared_ptr.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/bits/unique_ptr.hpp (renamed from libs/kstd/include/kstd/bits/unique_ptr.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/cstring (renamed from libs/kstd/include/kstd/cstring) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/ext/bitfield_enum (renamed from libs/kstd/include/kstd/ext/bitfield_enum) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/flat_map (renamed from libs/kstd/include/kstd/flat_map) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/flat_map.test.cpp (renamed from libs/kstd/tests/src/flat_map.cpp) | 2 | ||||
| -rw-r--r-- | libs/kstd/kstd/format (renamed from libs/kstd/include/kstd/format) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/format.test.cpp (renamed from libs/kstd/tests/src/format.cpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/libc/stdlib.cpp (renamed from libs/kstd/src/libc/stdlib.cpp) | 36 | ||||
| -rw-r--r-- | libs/kstd/kstd/libc/string.cpp (renamed from libs/kstd/src/libc/string.cpp) | 154 | ||||
| -rw-r--r-- | libs/kstd/kstd/memory (renamed from libs/kstd/include/kstd/memory) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/mutex (renamed from libs/kstd/include/kstd/mutex) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/mutex.cpp (renamed from libs/kstd/src/mutex.cpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/os/error.cpp (renamed from libs/kstd/src/os/error.cpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/os/error.hpp (renamed from libs/kstd/include/kstd/os/error.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/os/print.hpp (renamed from libs/kstd/include/kstd/os/print.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/print (renamed from libs/kstd/include/kstd/print) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/ranges (renamed from libs/kstd/include/kstd/ranges) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/stack (renamed from libs/kstd/include/kstd/stack) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/string (renamed from libs/kstd/include/kstd/string) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/string.test.cpp (renamed from libs/kstd/tests/src/string.cpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/test_support/os_panic.hpp (renamed from libs/kstd/tests/include/kstd/tests/os_panic.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/test_support/os_panic.test.cpp (renamed from libs/kstd/tests/src/os_panic.cpp) | 2 | ||||
| -rw-r--r-- | libs/kstd/kstd/test_support/test_types.hpp (renamed from libs/kstd/tests/include/kstd/tests/test_types.hpp) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/units (renamed from libs/kstd/include/kstd/units) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/vector (renamed from libs/kstd/include/kstd/vector) | 0 | ||||
| -rw-r--r-- | libs/kstd/kstd/vector.test.cpp (renamed from libs/kstd/tests/src/vector.cpp) | 4 | ||||
| -rw-r--r-- | libs/kstd/kstd/vformat.cpp (renamed from libs/kstd/src/vformat.cpp) | 0 |
58 files changed, 120 insertions, 121 deletions
diff --git a/.clang-tidy b/.clang-tidy index 7f40ad1..dc76491 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -68,7 +68,7 @@ CheckOptions: readability-magic-numbers.IgnoreTypeAliases: true FormatStyle: file -HeaderFilterRegex: "(.*/kstd/include/.*)|(arch|kernel|kapi)/.*\\.hpp" +HeaderFilterRegex: "(.*/kstd/kstd/.*)|(arch|kernel|kapi)/.*\\.hpp" SystemHeaders: true RemovedArgs: - -fcondition-coverage diff --git a/.vscode/settings.json b/.vscode/settings.json index 4a70d18..c8f9013 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,10 +15,11 @@ "explorer.fileNesting.enabled": true, "explorer.fileNesting.expand": false, "explorer.fileNesting.patterns": { - "*.hpp": "${capture}.cpp, ${capture}.test.cpp, ${capture}.S" + "*.hpp": "${capture}.cpp, ${capture}.test.cpp, ${capture}.S", + "*": "${capture}.cpp, ${capture}.test.cpp, ${capture}.S" }, "files.associations": { - "**/kstd/include/kstd/**": "cpp", + "**/kstd/kstd/**": "cpp", }, "[cpp]": { "editor.formatOnSave": true, diff --git a/libs/kstd/CMakeLists.txt b/libs/kstd/CMakeLists.txt index 2b5ee12..6902891 100644 --- a/libs/kstd/CMakeLists.txt +++ b/libs/kstd/CMakeLists.txt @@ -37,26 +37,28 @@ add_library("kstd" STATIC) add_library("kstd::lib" ALIAS "kstd") target_sources("kstd" PRIVATE - "src/os/error.cpp" - "src/mutex.cpp" - "src/vformat.cpp" + "kstd/os/error.cpp" + "kstd/mutex.cpp" + "kstd/vformat.cpp" ) file(GLOB_RECURSE KSTD_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS - "include/kstd/*" + "kstd/*" ) +list(FILTER KSTD_HEADERS EXCLUDE REGEX ".*\.cpp") + target_sources("kstd" PUBLIC FILE_SET HEADERS - BASE_DIRS "include" + BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${KSTD_HEADERS} ) target_include_directories("kstd" PUBLIC - "include" + "${CMAKE_CURRENT_SOURCE_DIR}" ) set_target_properties("kstd" PROPERTIES @@ -65,8 +67,8 @@ set_target_properties("kstd" PROPERTIES if(NOT BUILD_TESTING) target_sources("kstd" PRIVATE - "src/libc/stdlib.cpp" - "src/libc/string.cpp" + "kstd/libc/stdlib.cpp" + "kstd/libc/string.cpp" ) set(KSTD_LIBC_SYMBOLS @@ -90,16 +92,12 @@ if(BUILD_TESTING) add_executable("kstd::tests" ALIAS "kstd_tests") target_sources("kstd_tests" PRIVATE - "tests/src/flat_map.cpp" - "tests/src/format.cpp" - "tests/src/vector.cpp" - "tests/src/observer_ptr.cpp" - "tests/src/os_panic.cpp" - "tests/src/string.cpp" - ) - - target_include_directories("kstd_tests" PRIVATE - "tests/include" + "kstd/flat_map.test.cpp" + "kstd/format.test.cpp" + "kstd/vector.test.cpp" + "kstd/bits/observer_ptr.test.cpp" + "kstd/test_support/os_panic.test.cpp" + "kstd/string.test.cpp" ) target_link_libraries("kstd_tests" PRIVATE diff --git a/libs/kstd/include/kstd/allocator b/libs/kstd/kstd/allocator index 0de0e10..0de0e10 100644 --- a/libs/kstd/include/kstd/allocator +++ b/libs/kstd/kstd/allocator diff --git a/libs/kstd/include/kstd/asm_ptr b/libs/kstd/kstd/asm_ptr index c06a8b5..c06a8b5 100644 --- a/libs/kstd/include/kstd/asm_ptr +++ b/libs/kstd/kstd/asm_ptr diff --git a/libs/kstd/include/kstd/bits/concepts.hpp b/libs/kstd/kstd/bits/concepts.hpp index 74c25cb..74c25cb 100644 --- a/libs/kstd/include/kstd/bits/concepts.hpp +++ b/libs/kstd/kstd/bits/concepts.hpp diff --git a/libs/kstd/include/kstd/bits/flat_map.hpp b/libs/kstd/kstd/bits/flat_map.hpp index fe46203..fe46203 100644 --- a/libs/kstd/include/kstd/bits/flat_map.hpp +++ b/libs/kstd/kstd/bits/flat_map.hpp diff --git a/libs/kstd/include/kstd/bits/format/arg.hpp b/libs/kstd/kstd/bits/format/arg.hpp index e65b26f..e65b26f 100644 --- a/libs/kstd/include/kstd/bits/format/arg.hpp +++ b/libs/kstd/kstd/bits/format/arg.hpp diff --git a/libs/kstd/include/kstd/bits/format/args.hpp b/libs/kstd/kstd/bits/format/args.hpp index e8e3114..e8e3114 100644 --- a/libs/kstd/include/kstd/bits/format/args.hpp +++ b/libs/kstd/kstd/bits/format/args.hpp diff --git a/libs/kstd/include/kstd/bits/format/context.hpp b/libs/kstd/kstd/bits/format/context.hpp index c166ba9..c166ba9 100644 --- a/libs/kstd/include/kstd/bits/format/context.hpp +++ b/libs/kstd/kstd/bits/format/context.hpp diff --git a/libs/kstd/include/kstd/bits/format/error.hpp b/libs/kstd/kstd/bits/format/error.hpp index c0cb53d..c0cb53d 100644 --- a/libs/kstd/include/kstd/bits/format/error.hpp +++ b/libs/kstd/kstd/bits/format/error.hpp diff --git a/libs/kstd/include/kstd/bits/format/formatter.hpp b/libs/kstd/kstd/bits/format/formatter.hpp index eb28829..eb28829 100644 --- a/libs/kstd/include/kstd/bits/format/formatter.hpp +++ b/libs/kstd/kstd/bits/format/formatter.hpp diff --git a/libs/kstd/include/kstd/bits/format/formatter/bool.hpp b/libs/kstd/kstd/bits/format/formatter/bool.hpp index cc8d190..cc8d190 100644 --- a/libs/kstd/include/kstd/bits/format/formatter/bool.hpp +++ b/libs/kstd/kstd/bits/format/formatter/bool.hpp diff --git a/libs/kstd/include/kstd/bits/format/formatter/byte.hpp b/libs/kstd/kstd/bits/format/formatter/byte.hpp index cc8aece..cc8aece 100644 --- a/libs/kstd/include/kstd/bits/format/formatter/byte.hpp +++ b/libs/kstd/kstd/bits/format/formatter/byte.hpp diff --git a/libs/kstd/include/kstd/bits/format/formatter/char.hpp b/libs/kstd/kstd/bits/format/formatter/char.hpp index 92489a1..92489a1 100644 --- a/libs/kstd/include/kstd/bits/format/formatter/char.hpp +++ b/libs/kstd/kstd/bits/format/formatter/char.hpp diff --git a/libs/kstd/include/kstd/bits/format/formatter/cstring.hpp b/libs/kstd/kstd/bits/format/formatter/cstring.hpp index 553c8ca..553c8ca 100644 --- a/libs/kstd/include/kstd/bits/format/formatter/cstring.hpp +++ b/libs/kstd/kstd/bits/format/formatter/cstring.hpp diff --git a/libs/kstd/include/kstd/bits/format/formatter/integral.hpp b/libs/kstd/kstd/bits/format/formatter/integral.hpp index d17dc95..d17dc95 100644 --- a/libs/kstd/include/kstd/bits/format/formatter/integral.hpp +++ b/libs/kstd/kstd/bits/format/formatter/integral.hpp diff --git a/libs/kstd/include/kstd/bits/format/formatter/ordering.hpp b/libs/kstd/kstd/bits/format/formatter/ordering.hpp index 7832226..7832226 100644 --- a/libs/kstd/include/kstd/bits/format/formatter/ordering.hpp +++ b/libs/kstd/kstd/bits/format/formatter/ordering.hpp diff --git a/libs/kstd/include/kstd/bits/format/formatter/pointer.hpp b/libs/kstd/kstd/bits/format/formatter/pointer.hpp index 15f9a5b..15f9a5b 100644 --- a/libs/kstd/include/kstd/bits/format/formatter/pointer.hpp +++ b/libs/kstd/kstd/bits/format/formatter/pointer.hpp diff --git a/libs/kstd/include/kstd/bits/format/formatter/range.hpp b/libs/kstd/kstd/bits/format/formatter/range.hpp index 05af06f..05af06f 100644 --- a/libs/kstd/include/kstd/bits/format/formatter/range.hpp +++ b/libs/kstd/kstd/bits/format/formatter/range.hpp diff --git a/libs/kstd/include/kstd/bits/format/formatter/string_view.hpp b/libs/kstd/kstd/bits/format/formatter/string_view.hpp index 7d74579..7d74579 100644 --- a/libs/kstd/include/kstd/bits/format/formatter/string_view.hpp +++ b/libs/kstd/kstd/bits/format/formatter/string_view.hpp diff --git a/libs/kstd/include/kstd/bits/format/fwd.hpp b/libs/kstd/kstd/bits/format/fwd.hpp index 6caedae..6caedae 100644 --- a/libs/kstd/include/kstd/bits/format/fwd.hpp +++ b/libs/kstd/kstd/bits/format/fwd.hpp diff --git a/libs/kstd/include/kstd/bits/format/output_buffer.hpp b/libs/kstd/kstd/bits/format/output_buffer.hpp index fd7a2b4..fd7a2b4 100644 --- a/libs/kstd/include/kstd/bits/format/output_buffer.hpp +++ b/libs/kstd/kstd/bits/format/output_buffer.hpp diff --git a/libs/kstd/include/kstd/bits/format/parse_context.hpp b/libs/kstd/kstd/bits/format/parse_context.hpp index cab8d72..cab8d72 100644 --- a/libs/kstd/include/kstd/bits/format/parse_context.hpp +++ b/libs/kstd/kstd/bits/format/parse_context.hpp diff --git a/libs/kstd/include/kstd/bits/format/specifiers.hpp b/libs/kstd/kstd/bits/format/specifiers.hpp index 211c95d..211c95d 100644 --- a/libs/kstd/include/kstd/bits/format/specifiers.hpp +++ b/libs/kstd/kstd/bits/format/specifiers.hpp diff --git a/libs/kstd/include/kstd/bits/format/string.hpp b/libs/kstd/kstd/bits/format/string.hpp index e7e4088..e7e4088 100644 --- a/libs/kstd/include/kstd/bits/format/string.hpp +++ b/libs/kstd/kstd/bits/format/string.hpp diff --git a/libs/kstd/include/kstd/bits/format/vformat.hpp b/libs/kstd/kstd/bits/format/vformat.hpp index 994fae5..994fae5 100644 --- a/libs/kstd/include/kstd/bits/format/vformat.hpp +++ b/libs/kstd/kstd/bits/format/vformat.hpp diff --git a/libs/kstd/include/kstd/bits/observer_ptr.hpp b/libs/kstd/kstd/bits/observer_ptr.hpp index 2593d7a..2593d7a 100644 --- a/libs/kstd/include/kstd/bits/observer_ptr.hpp +++ b/libs/kstd/kstd/bits/observer_ptr.hpp diff --git a/libs/kstd/tests/src/observer_ptr.cpp b/libs/kstd/kstd/bits/observer_ptr.test.cpp index 0c94892..1ba9c63 100644 --- a/libs/kstd/tests/src/observer_ptr.cpp +++ b/libs/kstd/kstd/bits/observer_ptr.test.cpp @@ -1,5 +1,5 @@ #include <kstd/memory> -#include <kstd/tests/os_panic.hpp> +#include <kstd/test_support/os_panic.hpp> #include <catch2/catch_test_macros.hpp> diff --git a/libs/kstd/include/kstd/bits/print_sink.hpp b/libs/kstd/kstd/bits/print_sink.hpp index af765e0..af765e0 100644 --- a/libs/kstd/include/kstd/bits/print_sink.hpp +++ b/libs/kstd/kstd/bits/print_sink.hpp diff --git a/libs/kstd/include/kstd/bits/shared_ptr.hpp b/libs/kstd/kstd/bits/shared_ptr.hpp index 8930095..8930095 100644 --- a/libs/kstd/include/kstd/bits/shared_ptr.hpp +++ b/libs/kstd/kstd/bits/shared_ptr.hpp diff --git a/libs/kstd/include/kstd/bits/unique_ptr.hpp b/libs/kstd/kstd/bits/unique_ptr.hpp index 3d803b4..3d803b4 100644 --- a/libs/kstd/include/kstd/bits/unique_ptr.hpp +++ b/libs/kstd/kstd/bits/unique_ptr.hpp diff --git a/libs/kstd/include/kstd/cstring b/libs/kstd/kstd/cstring index bd8b28d..bd8b28d 100644 --- a/libs/kstd/include/kstd/cstring +++ b/libs/kstd/kstd/cstring diff --git a/libs/kstd/include/kstd/ext/bitfield_enum b/libs/kstd/kstd/ext/bitfield_enum index 80fe9d2..80fe9d2 100644 --- a/libs/kstd/include/kstd/ext/bitfield_enum +++ b/libs/kstd/kstd/ext/bitfield_enum diff --git a/libs/kstd/include/kstd/flat_map b/libs/kstd/kstd/flat_map index f12b1b5..f12b1b5 100644 --- a/libs/kstd/include/kstd/flat_map +++ b/libs/kstd/kstd/flat_map diff --git a/libs/kstd/tests/src/flat_map.cpp b/libs/kstd/kstd/flat_map.test.cpp index 2b793d9..2e5a47c 100644 --- a/libs/kstd/tests/src/flat_map.cpp +++ b/libs/kstd/kstd/flat_map.test.cpp @@ -1,6 +1,6 @@ #include <kstd/flat_map> -#include <kstd/tests/os_panic.hpp> +#include <kstd/test_support/os_panic.hpp> #include <catch2/catch_test_macros.hpp> diff --git a/libs/kstd/include/kstd/format b/libs/kstd/kstd/format index e04b79a..e04b79a 100644 --- a/libs/kstd/include/kstd/format +++ b/libs/kstd/kstd/format diff --git a/libs/kstd/tests/src/format.cpp b/libs/kstd/kstd/format.test.cpp index 624779a..624779a 100644 --- a/libs/kstd/tests/src/format.cpp +++ b/libs/kstd/kstd/format.test.cpp diff --git a/libs/kstd/src/libc/stdlib.cpp b/libs/kstd/kstd/libc/stdlib.cpp index a18fed0..7ed051f 100644 --- a/libs/kstd/src/libc/stdlib.cpp +++ b/libs/kstd/kstd/libc/stdlib.cpp @@ -1,19 +1,19 @@ -#include <kstd/os/error.hpp>
-
-namespace kstd::libc
-{
-
- extern "C"
- {
- [[noreturn]] auto abort() -> void
- {
- kstd::os::abort();
- }
-
- [[noreturn, gnu::weak]] auto free(void *) -> void
- {
- kstd::os::panic("Tried to call free.");
- }
- }
-
+#include <kstd/os/error.hpp> + +namespace kstd::libc +{ + + extern "C" + { + [[noreturn]] auto abort() -> void + { + kstd::os::abort(); + } + + [[noreturn, gnu::weak]] auto free(void *) -> void + { + kstd::os::panic("Tried to call free."); + } + } + } // namespace kstd::libc
\ No newline at end of file diff --git a/libs/kstd/src/libc/string.cpp b/libs/kstd/kstd/libc/string.cpp index c9fada1..b7cdb82 100644 --- a/libs/kstd/src/libc/string.cpp +++ b/libs/kstd/kstd/libc/string.cpp @@ -1,78 +1,78 @@ -#include <kstd/cstring>
-
-#include <algorithm>
-#include <bit>
-#include <cstddef>
-#include <iterator>
-#include <span>
-
-namespace kstd::libc
-{
-
- auto memcpy(void * dest, void const * src, std::size_t size) noexcept -> void *
- {
- auto dest_span = std::span{static_cast<std::byte *>(dest), size};
- auto src_span = std::span{static_cast<std::byte const *>(src), size};
-
- for (std::size_t i = 0; i < size; ++i)
- {
- dest_span[i] = src_span[i];
- }
-
- return dest;
- }
-
- auto memset(void * dest, int value, std::size_t size) noexcept -> void *
- {
- auto const byte_value = static_cast<std::byte>(static_cast<unsigned char>(value));
- auto dest_span = std::span{static_cast<std::byte *>(dest), size};
-
- for (std::size_t i = 0; i < size; ++i)
- {
- dest_span[i] = byte_value;
- }
-
- return dest;
- }
-
- auto memcmp(void const * lhs, void const * rhs, std::size_t size) noexcept -> int
- {
- auto left_span = std::span{static_cast<std::byte const *>(lhs), size};
- auto right_span = std::span{static_cast<std::byte const *>(rhs), size};
- auto mismatched = std::ranges::mismatch(left_span, right_span);
-
- if (mismatched.in1 == left_span.end())
- {
- return 0;
- }
-
- return std::bit_cast<char>(*mismatched.in1) - std::bit_cast<char>(*mismatched.in2);
- }
-
- auto memmove(void * dest, void const * src, std::size_t size) noexcept -> void *
- {
- auto dest_span = std::span{static_cast<std::byte *>(dest), size};
- auto src_span = std::span{static_cast<std::byte const *>(src), size};
- if (dest < src)
- {
- for (std::size_t i = 0; i < size; ++i)
- {
- dest_span[i] = src_span[i];
- }
- }
- else
- {
- for (std::size_t i = size; i > 0; --i)
- {
- dest_span[i - 1] = src_span[i - 1];
- }
- }
- return dest;
- }
-
- auto strlen(char const * string) noexcept -> std::size_t
- {
- return std::distance(string, std::ranges::find(string, nullptr, '\0'));
- }
-
+#include <kstd/cstring> + +#include <algorithm> +#include <bit> +#include <cstddef> +#include <iterator> +#include <span> + +namespace kstd::libc +{ + + auto memcpy(void * dest, void const * src, std::size_t size) noexcept -> void * + { + auto dest_span = std::span{static_cast<std::byte *>(dest), size}; + auto src_span = std::span{static_cast<std::byte const *>(src), size}; + + for (std::size_t i = 0; i < size; ++i) + { + dest_span[i] = src_span[i]; + } + + return dest; + } + + auto memset(void * dest, int value, std::size_t size) noexcept -> void * + { + auto const byte_value = static_cast<std::byte>(static_cast<unsigned char>(value)); + auto dest_span = std::span{static_cast<std::byte *>(dest), size}; + + for (std::size_t i = 0; i < size; ++i) + { + dest_span[i] = byte_value; + } + + return dest; + } + + auto memcmp(void const * lhs, void const * rhs, std::size_t size) noexcept -> int + { + auto left_span = std::span{static_cast<std::byte const *>(lhs), size}; + auto right_span = std::span{static_cast<std::byte const *>(rhs), size}; + auto mismatched = std::ranges::mismatch(left_span, right_span); + + if (mismatched.in1 == left_span.end()) + { + return 0; + } + + return std::bit_cast<char>(*mismatched.in1) - std::bit_cast<char>(*mismatched.in2); + } + + auto memmove(void * dest, void const * src, std::size_t size) noexcept -> void * + { + auto dest_span = std::span{static_cast<std::byte *>(dest), size}; + auto src_span = std::span{static_cast<std::byte const *>(src), size}; + if (dest < src) + { + for (std::size_t i = 0; i < size; ++i) + { + dest_span[i] = src_span[i]; + } + } + else + { + for (std::size_t i = size; i > 0; --i) + { + dest_span[i - 1] = src_span[i - 1]; + } + } + return dest; + } + + auto strlen(char const * string) noexcept -> std::size_t + { + return std::distance(string, std::ranges::find(string, nullptr, '\0')); + } + } // namespace kstd::libc
\ No newline at end of file diff --git a/libs/kstd/include/kstd/memory b/libs/kstd/kstd/memory index f108c6d..f108c6d 100644 --- a/libs/kstd/include/kstd/memory +++ b/libs/kstd/kstd/memory diff --git a/libs/kstd/include/kstd/mutex b/libs/kstd/kstd/mutex index b2a31aa..b2a31aa 100644 --- a/libs/kstd/include/kstd/mutex +++ b/libs/kstd/kstd/mutex diff --git a/libs/kstd/src/mutex.cpp b/libs/kstd/kstd/mutex.cpp index 7387657..7387657 100644 --- a/libs/kstd/src/mutex.cpp +++ b/libs/kstd/kstd/mutex.cpp diff --git a/libs/kstd/src/os/error.cpp b/libs/kstd/kstd/os/error.cpp index f969cb5..f969cb5 100644 --- a/libs/kstd/src/os/error.cpp +++ b/libs/kstd/kstd/os/error.cpp diff --git a/libs/kstd/include/kstd/os/error.hpp b/libs/kstd/kstd/os/error.hpp index 9d43fb1..9d43fb1 100644 --- a/libs/kstd/include/kstd/os/error.hpp +++ b/libs/kstd/kstd/os/error.hpp diff --git a/libs/kstd/include/kstd/os/print.hpp b/libs/kstd/kstd/os/print.hpp index 36cb43d..36cb43d 100644 --- a/libs/kstd/include/kstd/os/print.hpp +++ b/libs/kstd/kstd/os/print.hpp diff --git a/libs/kstd/include/kstd/print b/libs/kstd/kstd/print index 1033f72..1033f72 100644 --- a/libs/kstd/include/kstd/print +++ b/libs/kstd/kstd/print diff --git a/libs/kstd/include/kstd/ranges b/libs/kstd/kstd/ranges index 78c3adb..78c3adb 100644 --- a/libs/kstd/include/kstd/ranges +++ b/libs/kstd/kstd/ranges diff --git a/libs/kstd/include/kstd/stack b/libs/kstd/kstd/stack index 02e44ea..02e44ea 100644 --- a/libs/kstd/include/kstd/stack +++ b/libs/kstd/kstd/stack diff --git a/libs/kstd/include/kstd/string b/libs/kstd/kstd/string index e228a04..e228a04 100644 --- a/libs/kstd/include/kstd/string +++ b/libs/kstd/kstd/string diff --git a/libs/kstd/tests/src/string.cpp b/libs/kstd/kstd/string.test.cpp index 53d7c9a..53d7c9a 100644 --- a/libs/kstd/tests/src/string.cpp +++ b/libs/kstd/kstd/string.test.cpp diff --git a/libs/kstd/tests/include/kstd/tests/os_panic.hpp b/libs/kstd/kstd/test_support/os_panic.hpp index 4396a9f..4396a9f 100644 --- a/libs/kstd/tests/include/kstd/tests/os_panic.hpp +++ b/libs/kstd/kstd/test_support/os_panic.hpp diff --git a/libs/kstd/tests/src/os_panic.cpp b/libs/kstd/kstd/test_support/os_panic.test.cpp index 0759763..c30411a 100644 --- a/libs/kstd/tests/src/os_panic.cpp +++ b/libs/kstd/kstd/test_support/os_panic.test.cpp @@ -1,4 +1,4 @@ -#include <kstd/tests/os_panic.hpp> +#include <kstd/test_support/os_panic.hpp> #include <source_location> #include <string> diff --git a/libs/kstd/tests/include/kstd/tests/test_types.hpp b/libs/kstd/kstd/test_support/test_types.hpp index 8231fd3..8231fd3 100644 --- a/libs/kstd/tests/include/kstd/tests/test_types.hpp +++ b/libs/kstd/kstd/test_support/test_types.hpp diff --git a/libs/kstd/include/kstd/units b/libs/kstd/kstd/units index df5eb37..df5eb37 100644 --- a/libs/kstd/include/kstd/units +++ b/libs/kstd/kstd/units diff --git a/libs/kstd/include/kstd/vector b/libs/kstd/kstd/vector index c714957..c714957 100644 --- a/libs/kstd/include/kstd/vector +++ b/libs/kstd/kstd/vector diff --git a/libs/kstd/tests/src/vector.cpp b/libs/kstd/kstd/vector.test.cpp index 4fb3559..8bf8f79 100644 --- a/libs/kstd/tests/src/vector.cpp +++ b/libs/kstd/kstd/vector.test.cpp @@ -1,8 +1,8 @@ #include <kstd/vector> #include <kstd/ranges> -#include <kstd/tests/os_panic.hpp> -#include <kstd/tests/test_types.hpp> +#include <kstd/test_support/os_panic.hpp> +#include <kstd/test_support/test_types.hpp> #include <catch2/catch_test_macros.hpp> diff --git a/libs/kstd/src/vformat.cpp b/libs/kstd/kstd/vformat.cpp index b7c5121..b7c5121 100644 --- a/libs/kstd/src/vformat.cpp +++ b/libs/kstd/kstd/vformat.cpp |
