Reorganize everything

This commit is contained in:
2025-02-17 00:21:48 +01:00
parent cb77cbe9ce
commit a141c401f7
77 changed files with 593 additions and 258 deletions

2
MODULE.bazel.lock generated
View File

@ -1,5 +1,5 @@
{ {
"lockFileVersion": 16, "lockFileVersion": 18,
"registryFileHashes": { "registryFileHashes": {
"https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497",
"https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2",

View File

@ -1,78 +0,0 @@
cc_library(
name = "asl",
hdrs = [
"allocator.hpp",
"annotations.hpp",
"assert.hpp",
"atomic.hpp",
"box.hpp",
"buffer.hpp",
"config.hpp",
"float.hpp",
"format.hpp",
"functional.hpp",
"hash.hpp",
"hash_map.hpp",
"hash_set.hpp",
"integers.hpp",
"io.hpp",
"layout.hpp",
"maybe_uninit.hpp",
"memory.hpp",
"meta.hpp",
"option.hpp",
"print.hpp",
"span.hpp",
"status.hpp",
"status_or.hpp",
"string.hpp",
"string_builder.hpp",
"string_view.hpp",
"utility.hpp",
],
srcs = [
"allocator.cpp",
"assert.cpp",
"format.cpp",
"format_float.cpp",
"hash_cityhash.cpp",
"print.cpp",
"status.cpp",
],
deps = [
"//vendor/dragonbox",
],
visibility = ["//visibility:public"],
)
[cc_test(
name = "%s_tests" % name,
srcs = [
"tests/%s_tests.cpp" % name,
"tests/test_types.hpp",
],
deps = [
":asl",
"//asl/testing",
],
) for name in [
"box",
"buffer",
"float",
"format",
"functional",
"hash",
"hash_map",
"hash_set",
"integers",
"maybe_uninit",
"meta",
"option",
"span",
"status",
"status_or",
"string",
"string_builder",
"string_view",
"utility",
]]

View File

@ -1,11 +0,0 @@
#include "asl/assert.hpp"
#include "asl/print.hpp"
void asl::report_assert_failure(const char* msg, const source_location& sl)
{
eprint("------------------------------------------------------------\n");
eprint("Assertion failure at {}, line {}:\n", sl.file, sl.line);
eprint("{}\n", msg);
eprint("------------------------------------------------------------\n");
}

36
asl/base/BUILD.bazel Normal file
View File

@ -0,0 +1,36 @@
cc_library(
name = "base",
hdrs = [
"annotations.hpp",
"assert.hpp",
"config.hpp",
"float.hpp",
"functional.hpp",
"integers.hpp",
"meta.hpp",
"utility.hpp",
],
srcs = [
"assert.cpp",
],
visibility = ["//visibility:public"],
)
[cc_test(
name = "%s_tests" % name,
srcs = [
"%s_tests.cpp" % name,
],
deps = [
":base",
"//asl/tests:utils",
"//asl/testing",
"//asl/types:box",
],
) for name in [
"float",
"functional",
"integers",
"meta",
"utility",
]]

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "asl/config.hpp" #include "asl/base/config.hpp"
#if ASL_COMPILER_CLANG_CL #if ASL_COMPILER_CLANG_CL
#define ASL_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] #define ASL_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]

12
asl/base/assert.cpp Normal file
View File

@ -0,0 +1,12 @@
#include "asl/base/assert.hpp"
// #include "asl/io/print.hpp"
void asl::report_assert_failure(const char* msg, const source_location& sl)
{
// @Todo(org)
// eprint("------------------------------------------------------------\n");
// eprint("Assertion failure at {}, line {}:\n", sl.file, sl.line);
// eprint("{}\n", msg);
// eprint("------------------------------------------------------------\n");
}

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "asl/config.hpp" #include "asl/base/config.hpp"
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
namespace asl namespace asl
{ {

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
namespace asl namespace asl
{ {

View File

@ -1,4 +1,4 @@
#include "asl/float.hpp" #include "asl/base/float.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
#include "asl/utility.hpp" #include "asl/base/utility.hpp"
namespace asl { namespace asl {

View File

@ -1,4 +1,4 @@
#include "asl/functional.hpp" #include "asl/base/functional.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
struct HasFunction struct HasFunction

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "asl/config.hpp" #include "asl/base/config.hpp"
using int8_t = signed char; using int8_t = signed char;
using int16_t = signed short; using int16_t = signed short;

View File

@ -1,4 +1,4 @@
#include "asl/integers.hpp" #include "asl/base/integers.hpp"
static_assert(sizeof(int8_t) == 1); static_assert(sizeof(int8_t) == 1);
static_assert(sizeof(int16_t) == 2); static_assert(sizeof(int16_t) == 2);

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "asl/integers.hpp" #include "asl/base/integers.hpp"
namespace asl { namespace asl {

View File

@ -1,7 +1,7 @@
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
#include "asl/tests/test_types.hpp" #include "asl/tests/types.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/box.hpp" #include "asl/types/box.hpp"
struct Struct {}; struct Struct {};
union Union {}; union Union {};

View File

@ -1,8 +1,7 @@
#pragma once #pragma once
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
#include "asl/layout.hpp" #include "asl/base/assert.hpp"
#include "asl/assert.hpp"
#define ASL_MOVE(...) (static_cast<::asl::un_ref_t<decltype(__VA_ARGS__)>&&>(__VA_ARGS__)) #define ASL_MOVE(...) (static_cast<::asl::un_ref_t<decltype(__VA_ARGS__)>&&>(__VA_ARGS__))
@ -31,7 +30,7 @@ T exchange(T& obj, U&& new_value)
} }
template<trivially_copy_constructible U, trivially_copy_constructible T> template<trivially_copy_constructible U, trivially_copy_constructible T>
constexpr U bit_cast(T value) requires (size_of<T> == size_of<U>) constexpr U bit_cast(T value) requires (sizeof(T) == sizeof(U))
{ {
return __builtin_bit_cast(U, value); return __builtin_bit_cast(U, value);
} }

View File

@ -0,0 +1 @@
#include "asl/base/utility.hpp"

View File

@ -0,0 +1,58 @@
cc_library(
name = "buffer",
hdrs = [
"buffer.hpp",
],
deps = [
"//asl/memory",
"//asl/base",
"//asl/types:span",
"//asl/hashing",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "hash_set",
hdrs = [
"hash_set.hpp",
],
deps = [
"//asl/base",
"//asl/memory",
"//asl/types:maybe_uninit",
"//asl/hashing",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "hash_map",
hdrs = [
"hash_map.hpp",
],
deps = [
"//asl/base",
"//asl/memory",
"//asl/hashing",
":hash_set",
],
visibility = ["//visibility:public"],
)
[cc_test(
name = "%s_tests" % name,
srcs = [
"%s_tests.cpp" % name,
],
deps = [
":%s" % name,
"//asl/tests:utils",
"//asl/testing",
"//asl/strings:string",
],
) for name in [
"buffer",
"hash_map",
"hash_set",
]]

View File

@ -1,12 +1,12 @@
#pragma once #pragma once
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
#include "asl/allocator.hpp" #include "asl/memory/allocator.hpp"
#include "asl/annotations.hpp" #include "asl/memory/memory.hpp"
#include "asl/memory.hpp" #include "asl/base/annotations.hpp"
#include "asl/assert.hpp" #include "asl/base/assert.hpp"
#include "asl/span.hpp" #include "asl/types/span.hpp"
#include "asl/hash.hpp" #include "asl/hashing/hash.hpp"
namespace asl namespace asl
{ {

View File

@ -1,7 +1,7 @@
#include "asl/buffer.hpp" #include "asl/containers/buffer.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/tests/test_types.hpp" #include "asl/tests/types.hpp"
struct Big struct Big
{ {

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include "asl/meta.hpp" #include "asl/base/utility.hpp"
#include "asl/utility.hpp" #include "asl/base/meta.hpp"
#include "asl/hash.hpp" #include "asl/hashing/hash.hpp"
#include "asl/allocator.hpp" #include "asl/memory/allocator.hpp"
#include "asl/hash_set.hpp" #include "asl/containers/hash_set.hpp"
namespace asl namespace asl
{ {

View File

@ -1,5 +1,5 @@
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/hash_map.hpp" #include "asl/containers/hash_map.hpp"
ASL_TEST(default) ASL_TEST(default)
{ {

View File

@ -1,12 +1,12 @@
#pragma once #pragma once
#include "asl/annotations.hpp" #include "asl/base/annotations.hpp"
#include "asl/meta.hpp" #include "asl/base/utility.hpp"
#include "asl/utility.hpp" #include "asl/base/meta.hpp"
#include "asl/maybe_uninit.hpp" #include "asl/memory/allocator.hpp"
#include "asl/hash.hpp" #include "asl/memory/memory.hpp"
#include "asl/allocator.hpp" #include "asl/types/maybe_uninit.hpp"
#include "asl/memory.hpp" #include "asl/hashing/hash.hpp"
namespace asl namespace asl
{ {

View File

@ -1,8 +1,8 @@
#include "asl/hash_set.hpp" #include "asl/containers/hash_set.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/tests/test_types.hpp" #include "asl/tests/types.hpp"
#include "asl/string.hpp" #include "asl/strings/string.hpp"
#include "asl/string_view.hpp" #include "asl/strings/string_view.hpp"
ASL_TEST(empty) ASL_TEST(empty)
{ {

View File

@ -0,0 +1,32 @@
cc_library(
name = "formatting",
hdrs = [
"format.hpp",
],
srcs = [
"format.cpp",
"format_float.cpp",
],
deps = [
"//asl/base",
"//asl/memory",
"//asl/strings:string_view",
"//asl/types:span",
"//asl/io:writer",
"//vendor/dragonbox",
],
visibility = ["//visibility:public"],
)
cc_test(
name = "tests",
srcs = [
"format_tests.cpp",
],
deps = [
":formatting",
"//asl/tests:utils",
"//asl/testing",
"//asl/strings:string_builder",
],
)

View File

@ -1,7 +1,7 @@
#include "asl/format.hpp" #include "asl/formatting/format.hpp"
#include "asl/utility.hpp" #include "asl/base/utility.hpp"
#include "asl/assert.hpp" #include "asl/base/assert.hpp"
#include "asl/memory.hpp" #include "asl/memory/memory.hpp"
void asl::format_internals::format( void asl::format_internals::format(
Writer* writer, Writer* writer,

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include "asl/integers.hpp" #include "asl/base/integers.hpp"
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
#include "asl/io.hpp" #include "asl/io/writer.hpp"
#include "asl/span.hpp" #include "asl/types/span.hpp"
#include "asl/string_view.hpp" #include "asl/strings/string_view.hpp"
namespace asl namespace asl
{ {

View File

@ -1,5 +1,5 @@
#include "asl/format.hpp" #include "asl/formatting/format.hpp"
#include "asl/float.hpp" #include "asl/base/float.hpp"
#define JKJ_STD_REPLACEMENT_NAMESPACE_DEFINED 0 #define JKJ_STD_REPLACEMENT_NAMESPACE_DEFINED 0
#define JKJ_STATIC_DATA_SECTION_DEFINED 0 #define JKJ_STATIC_DATA_SECTION_DEFINED 0

View File

@ -1,7 +1,7 @@
#include "asl/format.hpp" #include "asl/formatting/format.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/float.hpp" #include "asl/base/float.hpp"
#include "asl/string_builder.hpp" #include "asl/strings/string_builder.hpp"
static_assert(asl::formattable<decltype("Hello")>); static_assert(asl::formattable<decltype("Hello")>);

33
asl/hashing/BUILD.bazel Normal file
View File

@ -0,0 +1,33 @@
cc_library(
name = "hashing",
hdrs = [
"hash.hpp",
],
srcs = [
"hash_cityhash.cpp",
],
deps = [
"//asl/base",
"//asl/types:span",
],
visibility = ["//visibility:public"],
)
cc_test(
name = "tests",
srcs = [
"hash_tests.cpp",
],
deps = [
"//asl/base",
"//asl/tests:utils",
"//asl/testing",
":hashing",
"//asl/strings:string_view",
"//asl/strings:string",
"//asl/containers:buffer",
"//asl/types:box",
"//asl/types:option",
"//asl/types:status",
],
)

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "asl/integers.hpp" #include "asl/base/integers.hpp"
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
#include "asl/span.hpp" #include "asl/types/span.hpp"
#include "asl/utility.hpp" #include "asl/base/utility.hpp"
namespace asl::city_hash namespace asl::city_hash
{ {

View File

@ -27,8 +27,8 @@
// possible hash functions, by using SIMD instructions, or by // possible hash functions, by using SIMD instructions, or by
// compromising on hash quality. // compromising on hash quality.
#include "asl/hash.hpp" #include "asl/hashing/hash.hpp"
#include "asl/memory.hpp" #include "asl/memory/memory.hpp"
using uint8 = uint8_t; using uint8 = uint8_t;
using uint32 = uint32_t; using uint32 = uint32_t;

View File

@ -1,12 +1,12 @@
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/hash.hpp" #include "asl/hashing/hash.hpp"
#include "asl/string_view.hpp" #include "asl/strings/string_view.hpp"
#include "asl/string.hpp" #include "asl/strings/string.hpp"
#include "asl/buffer.hpp" #include "asl/containers/buffer.hpp"
#include "asl/box.hpp" #include "asl/types/box.hpp"
#include "asl/option.hpp" #include "asl/types/option.hpp"
#include "asl/status.hpp" #include "asl/types/status.hpp"
#include "asl/status_or.hpp" #include "asl/types/status_or.hpp"
static_assert(!asl::hashable<int*>); static_assert(!asl::hashable<int*>);
static_assert(!asl::hashable<int[]>); static_assert(!asl::hashable<int[]>);

26
asl/io/BUILD.bazel Normal file
View File

@ -0,0 +1,26 @@
cc_library(
name = "writer",
hdrs = [
"writer.hpp",
],
deps = [
"//asl/base",
"//asl/types:span",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "print",
hdrs = [
"print.hpp",
],
srcs = [
"print.cpp",
],
deps = [
"//asl/formatting",
":writer",
],
visibility = ["//visibility:public"],
)

View File

@ -1,4 +1,4 @@
#include "asl/print.hpp" #include "asl/io/print.hpp"
#include <cstdio> #include <cstdio>

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "asl/format.hpp" #include "asl/formatting/format.hpp"
#include "asl/io/writer.hpp"
namespace asl namespace asl
{ {

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "asl/integers.hpp" #include "asl/base/integers.hpp"
#include "asl/utility.hpp" #include "asl/base/utility.hpp"
#include "asl/span.hpp" #include "asl/types/span.hpp"
namespace asl namespace asl
{ {

View File

@ -7,7 +7,11 @@ cc_library(
"logging.hpp", "logging.hpp",
], ],
deps = [ deps = [
"//asl", "//asl/base",
"//asl/types:box",
"//asl/formatting",
"//asl/io:print",
"//asl/strings:string_builder",
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )

View File

@ -1,6 +1,6 @@
#include "asl/logging/logging.hpp" #include "asl/logging/logging.hpp"
#include "asl/print.hpp" #include "asl/io/print.hpp"
#include "asl/string_builder.hpp" #include "asl/strings/string_builder.hpp"
// @Todo Don't use internal get_stdout_writer, make console module // @Todo Don't use internal get_stdout_writer, make console module

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "asl/format.hpp" #include "asl/base/utility.hpp"
#include "asl/utility.hpp" #include "asl/types/box.hpp"
#include "asl/box.hpp" #include "asl/formatting/format.hpp"
namespace asl::log namespace asl::log
{ {

View File

@ -1,6 +1,6 @@
#include "asl/logging/logging.hpp" #include "asl/logging/logging.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/string_builder.hpp" #include "asl/strings/string_builder.hpp"
ASL_TEST(log) ASL_TEST(log)
{ {

16
asl/memory/BUILD.bazel Normal file
View File

@ -0,0 +1,16 @@
cc_library(
name = "memory",
hdrs = [
"allocator.hpp",
"layout.hpp",
"memory.hpp",
],
srcs = [
"allocator.cpp",
],
deps = [
"//asl/base",
],
visibility = ["//visibility:public"],
)

View File

@ -1,8 +1,6 @@
#include "asl/allocator.hpp" #include "asl/memory/allocator.hpp"
#include "asl/assert.hpp" #include "asl/base/assert.hpp"
#include "asl/utility.hpp" #include "asl/memory/layout.hpp"
#include "asl/memory.hpp"
#include "asl/print.hpp"
#include <cstdlib> #include <cstdlib>

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "asl/layout.hpp" #include "asl/base/meta.hpp"
#include "asl/meta.hpp" #include "asl/memory/layout.hpp"
#include "asl/memory.hpp" #include "asl/memory/memory.hpp"
namespace asl namespace asl
{ {

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "asl/integers.hpp" #include "asl/base/integers.hpp"
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
namespace asl namespace asl
{ {

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "asl/integers.hpp" #include "asl/base/integers.hpp"
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
#include "asl/layout.hpp" #include "asl/base/utility.hpp"
#include "asl/utility.hpp" #include "asl/memory/layout.hpp"
constexpr void* operator new(size_t, void* ptr) constexpr void* operator new(size_t, void* ptr)
{ {

56
asl/strings/BUILD.bazel Normal file
View File

@ -0,0 +1,56 @@
cc_library(
name = "string_view",
hdrs = [
"string_view.hpp",
],
deps = [
"//asl/base",
"//asl/memory",
"//asl/types:span",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "string",
hdrs = [
"string.hpp",
],
deps = [
"//asl/containers:buffer",
":string_view",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "string_builder",
hdrs = [
"string_builder.hpp",
],
deps = [
"//asl/containers:buffer",
"//asl/formatting",
":string",
"//asl/io:writer",
],
visibility = ["//visibility:public"],
)
[cc_test(
name = "%s_tests" % name,
srcs = [
"%s_tests.cpp" % name,
],
deps = [
":string",
":string_builder",
":string_view",
"//asl/tests:utils",
"//asl/testing",
],
) for name in [
"string",
"string_view",
"string_builder",
]]

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "asl/buffer.hpp" #include "asl/containers/buffer.hpp"
#include "asl/string_view.hpp" #include "asl/strings/string_view.hpp"
namespace asl namespace asl
{ {

View File

@ -1,10 +1,10 @@
#pragma once #pragma once
#include "asl/buffer.hpp" #include "asl/containers/buffer.hpp"
#include "asl/string.hpp" #include "asl/strings/string.hpp"
#include "asl/string_view.hpp" #include "asl/strings/string_view.hpp"
#include "asl/format.hpp" #include "asl/formatting/format.hpp"
#include "asl/io.hpp" #include "asl/io/writer.hpp"
namespace asl namespace asl
{ {

View File

@ -1,4 +1,4 @@
#include "asl/string_builder.hpp" #include "asl/strings/string_builder.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
ASL_TEST(string_builder) ASL_TEST(string_builder)

View File

@ -1,6 +1,6 @@
#include "asl/string.hpp" #include "asl/strings/string.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/format.hpp" #include "asl/formatting/format.hpp"
ASL_TEST(default) ASL_TEST(default)
{ {

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "asl/integers.hpp" #include "asl/base/integers.hpp"
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
#include "asl/span.hpp" #include "asl/types/span.hpp"
#include "asl/memory.hpp" #include "asl/memory/memory.hpp"
namespace asl namespace asl
{ {

View File

@ -1,4 +1,4 @@
#include "asl/string_view.hpp" #include "asl/strings/string_view.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
static_assert(asl::trivially_destructible<asl::string_view>); static_assert(asl::trivially_destructible<asl::string_view>);

View File

@ -0,0 +1,10 @@
cc_library(
name = "atomic",
hdrs = [
"atomic.hpp",
],
deps = [
"//asl/base",
],
visibility = ["//visibility:public"],
)

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
namespace asl namespace asl
{ {

View File

@ -7,7 +7,9 @@ cc_library(
"testing.cpp", "testing.cpp",
], ],
deps = [ deps = [
"//asl", "//asl/base",
"//asl/formatting",
"//asl/io:print",
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )

View File

@ -1,6 +1,6 @@
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/print.hpp" #include "asl/io/print.hpp"
static asl::testing::Test* g_head = nullptr; static asl::testing::Test* g_head = nullptr;
static asl::testing::Test* g_tail = nullptr; static asl::testing::Test* g_tail = nullptr;

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "asl/utility.hpp" #include "asl/base/utility.hpp"
namespace asl::testing namespace asl::testing
{ {

10
asl/tests/BUILD.bazel Normal file
View File

@ -0,0 +1,10 @@
cc_library(
name = "utils",
hdrs = [
"types.hpp",
],
deps = [
"//asl/base",
],
visibility = ["//asl:__subpackages__"],
)

View File

@ -1,9 +1,6 @@
#pragma once #pragma once
#include "asl/utility.hpp" #include "asl/base/utility.hpp"
#include "asl/io.hpp"
#include "asl/allocator.hpp"
#include "asl/string_view.hpp"
struct TrivialType struct TrivialType
{ {

View File

@ -1 +0,0 @@
#include "asl/utility.hpp"

135
asl/types/BUILD.bazel Normal file
View File

@ -0,0 +1,135 @@
cc_library(
name = "box",
hdrs = [
"box.hpp",
],
deps = [
"//asl/base",
"//asl/memory",
"//asl/hashing",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "span",
hdrs = [
"span.hpp",
],
deps = [
"//asl/base",
"//asl/memory",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "maybe_uninit",
hdrs = [
"maybe_uninit.hpp",
],
deps = [
"//asl/base",
"//asl/memory",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "option",
hdrs = [
"option.hpp",
],
deps = [
"//asl/base",
"//asl/types:maybe_uninit",
"//asl/hashing",
],
visibility = ["//visibility:public"],
)
cc_library(
name = "status",
hdrs = [
"status.hpp",
"status_or.hpp",
],
srcs = [
"status.cpp",
],
deps = [
"//asl/base",
"//asl/strings:string",
"//asl/strings:string_builder",
"//asl/formatting",
"//asl/memory",
"//asl/synchronization:atomic",
"//asl/types:maybe_uninit",
"//asl/hashing",
],
visibility = ["//visibility:public"],
)
cc_test(
name = "box_tests",
srcs = ["box_tests.cpp"],
deps = [
"//asl/tests:utils",
"//asl/testing",
"//asl/types:box",
"//asl/types:option",
"//asl/types:maybe_uninit",
"//asl/hashing",
],
)
cc_test(
name = "maybe_uninit_tests",
srcs = ["maybe_uninit_tests.cpp"],
deps = [
"//asl/tests:utils",
"//asl/testing",
"//asl/types:maybe_uninit",
],
)
cc_test(
name = "span_tests",
srcs = ["span_tests.cpp"],
deps = [
"//asl/tests:utils",
"//asl/testing",
"//asl/types:span",
],
)
cc_test(
name = "option_tests",
srcs = ["option_tests.cpp"],
deps = [
"//asl/tests:utils",
"//asl/testing",
"//asl/types:option",
],
)
cc_test(
name = "status_tests",
srcs = ["status_tests.cpp"],
deps = [
"//asl/tests:utils",
"//asl/testing",
"//asl/types:status",
],
)
cc_test(
name = "status_or_tests",
srcs = ["status_or_tests.cpp"],
deps = [
"//asl/tests:utils",
"//asl/testing",
"//asl/types:status",
],
)

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "asl/allocator.hpp" #include "asl/base/assert.hpp"
#include "asl/assert.hpp" #include "asl/base/annotations.hpp"
#include "asl/annotations.hpp" #include "asl/base/utility.hpp"
#include "asl/memory.hpp" #include "asl/memory/memory.hpp"
#include "asl/utility.hpp" #include "asl/memory/allocator.hpp"
#include "asl/hash.hpp" #include "asl/hashing/hash.hpp"
namespace asl namespace asl
{ {

View File

@ -1,8 +1,8 @@
#include "asl/box.hpp" #include "asl/types/box.hpp"
#include "asl/option.hpp" #include "asl/types/option.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/tests/test_types.hpp" #include "asl/tests/types.hpp"
static_assert(sizeof(asl::box<int>) == sizeof(int*)); static_assert(sizeof(asl::box<int>) == sizeof(int*));
static_assert(!asl::copyable<asl::box<int>>); static_assert(!asl::copyable<asl::box<int>>);

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
#include "asl/utility.hpp" #include "asl/base/utility.hpp"
#include "asl/memory.hpp" #include "asl/memory/memory.hpp"
namespace asl namespace asl
{ {

View File

@ -1,5 +1,5 @@
#include "asl/maybe_uninit.hpp" #include "asl/types/maybe_uninit.hpp"
#include "asl/tests/test_types.hpp" #include "asl/tests/types.hpp"
static_assert(asl::layout::of<int>() == asl::layout::of<asl::maybe_uninit<int>>()); static_assert(asl::layout::of<int>() == asl::layout::of<asl::maybe_uninit<int>>());
static_assert(asl::size_of<int> == asl::size_of<asl::maybe_uninit<int>>); static_assert(asl::size_of<int> == asl::size_of<asl::maybe_uninit<int>>);

View File

@ -1,11 +1,11 @@
#pragma once #pragma once
#include "asl/assert.hpp" #include "asl/base/assert.hpp"
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
#include "asl/maybe_uninit.hpp" #include "asl/base/functional.hpp"
#include "asl/functional.hpp" #include "asl/base/annotations.hpp"
#include "asl/annotations.hpp" #include "asl/types/maybe_uninit.hpp"
#include "asl/hash.hpp" #include "asl/hashing/hash.hpp"
namespace asl namespace asl
{ {

View File

@ -1,5 +1,5 @@
#include "asl/option.hpp" #include "asl/types/option.hpp"
#include "asl/tests/test_types.hpp" #include "asl/tests/types.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
class Base {}; class Base {};

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "asl/meta.hpp" #include "asl/base/meta.hpp"
#include "asl/annotations.hpp" #include "asl/base/assert.hpp"
#include "asl/layout.hpp" #include "asl/base/annotations.hpp"
#include "asl/assert.hpp" #include "asl/memory/layout.hpp"
namespace asl namespace asl
{ {

View File

@ -1,6 +1,6 @@
#include "asl/span.hpp" #include "asl/types/span.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/tests/test_types.hpp" #include "asl/tests/types.hpp"
static_assert(asl::trivially_destructible<asl::span<int>>); static_assert(asl::trivially_destructible<asl::span<int>>);
static_assert(asl::trivially_destructible<asl::span<WithDestructor>>); static_assert(asl::trivially_destructible<asl::span<WithDestructor>>);

View File

@ -1,9 +1,9 @@
#include "asl/status.hpp" #include "asl/types/status.hpp"
#include "asl/allocator.hpp" #include "asl/memory/allocator.hpp"
#include "asl/string.hpp" #include "asl/strings/string.hpp"
#include "asl/atomic.hpp" #include "asl/synchronization/atomic.hpp"
#include "asl/format.hpp" #include "asl/formatting/format.hpp"
#include "asl/string_builder.hpp" #include "asl/strings/string_builder.hpp"
// @Todo Use custom allocator // @Todo Use custom allocator
using Allocator = asl::DefaultAllocator; using Allocator = asl::DefaultAllocator;

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "asl/integers.hpp" #include "asl/base/integers.hpp"
#include "asl/string_view.hpp" #include "asl/strings/string_view.hpp"
#include "asl/format.hpp" #include "asl/formatting/format.hpp"
namespace asl namespace asl
{ {

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "asl/status.hpp" #include "asl/types/status.hpp"
#include "asl/maybe_uninit.hpp" #include "asl/types/maybe_uninit.hpp"
#include "asl/hash.hpp" #include "asl/hashing/hash.hpp"
namespace asl namespace asl
{ {

View File

@ -1,6 +1,6 @@
#include "asl/status_or.hpp" #include "asl/types/status_or.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/tests/test_types.hpp" #include "asl/tests/types.hpp"
static_assert(asl::copyable<asl::status_or<TrivialType>>); static_assert(asl::copyable<asl::status_or<TrivialType>>);
static_assert(asl::moveable<asl::status_or<TrivialType>>); static_assert(asl::moveable<asl::status_or<TrivialType>>);

View File

@ -1,7 +1,7 @@
#include "asl/status.hpp" #include "asl/types/status.hpp"
#include "asl/testing/testing.hpp" #include "asl/testing/testing.hpp"
#include "asl/format.hpp" #include "asl/formatting/format.hpp"
#include "asl/string_builder.hpp" #include "asl/strings/string_builder.hpp"
ASL_TEST(simple_ok) ASL_TEST(simple_ok)
{ {

View File

@ -1,2 +1 @@
warning compare with 0 in format_float.cpp warning compare with 0 in format_float.cpp
split asl into multiple sublibraries