forked from Bananymous/banan-os
All: Move to c++20
This commit is contained in:
parent
338771c5b0
commit
6a133782ed
|
@ -16,7 +16,7 @@ LIBDIR?=$(EXEC_PREFIX)/lib
|
||||||
CFLAGS:=$(CFLAGS) -Iinclude -ffreestanding -Wall -Wextra -Werror=return-type
|
CFLAGS:=$(CFLAGS) -Iinclude -ffreestanding -Wall -Wextra -Werror=return-type
|
||||||
CPPFLAGS:=$(CPPFLAGS)
|
CPPFLAGS:=$(CPPFLAGS)
|
||||||
LIBBANK_CFLAGS:=$(CFLAGS) -D__is_kernel -Iinclude -ffreestanding -Wall -Wextra
|
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)
|
ARCHDIR=arch/$(HOSTARCH)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace BAN
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class Unique
|
class Unique
|
||||||
{
|
{
|
||||||
BAN_NON_COPYABLE(Unique<T>);
|
BAN_NON_COPYABLE(Unique);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
|
|
|
@ -27,29 +27,18 @@ namespace BAN
|
||||||
template<typename T> struct is_lvalue_reference<T&> { static constexpr bool value = true; };
|
template<typename T> struct is_lvalue_reference<T&> { static constexpr bool value = true; };
|
||||||
template<typename T> inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<T>::value;
|
template<typename T> inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<T>::value;
|
||||||
|
|
||||||
template<typename T> struct is_integral { static constexpr bool value =
|
template<bool B, typename T> struct maybe_const { using type = T; };
|
||||||
is_same_v<remove_const_and_reference_t<T>, bool>
|
template<typename T> struct maybe_const<true, T> { using type = const T; };
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, char>
|
template<bool B, typename T> using maybe_const_t = typename maybe_const<B, T>::type;
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, short>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, int>
|
template<typename T> struct is_integral { static constexpr bool value = requires (T t, T* p, void (*f)(T)) { reinterpret_cast<T>(t); f(0); p + t; }; };
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, long>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, long long>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, signed char>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, signed short>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, signed int>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, signed long>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, signed long long>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, unsigned char>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, unsigned short>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, unsigned int>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, unsigned long>
|
|
||||||
|| is_same_v<remove_const_and_reference_t<T>, unsigned long long>;
|
|
||||||
};
|
|
||||||
template<typename T> inline constexpr bool is_integral_v = is_integral<T>::value;
|
template<typename T> inline constexpr bool is_integral_v = is_integral<T>::value;
|
||||||
|
template<typename T> concept integral = is_integral_v<T>;
|
||||||
|
|
||||||
template<typename T> struct is_pointer { static constexpr bool value = false; };
|
template<typename T> struct is_pointer { static constexpr bool value = false; };
|
||||||
template<typename T> struct is_pointer<T*> { static constexpr bool value = true; };
|
template<typename T> struct is_pointer<T*> { static constexpr bool value = true; };
|
||||||
template<typename T> inline constexpr bool is_pointer_v = is_pointer<T>::value;
|
template<typename T> inline constexpr bool is_pointer_v = is_pointer<T>::value;
|
||||||
|
template<typename T> concept pointer = is_pointer_v<T>;
|
||||||
|
|
||||||
template<typename T> struct less { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; } };
|
template<typename T> struct less { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; } };
|
||||||
template<typename T> struct equal { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; } };
|
template<typename T> struct equal { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; } };
|
||||||
|
|
|
@ -16,7 +16,7 @@ export LIBDIR=$EXEC_PREFIX/lib
|
||||||
export INCLUDEDIR=$PREFIX/include
|
export INCLUDEDIR=$PREFIX/include
|
||||||
|
|
||||||
export CFLAGS='-O2 -g'
|
export CFLAGS='-O2 -g'
|
||||||
export CPPFLAGS=''
|
export CPPFLAGS='--std=c++20'
|
||||||
|
|
||||||
# Configure the cross-compiler to use the desired system root.
|
# Configure the cross-compiler to use the desired system root.
|
||||||
export SYSROOT="$(pwd)/sysroot"
|
export SYSROOT="$(pwd)/sysroot"
|
||||||
|
|
|
@ -8,8 +8,8 @@ namespace Kernel
|
||||||
template<typename Lock>
|
template<typename Lock>
|
||||||
class LockGuard
|
class LockGuard
|
||||||
{
|
{
|
||||||
BAN_NON_COPYABLE(LockGuard<Lock>);
|
BAN_NON_COPYABLE(LockGuard);
|
||||||
BAN_NON_MOVABLE(LockGuard<Lock>);
|
BAN_NON_MOVABLE(LockGuard);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LockGuard(Lock& lock)
|
LockGuard(Lock& lock)
|
||||||
|
|
Loading…
Reference in New Issue