From 4a3185b782dabeb664fcf2fa4f6d17e36cf23d0e Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Mon, 28 Oct 2024 18:39:01 +0100 Subject: Start fixing some cross platform issues --- MODULE.bazel.lock | 12 ++++++------ asl/assert.hpp | 3 ++- asl/integers.hpp | 13 ++++++++----- asl/memory.hpp | 2 +- asl/testing/testing.cpp | 2 +- asl/testing/testing.hpp | 2 +- asl/tests/option_tests.cpp | 2 +- 7 files changed, 20 insertions(+), 16 deletions(-) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index d62a47c..21b358e 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -64,19 +64,19 @@ "@@apple_support~//crosstool:setup.bzl%apple_cc_configure_extension": { "general": { "bzlTransitiveDigest": "PjIds3feoYE8SGbbIq2SFTZy3zmxeO2tQevJZNDo7iY=", - "usagesDigest": "+hz7IHWN6A1oVJJWNDB6yZRG+RYhF76wAYItpAeIUIg=", + "usagesDigest": "aLmqbvowmHkkBPve05yyDNGN7oh7QE9kBADr3QIZTZs=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, "generatedRepoSpecs": { - "local_config_apple_cc_toolchains": { + "local_config_apple_cc": { "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf_toolchains", + "ruleClassName": "_apple_cc_autoconf", "attributes": {} }, - "local_config_apple_cc": { + "local_config_apple_cc_toolchains": { "bzlFile": "@@apple_support~//crosstool:setup.bzl", - "ruleClassName": "_apple_cc_autoconf", + "ruleClassName": "_apple_cc_autoconf_toolchains", "attributes": {} } }, @@ -92,7 +92,7 @@ "@@platforms//host:extension.bzl%host_platform": { "general": { "bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=", - "usagesDigest": "pCYpDQmqMbmiiPI1p2Kd3VLm5T48rRAht5WdW0X2GlA=", + "usagesDigest": "meSzxn3DUCcYEhq4HQwExWkWtU4EjriRBQLsZN+Q0SU=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, diff --git a/asl/assert.hpp b/asl/assert.hpp index 0c80d9c..d419c24 100644 --- a/asl/assert.hpp +++ b/asl/assert.hpp @@ -1,5 +1,6 @@ #pragma once +// @Todo Make this portable-ish #define ASL_ASSERT(...) \ if (__VA_ARGS__) {} \ - else { __debugbreak(); } + else { __builtin_debugtrap(); } diff --git a/asl/integers.hpp b/asl/integers.hpp index b5d3e99..716b981 100644 --- a/asl/integers.hpp +++ b/asl/integers.hpp @@ -1,14 +1,17 @@ #pragma once -using int8_t = char; -using int16_t = short; -using int32_t = int; -using int64_t = long long; +using int8_t = signed char; +using int16_t = signed short; +using int32_t = signed int; +using int64_t = signed long; + +// @Todo Proper type definition for Windows/Linux using uint8_t = unsigned char; using uint16_t = unsigned short; using uint32_t = unsigned int; -using uint64_t = unsigned long long; +using uint64_t = unsigned long; +using size_t = uint64_t; using isize_t = int64_t; diff --git a/asl/memory.hpp b/asl/memory.hpp index 33fa819..c73a165 100644 --- a/asl/memory.hpp +++ b/asl/memory.hpp @@ -2,7 +2,7 @@ #include "asl/integers.hpp" -constexpr void* operator new(uint64_t, void* ptr) +constexpr void* operator new(size_t, void* ptr) { return ptr; } diff --git a/asl/testing/testing.cpp b/asl/testing/testing.cpp index e07cde8..f0c4fb5 100644 --- a/asl/testing/testing.cpp +++ b/asl/testing/testing.cpp @@ -1,6 +1,6 @@ #include "asl/testing/testing.hpp" -#include +#include "asl/print.hpp" static asl::testing::Test* g_head = nullptr; static asl::testing::Test* g_tail = nullptr; diff --git a/asl/testing/testing.hpp b/asl/testing/testing.hpp index db2a64a..4fe44df 100644 --- a/asl/testing/testing.hpp +++ b/asl/testing/testing.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include "asl/utility.hpp" namespace asl::testing { diff --git a/asl/tests/option_tests.cpp b/asl/tests/option_tests.cpp index a42592a..e423cc9 100644 --- a/asl/tests/option_tests.cpp +++ b/asl/tests/option_tests.cpp @@ -1,6 +1,6 @@ #include "asl/option.hpp" #include "asl/tests/test_types.hpp" -#include +#include "asl/testing/testing.hpp" static_assert(asl::trivially_destructible>); static_assert(!asl::trivially_destructible>); -- cgit