1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 11:57:36 +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

@ -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.

View file

@ -19,7 +19,7 @@
#include <stdint.h>
#include <stdlib.h>
#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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -36,7 +36,7 @@
#include <LibGfx/TextLayout.h>
#include <stdio.h>
#if defined(__GNUC__) && !defined(__clang__)
#if defined(AK_COMPILER_GCC)
# pragma GCC optimize("O3")
#endif

View file

@ -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)))

View file

@ -11,7 +11,7 @@
#include <LibJS/Runtime/NumberConstructor.h>
#include <LibJS/Runtime/NumberObject.h>
#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)

View file

@ -8,7 +8,7 @@
#include <LibX86/Instruction.h>
#include <LibX86/Interpreter.h>
#if defined(__GNUC__) && !defined(__clang__)
#if defined(AK_COMPILER_GCC)
# pragma GCC optimize("O3")
#endif