From 985adcca38a4c5bbca259c9304433aca77f4b005 Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Sat, 19 Jun 2021 13:13:31 +0200 Subject: [PATCH] AK: Make C++ concepts support mandatory for compilers The latest GCC and Clang versions both support this, so we can freely use these in our code. --- AK/Concepts.h | 16 +++++----------- AK/Userspace.h | 8 +------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/AK/Concepts.h b/AK/Concepts.h index 5394fe6ab8..f7e4de9aee 100644 --- a/AK/Concepts.h +++ b/AK/Concepts.h @@ -11,8 +11,6 @@ namespace AK::Concepts { -#if defined(__cpp_concepts) && !defined(__COVERITY__) - template concept Integral = IsIntegral; @@ -31,13 +29,15 @@ concept Unsigned = IsUnsigned; template concept SameAs = IsSame; +// FIXME: remove once Clang formats these properly. +// clang-format off template concept VoidFunction = requires(Func func, Args... args) { { func(args...) } - ->SameAs; + -> SameAs; }; template @@ -46,15 +46,11 @@ concept IteratorFunction = requires(Func func, Args... args) { func(args...) } - ->SameAs; + -> SameAs; }; - -#endif - +// clang-format on } -#if defined(__cpp_concepts) && !defined(__COVERITY__) - using AK::Concepts::Arithmetic; using AK::Concepts::FloatingPoint; using AK::Concepts::Integral; @@ -62,5 +58,3 @@ using AK::Concepts::IteratorFunction; using AK::Concepts::Signed; using AK::Concepts::Unsigned; using AK::Concepts::VoidFunction; - -#endif diff --git a/AK/Userspace.h b/AK/Userspace.h index ae5a510359..04bc123654 100644 --- a/AK/Userspace.h +++ b/AK/Userspace.h @@ -12,16 +12,10 @@ namespace AK { -// HACK: This is just here to make syntax highlighting work in Qt Creator. -// Once it supports C++20 concepts, we can remove this. -#if defined(__cpp_concepts) && !defined(__COVERITY__) template concept PointerTypeName = IsPointer; -template -#else -template, int>::Type = 0> -#endif +template class Userspace { public: Userspace() = default;