1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +00:00

AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places

Doesn't use them in libc headers so that those don't have to pull in
AK/Platform.h.

AK_COMPILER_GCC is set _only_ for gcc, not for clang too. (__GNUC__ is
defined in clang builds as well.) Using AK_COMPILER_GCC simplifies
things some.

AK_COMPILER_CLANG isn't as much of a win, other than that it's
consistent with AK_COMPILER_GCC.
This commit is contained in:
Nico Weber 2022-10-04 15:04:13 -04:00 committed by Linus Groh
parent ff4b912b7c
commit 2af028132a
35 changed files with 64 additions and 49 deletions

View file

@ -8,6 +8,8 @@
#pragma once
#include <AK/Platform.h>
namespace AK::Detail {
template<class T, T v>
@ -530,7 +532,7 @@ template<typename T>
inline constexpr bool IsDestructible = requires { declval<T>().~T(); };
template<typename T>
#if defined(__clang__)
#if defined(AK_COMPILER_CLANG)
inline constexpr bool IsTriviallyDestructible = __is_trivially_destructible(T);
#else
inline constexpr bool IsTriviallyDestructible = __has_trivial_destructor(T) && IsDestructible<T>;