From 2af028132adca1ae9fbb81a655a9ce00420d8ad4 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 4 Oct 2022 15:04:13 -0400 Subject: [PATCH] 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. --- AK/BuiltinWrappers.h | 8 ++++---- AK/Checked.h | 4 ++-- AK/CheckedFormatString.h | 2 +- AK/IntrusiveList.h | 2 +- AK/IntrusiveRedBlackTree.h | 2 +- AK/Platform.h | 11 +++++++++-- AK/StdLibExtraDetails.h | 4 +++- AK/StdLibExtras.h | 4 +++- AK/StringView.h | 2 +- Kernel/Arch/x86/i386/Atomics.cpp | 2 +- Kernel/StdLib.cpp | 2 +- Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp | 4 ++-- .../CodeGenerators/LibUnicode/GenerateUnicodeData.cpp | 4 ++-- Tests/AK/TestRefPtr.cpp | 8 ++++---- Tests/AK/TestWeakPtr.cpp | 4 ++-- Tests/Kernel/TestSigAltStack.cpp | 4 +++- Tests/Kernel/crash.cpp | 2 +- Tests/LibC/TestMath.cpp | 4 +++- Tests/LibC/TestMemalign.cpp | 4 ++-- Userland/Applications/KeyboardMapper/KeyPositions.h | 4 ++-- Userland/DevTools/UserspaceEmulator/Emulator.cpp | 2 +- .../DevTools/UserspaceEmulator/Emulator_syscalls.cpp | 2 +- Userland/DevTools/UserspaceEmulator/SoftCPU.cpp | 2 +- Userland/DevTools/UserspaceEmulator/SoftFPU.cpp | 2 +- Userland/Libraries/LibC/arch/x86_64/memset.cpp | 2 +- Userland/Libraries/LibC/math.cpp | 4 ++-- Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp | 2 +- Userland/Libraries/LibEDID/EDID.cpp | 2 +- Userland/Libraries/LibGfx/AntiAliasingPainter.cpp | 2 +- .../Libraries/LibGfx/Filters/FastBoxBlurFilter.cpp | 2 +- Userland/Libraries/LibGfx/Filters/StackBlurFilter.cpp | 2 +- Userland/Libraries/LibGfx/Painter.cpp | 2 +- Userland/Libraries/LibGfx/VectorN.h | 2 +- .../Libraries/LibJS/Runtime/NumberConstructor.cpp | 2 +- Userland/Libraries/LibX86/Instruction.cpp | 2 +- 35 files changed, 64 insertions(+), 49 deletions(-) diff --git a/AK/BuiltinWrappers.h b/AK/BuiltinWrappers.h index 97748ac9761..2ea6b68c025 100644 --- a/AK/BuiltinWrappers.h +++ b/AK/BuiltinWrappers.h @@ -11,7 +11,7 @@ template inline constexpr int popcount(IntType value) { -#if defined(__GNUC__) || defined(__clang__) +#if defined(AK_COMPILER_CLANG) || defined(AK_COMPILER_GCC) static_assert(sizeof(IntType) <= sizeof(unsigned long long)); if constexpr (sizeof(IntType) <= sizeof(unsigned int)) return __builtin_popcount(value); @@ -39,7 +39,7 @@ inline constexpr int popcount(IntType value) template inline constexpr int count_trailing_zeroes(IntType value) { -#if defined(__GNUC__) || defined(__clang__) +#if defined(AK_COMPILER_CLANG) || defined(AK_COMPILER_GCC) static_assert(sizeof(IntType) <= sizeof(unsigned long long)); if constexpr (sizeof(IntType) <= sizeof(unsigned int)) return __builtin_ctz(value); @@ -77,7 +77,7 @@ inline constexpr int count_trailing_zeroes_safe(IntType value) template inline constexpr int count_leading_zeroes(IntType value) { -#if defined(__GNUC__) || defined(__clang__) +#if defined(AK_COMPILER_CLANG) || defined(AK_COMPILER_GCC) static_assert(sizeof(IntType) <= sizeof(unsigned long long)); if constexpr (sizeof(IntType) <= sizeof(unsigned int)) return __builtin_clz(value) - (32 - (8 * sizeof(IntType))); @@ -114,7 +114,7 @@ inline constexpr int count_leading_zeroes_safe(IntType value) template inline constexpr int bit_scan_forward(IntType value) { -#if defined(__GNUC__) || defined(__clang__) +#if defined(AK_COMPILER_CLANG) || defined(AK_COMPILER_GCC) static_assert(sizeof(IntType) <= sizeof(unsigned long long)); if constexpr (sizeof(IntType) <= sizeof(unsigned int)) return __builtin_ffs(value); diff --git a/AK/Checked.h b/AK/Checked.h index 77d881273a4..41f1c0b8cb2 100644 --- a/AK/Checked.h +++ b/AK/Checked.h @@ -302,7 +302,7 @@ public: template [[nodiscard]] static constexpr bool addition_would_overflow(U u, V v) { -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) Checked checked; checked = u; checked += v; @@ -315,7 +315,7 @@ public: template [[nodiscard]] static constexpr bool multiplication_would_overflow(U u, V v) { -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) Checked checked; checked = u; checked *= v; diff --git a/AK/CheckedFormatString.h b/AK/CheckedFormatString.h index 1adb3eda7cc..6c55163b68b 100644 --- a/AK/CheckedFormatString.h +++ b/AK/CheckedFormatString.h @@ -15,7 +15,7 @@ #ifdef ENABLE_COMPILETIME_FORMAT_CHECK // FIXME: Seems like clang doesn't like calling 'consteval' functions inside 'consteval' functions quite the same way as GCC does, // it seems to entirely forget that it accepted that parameters to a 'consteval' function to begin with. -# if defined(__clang__) || defined(__CLION_IDE__) || defined(__CLION_IDE_) +# if defined(AK_COMPILER_CLANG) || defined(__CLION_IDE__) || defined(__CLION_IDE_) # undef ENABLE_COMPILETIME_FORMAT_CHECK # endif #endif diff --git a/AK/IntrusiveList.h b/AK/IntrusiveList.h index 5f06579bb3c..8a0b63eec50 100644 --- a/AK/IntrusiveList.h +++ b/AK/IntrusiveList.h @@ -168,7 +168,7 @@ public: // Note: For some reason, clang does not consider `member` as declared here, and as declared above (`SubstitutedIntrusiveListNode T::*`) // to be of equal types. so for now, just make the members public on clang. -#ifndef __clang__ +#if !defined(AK_COMPILER_CLANG) private: template T_::*member> friend class ::AK::Detail::IntrusiveList; diff --git a/AK/IntrusiveRedBlackTree.h b/AK/IntrusiveRedBlackTree.h index 6b1442f1fc9..763ff975e6e 100644 --- a/AK/IntrusiveRedBlackTree.h +++ b/AK/IntrusiveRedBlackTree.h @@ -198,7 +198,7 @@ public: static constexpr bool IsRaw = IsPointer; -#ifndef __clang__ +#if !defined(AK_COMPILER_CLANG) private: template TV::*member> friend class ::AK::Detail::IntrusiveRedBlackTree; diff --git a/AK/Platform.h b/AK/Platform.h index 5e16ae63bd8..e6bf438626e 100644 --- a/AK/Platform.h +++ b/AK/Platform.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2022, Nico Weber * * SPDX-License-Identifier: BSD-2-Clause */ @@ -24,6 +25,12 @@ # define AK_ARCH_32_BIT #endif +#if defined(__clang__) +# define AK_COMPILER_CLANG +#elif defined(__GNUC__) +# define AK_COMPILER_GCC +#endif + #if defined(__serenity__) # define AK_OS_SERENITY #endif @@ -84,7 +91,7 @@ # define VALIDATE_IS_X86() static_assert(false, "Trying to include x86 only header on non x86 platform"); #endif -#if !defined(__clang__) && !defined(__CLION_IDE_) && !defined(__CLION_IDE__) +#if !defined(AK_COMPILER_CLANG) && !defined(__CLION_IDE_) && !defined(__CLION_IDE__) # define AK_HAS_CONDITIONALLY_TRIVIAL #endif @@ -121,7 +128,7 @@ #ifdef DISALLOW # undef DISALLOW #endif -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # define DISALLOW(message) __attribute__((diagnose_if(1, message, "error"))) #else # define DISALLOW(message) __attribute__((error(message))) diff --git a/AK/StdLibExtraDetails.h b/AK/StdLibExtraDetails.h index 13cb32bb4e1..3746f1c280a 100644 --- a/AK/StdLibExtraDetails.h +++ b/AK/StdLibExtraDetails.h @@ -8,6 +8,8 @@ #pragma once +#include + namespace AK::Detail { template @@ -530,7 +532,7 @@ template inline constexpr bool IsDestructible = requires { declval().~T(); }; template -#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; diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h index dbe872470de..19cdef35db1 100644 --- a/AK/StdLibExtras.h +++ b/AK/StdLibExtras.h @@ -6,7 +6,9 @@ #pragma once -#if defined(__clang__) || defined(__CLION_IDE__) +#include + +#if defined(AK_COMPILER_CLANG) || defined(__CLION_IDE__) # pragma clang diagnostic ignored "-Wunqualified-std-cast-call" #endif diff --git a/AK/StringView.h b/AK/StringView.h index 1ec0ec20228..72c4ef599d7 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -338,7 +338,7 @@ struct CaseInsensitiveStringViewTraits : public Traits { // FIXME: Remove this when clang fully supports consteval (specifically in the context of default parameter initialization). // See: https://stackoverflow.com/questions/68789984/immediate-function-as-default-function-argument-initializer-in-clang -#if defined(__clang__) +#if defined(AK_COMPILER_CLANG) # define AK_STRING_VIEW_LITERAL_CONSTEVAL constexpr #else # define AK_STRING_VIEW_LITERAL_CONSTEVAL consteval diff --git a/Kernel/Arch/x86/i386/Atomics.cpp b/Kernel/Arch/x86/i386/Atomics.cpp index 19dbab31bc7..d6d134f8d30 100644 --- a/Kernel/Arch/x86/i386/Atomics.cpp +++ b/Kernel/Arch/x86/i386/Atomics.cpp @@ -8,7 +8,7 @@ extern "C" { -#if defined(__GNUC__) && !defined(__clang__) // FIXME: Remove this file once GCC supports 8-byte atomics on i686 +#if defined(AK_COMPILER_GCC) // FIXME: Remove this file once GCC supports 8-byte atomics on i686 u64 kernel__atomic_compare_exchange_8(u64 volatile*, u64*, u64, int, int); # pragma redefine_extname kernel__atomic_compare_exchange_8 __atomic_compare_exchange_8 diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp index 3c2feeb724d..356204896e0 100644 --- a/Kernel/StdLib.cpp +++ b/Kernel/StdLib.cpp @@ -206,7 +206,7 @@ ErrorOr memset_user(void* dest_ptr, int c, size_t n) return {}; } -#if defined(__clang__) && defined(ENABLE_KERNEL_LTO) +#if defined(AK_COMPILER_CLANG) && defined(ENABLE_KERNEL_LTO) // Due to a chicken-and-egg situation, certain linker-defined symbols that are added on-demand (like the GOT) // need to be present before LTO bitcode files are compiled. And since we don't link to any native object files, // the linker does not know that _GLOBAL_OFFSET_TABLE_ is needed, so it doesn't define it, so linking as a PIE fails. diff --git a/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp b/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp index 28aca300b33..2ff1c19f353 100644 --- a/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp @@ -751,7 +751,7 @@ public: private: }; -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) #pragma clang diagnostic pop #endif)~~~"); } @@ -781,7 +781,7 @@ void build(StringBuilder& builder, Vector const& endpoints) #include #include -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdefaulted-function-deleted" #endif)~~~"); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp index 871b6d2769e..6abb646a19c 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp @@ -199,7 +199,7 @@ static CodePointRange parse_code_point_range(StringView list) } // gcc-11, gcc-12 have a codegen bug on (at least) intel macOS 10.15, see #15449. -#if defined(__GNUC__) && !defined(__clang__) && defined(AK_OS_MACOS) +#if defined(AK_COMPILER_GCC) && defined(AK_OS_MACOS) # pragma GCC push_options # pragma GCC optimize("O0") #endif @@ -649,7 +649,7 @@ static ErrorOr parse_unicode_data(Core::Stream::BufferedFile& file, Unicod return {}; } -#if defined(__GNUC__) && !defined(__clang__) && defined(AK_OS_MACOS) +#if defined(AK_COMPILER_GCC) && defined(AK_OS_MACOS) # pragma GCC pop_options #endif diff --git a/Tests/AK/TestRefPtr.cpp b/Tests/AK/TestRefPtr.cpp index 5d3c0a0205b..ce94833d406 100644 --- a/Tests/AK/TestRefPtr.cpp +++ b/Tests/AK/TestRefPtr.cpp @@ -97,12 +97,12 @@ TEST_CASE(assign_moved_self) { RefPtr object = adopt_ref(*new Object); EXPECT_EQ(object->ref_count(), 1u); -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wself-move" #endif object = move(object); -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic pop #endif EXPECT_EQ(object->ref_count(), 1u); @@ -113,12 +113,12 @@ TEST_CASE(assign_copy_self) RefPtr object = adopt_ref(*new Object); EXPECT_EQ(object->ref_count(), 1u); -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wself-assign-overloaded" #endif object = object; -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic pop #endif diff --git a/Tests/AK/TestWeakPtr.cpp b/Tests/AK/TestWeakPtr.cpp index 8a573276cd6..5a8c733443b 100644 --- a/Tests/AK/TestWeakPtr.cpp +++ b/Tests/AK/TestWeakPtr.cpp @@ -10,7 +10,7 @@ #include #include -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wunused-private-field" #endif @@ -24,7 +24,7 @@ private: int m_member { 123 }; }; -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic pop #endif diff --git a/Tests/Kernel/TestSigAltStack.cpp b/Tests/Kernel/TestSigAltStack.cpp index 1c4aa66901d..63df5fd0849 100644 --- a/Tests/Kernel/TestSigAltStack.cpp +++ b/Tests/Kernel/TestSigAltStack.cpp @@ -4,7 +4,9 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#ifdef __clang__ +#include + +#if defined(AK_COMPILER_CLANG) # pragma clang optimize off #else # pragma GCC optimize("O0") diff --git a/Tests/Kernel/crash.cpp b/Tests/Kernel/crash.cpp index 71eecc07aa0..38ec524bead 100644 --- a/Tests/Kernel/crash.cpp +++ b/Tests/Kernel/crash.cpp @@ -23,7 +23,7 @@ using Test::Crash; -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang optimize off #else # pragma GCC optimize("O0") diff --git a/Tests/LibC/TestMath.cpp b/Tests/LibC/TestMath.cpp index 6898cbc7d00..bd6453472a9 100644 --- a/Tests/LibC/TestMath.cpp +++ b/Tests/LibC/TestMath.cpp @@ -4,7 +4,9 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#ifdef __clang__ +#include + +#if defined(AK_COMPILER_CLANG) # pragma clang optimize off #else # pragma GCC optimize("O0") diff --git a/Tests/LibC/TestMemalign.cpp b/Tests/LibC/TestMemalign.cpp index 61b616958da..01069ac4e6c 100644 --- a/Tests/LibC/TestMemalign.cpp +++ b/Tests/LibC/TestMemalign.cpp @@ -91,13 +91,13 @@ TEST_CASE(aligned_alloc_fuzz) TEST_CASE(aligned_alloc_not_power2) { -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wnon-power-of-two-alignment" #endif EXPECT_EQ(aligned_alloc(7, 256), nullptr); EXPECT_EQ(errno, EINVAL); -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic pop #endif } diff --git a/Userland/Applications/KeyboardMapper/KeyPositions.h b/Userland/Applications/KeyboardMapper/KeyPositions.h index debaec22229..a94afd2bc76 100644 --- a/Userland/Applications/KeyboardMapper/KeyPositions.h +++ b/Userland/Applications/KeyboardMapper/KeyPositions.h @@ -21,7 +21,7 @@ struct KeyPosition { #define KEY_COUNT 63 -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wc99-designator" #endif @@ -99,6 +99,6 @@ struct KeyPosition keys[KEY_COUNT] = { // clang-format on }; -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic pop #endif diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index 57b8bbc8af5..1f84a0210b2 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -25,7 +25,7 @@ #include #include -#if defined(__GNUC__) && !defined(__clang__) +#if defined(AK_COMPILER_GCC) # pragma GCC optimize("O3") #endif diff --git a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp index f1fe167ad48..6e7c741f606 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp @@ -29,7 +29,7 @@ #include #include -#if defined(__GNUC__) && !defined(__clang__) +#if defined(AK_COMPILER_GCC) # pragma GCC optimize("O3") #endif diff --git a/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp b/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp index db7c9cc7ca1..f91f3840aa9 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp +++ b/Userland/DevTools/UserspaceEmulator/SoftCPU.cpp @@ -15,7 +15,7 @@ #include #include -#if defined(__GNUC__) && !defined(__clang__) +#if defined(AK_COMPILER_GCC) # pragma GCC optimize("O3") #endif diff --git a/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp b/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp index 00eefa6aceb..870f3b205a6 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp +++ b/Userland/DevTools/UserspaceEmulator/SoftFPU.cpp @@ -16,7 +16,7 @@ #include -#if defined(__GNUC__) && !defined(__clang__) +#if defined(AK_COMPILER_GCC) # pragma GCC optimize("O3") #endif diff --git a/Userland/Libraries/LibC/arch/x86_64/memset.cpp b/Userland/Libraries/LibC/arch/x86_64/memset.cpp index a5e58a2d5bb..8ff6667e6f3 100644 --- a/Userland/Libraries/LibC/arch/x86_64/memset.cpp +++ b/Userland/Libraries/LibC/arch/x86_64/memset.cpp @@ -41,7 +41,7 @@ namespace { } } -#if !defined(__clang__) && !defined(_DYNAMIC_LOADER) +#if !defined(AK_COMPILER_CLANG) && !defined(_DYNAMIC_LOADER) [[gnu::ifunc("resolve_memset")]] void* memset(void*, int, size_t); #else // DynamicLoader can't self-relocate IFUNCs. diff --git a/Userland/Libraries/LibC/math.cpp b/Userland/Libraries/LibC/math.cpp index 9472fff7105..df1e409ce15 100644 --- a/Userland/Libraries/LibC/math.cpp +++ b/Userland/Libraries/LibC/math.cpp @@ -19,7 +19,7 @@ #include #include -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wdouble-promotion" #endif @@ -1148,6 +1148,6 @@ float nearbyintf(float value) NOEXCEPT } } -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic pop #endif diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp index 466b824b24d..12826a662fe 100644 --- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp +++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.cpp @@ -64,7 +64,7 @@ void DwarfInfo::populate_compilation_units() // HACK: Clang generates line programs for embedded resource assembly files, but not compile units. // Meaning that for graphical applications, some line info data would be unread, triggering the assertion below. // As a fix, we don't create compilation units for line programs that come from resource files. -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) if (line_program->source_files().size() == 1 && line_program->source_files()[0].name.view().contains("serenity_icon_"sv)) { debug_info_stream.seek(unit_offset); } else diff --git a/Userland/Libraries/LibEDID/EDID.cpp b/Userland/Libraries/LibEDID/EDID.cpp index aa8c2feb921..0c01e43fa00 100644 --- a/Userland/Libraries/LibEDID/EDID.cpp +++ b/Userland/Libraries/LibEDID/EDID.cpp @@ -23,7 +23,7 @@ namespace EDID { // clang doesn't like passing around pointers to members in packed structures, // even though we're only using them for arithmetic purposes -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # pragma clang diagnostic ignored "-Waddress-of-packed-member" #endif diff --git a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp index 173983f3b0c..45eb0e4ee65 100644 --- a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp +++ b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#if defined(__GNUC__) && !defined(__clang__) +#if defined(AK_COMPILER_GCC) # pragma GCC optimize("O3") #endif diff --git a/Userland/Libraries/LibGfx/Filters/FastBoxBlurFilter.cpp b/Userland/Libraries/LibGfx/Filters/FastBoxBlurFilter.cpp index 5ac41a356cd..5aee6dbc9d5 100644 --- a/Userland/Libraries/LibGfx/Filters/FastBoxBlurFilter.cpp +++ b/Userland/Libraries/LibGfx/Filters/FastBoxBlurFilter.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#if defined(__GNUC__) && !defined(__clang__) +#if defined(AK_COMPILER_GCC) # pragma GCC optimize("O3") #endif diff --git a/Userland/Libraries/LibGfx/Filters/StackBlurFilter.cpp b/Userland/Libraries/LibGfx/Filters/StackBlurFilter.cpp index c7ff7885cdb..1ae302536e0 100644 --- a/Userland/Libraries/LibGfx/Filters/StackBlurFilter.cpp +++ b/Userland/Libraries/LibGfx/Filters/StackBlurFilter.cpp @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#if defined(__GNUC__) && !defined(__clang__) +#if defined(AK_COMPILER_GCC) # pragma GCC optimize("O3") #endif diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index 84c936e7b8f..bfd566709b2 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -36,7 +36,7 @@ #include #include -#if defined(__GNUC__) && !defined(__clang__) +#if defined(AK_COMPILER_GCC) # pragma GCC optimize("O3") #endif diff --git a/Userland/Libraries/LibGfx/VectorN.h b/Userland/Libraries/LibGfx/VectorN.h index bf8eecc5186..0f3f5f38cab 100644 --- a/Userland/Libraries/LibGfx/VectorN.h +++ b/Userland/Libraries/LibGfx/VectorN.h @@ -21,7 +21,7 @@ #define STRINGIFY_HELPER(x) #x #define STRINGIFY(x) STRINGIFY_HELPER(x) -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # define UNROLL_LOOP _Pragma(STRINGIFY(unroll)) #else # define UNROLL_LOOP _Pragma(STRINGIFY(GCC unroll(LOOP_UNROLL_N))) diff --git a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp index 540b8c74144..6b13086b671 100644 --- a/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/NumberConstructor.cpp @@ -11,7 +11,7 @@ #include #include -#ifdef __clang__ +#if defined(AK_COMPILER_CLANG) # define EPSILON_VALUE AK::exp2(-52.) # define MAX_SAFE_INTEGER_VALUE AK::exp2(53.) - 1 # define MIN_SAFE_INTEGER_VALUE -(AK::exp2(53.) - 1) diff --git a/Userland/Libraries/LibX86/Instruction.cpp b/Userland/Libraries/LibX86/Instruction.cpp index d649c1bfb4a..e1702209e29 100644 --- a/Userland/Libraries/LibX86/Instruction.cpp +++ b/Userland/Libraries/LibX86/Instruction.cpp @@ -8,7 +8,7 @@ #include #include -#if defined(__GNUC__) && !defined(__clang__) +#if defined(AK_COMPILER_GCC) # pragma GCC optimize("O3") #endif