diff --git a/BAN/Makefile b/BAN/Makefile index 9da65528e..dd4be40a6 100644 --- a/BAN/Makefile +++ b/BAN/Makefile @@ -16,7 +16,7 @@ LIBDIR?=$(EXEC_PREFIX)/lib CFLAGS:=$(CFLAGS) -Iinclude -ffreestanding -Wall -Wextra -Werror=return-type CPPFLAGS:=$(CPPFLAGS) LIBBANK_CFLAGS:=$(CFLAGS) -D__is_kernel -Iinclude -ffreestanding -Wall -Wextra -LIBBANK_CPPFLAGS:=$(CPPFLAGS) -fno-rtti -fno-exceptions -fno-threadsafe-statics +LIBBANK_CPPFLAGS:=$(CPPFLAGS) -fno-rtti -fno-exceptions ARCHDIR=arch/$(HOSTARCH) diff --git a/BAN/include/BAN/Memory.h b/BAN/include/BAN/Memory.h index 728f34476..289c9bc66 100644 --- a/BAN/include/BAN/Memory.h +++ b/BAN/include/BAN/Memory.h @@ -27,7 +27,7 @@ namespace BAN template class Unique { - BAN_NON_COPYABLE(Unique); + BAN_NON_COPYABLE(Unique); public: template diff --git a/BAN/include/BAN/Traits.h b/BAN/include/BAN/Traits.h index 4ca18cda6..301338b7f 100644 --- a/BAN/include/BAN/Traits.h +++ b/BAN/include/BAN/Traits.h @@ -27,29 +27,18 @@ namespace BAN template struct is_lvalue_reference { static constexpr bool value = true; }; template inline constexpr bool is_lvalue_reference_v = is_lvalue_reference::value; - template struct is_integral { static constexpr bool value = - is_same_v, bool> - || is_same_v, char> - || is_same_v, short> - || is_same_v, int> - || is_same_v, long> - || is_same_v, long long> - || is_same_v, signed char> - || is_same_v, signed short> - || is_same_v, signed int> - || is_same_v, signed long> - || is_same_v, signed long long> - || is_same_v, unsigned char> - || is_same_v, unsigned short> - || is_same_v, unsigned int> - || is_same_v, unsigned long> - || is_same_v, unsigned long long>; - }; + template struct maybe_const { using type = T; }; + template struct maybe_const { using type = const T; }; + template using maybe_const_t = typename maybe_const::type; + + template struct is_integral { static constexpr bool value = requires (T t, T* p, void (*f)(T)) { reinterpret_cast(t); f(0); p + t; }; }; template inline constexpr bool is_integral_v = is_integral::value; - + template concept integral = is_integral_v; + template struct is_pointer { static constexpr bool value = false; }; template struct is_pointer { static constexpr bool value = true; }; template inline constexpr bool is_pointer_v = is_pointer::value; + template concept pointer = is_pointer_v; template struct less { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; } }; template struct equal { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; } }; diff --git a/config.sh b/config.sh index 4ae17739f..37826ed99 100644 --- a/config.sh +++ b/config.sh @@ -16,7 +16,7 @@ export LIBDIR=$EXEC_PREFIX/lib export INCLUDEDIR=$PREFIX/include export CFLAGS='-O2 -g' -export CPPFLAGS='' +export CPPFLAGS='--std=c++20' # Configure the cross-compiler to use the desired system root. export SYSROOT="$(pwd)/sysroot" diff --git a/kernel/include/kernel/LockGuard.h b/kernel/include/kernel/LockGuard.h index 32016c40f..c9d1d6e42 100644 --- a/kernel/include/kernel/LockGuard.h +++ b/kernel/include/kernel/LockGuard.h @@ -8,8 +8,8 @@ namespace Kernel template class LockGuard { - BAN_NON_COPYABLE(LockGuard); - BAN_NON_MOVABLE(LockGuard); + BAN_NON_COPYABLE(LockGuard); + BAN_NON_MOVABLE(LockGuard); public: LockGuard(Lock& lock)