diff --git a/AK/SIMDExtras.h b/AK/SIMDExtras.h index d8568cf6f9cc017..c8b7926fdf10a17 100644 --- a/AK/SIMDExtras.h +++ b/AK/SIMDExtras.h @@ -10,13 +10,6 @@ #include #include -// Functions returning vectors or accepting vector arguments have different calling conventions -// depending on whether the target architecture supports SSE or not. GCC generates warning "psabi" -// when compiling for non-SSE architectures. We disable this warning because these functions -// are static and should never be visible from outside the translation unit that includes this header. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpsabi" - namespace AK::SIMD { // SIMD Vector Expansion @@ -327,5 +320,3 @@ ALWAYS_INLINE static T elementwise_byte_reverse(T a) } } - -#pragma GCC diagnostic pop diff --git a/AK/SIMDMath.h b/AK/SIMDMath.h index d69210cbcc6d166..7c1a7fc18e3d6d8 100644 --- a/AK/SIMDMath.h +++ b/AK/SIMDMath.h @@ -11,13 +11,6 @@ #include #include -// Functions returning vectors or accepting vector arguments have different calling conventions -// depending on whether the target architecture supports SSE or not. GCC generates warning "psabi" -// when compiling for non-SSE architectures. We disable this warning because these functions -// are static and should never be visible from outside the translation unit that includes this header. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpsabi" - namespace AK::SIMD { // Functions ending in "_int_range" only accept arguments within range [INT_MIN, INT_MAX]. @@ -90,5 +83,3 @@ ALWAYS_INLINE static f32x4 sqrt(f32x4 v) } } - -#pragma GCC diagnostic pop diff --git a/Meta/CMake/common_compile_options.cmake b/Meta/CMake/common_compile_options.cmake index 84a00d309f54ff1..b1155d32db5aca9 100644 --- a/Meta/CMake/common_compile_options.cmake +++ b/Meta/CMake/common_compile_options.cmake @@ -13,6 +13,19 @@ add_compile_options(-Wno-invalid-offsetof) add_compile_options(-Wno-unknown-warning-option) add_compile_options(-Wno-unused-command-line-argument) +# This warning is triggered when one accepts or returns vectors from a function (that is not marked +# with [[gnu::target(...)]]) which would have been otherwise passed in register if the current +# translation unit had been compiled with more permissive flags wrt instruction selection (i. e. if +# one adds -mavx2 to cmdline). This will never be a problem for us since we (a) never use +# different instruction selection options across ABI boundaries; (b) most of the affected functions +# are actually TU-local. +# +# Moreover, even if we somehow properly annotated all of the SIMD helpers, calling them across ABI +# (or target) boundaries would still be very dangerous because of inconsistent and bogus handling of +# [[gnu::target(...)]] across compilers. See https://github.com/llvm/llvm-project/issues/64706 and +# https://www.reddit.com/r/cpp/comments/17qowl2/comment/k8j2odi . +add_compile_options(-Wno-psabi) + add_compile_options(-fno-exceptions) add_compile_options(-ffp-contract=off) diff --git a/Userland/Libraries/LibCrypto/Hash/SHA1.cpp b/Userland/Libraries/LibCrypto/Hash/SHA1.cpp index a237f4b48ba46af..803e4cb76d0e742 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA1.cpp +++ b/Userland/Libraries/LibCrypto/Hash/SHA1.cpp @@ -15,7 +15,6 @@ # include # include # include -# pragma GCC diagnostic ignored "-Wpsabi" #endif namespace Crypto::Hash { diff --git a/Userland/Libraries/LibCrypto/Hash/SHA2.cpp b/Userland/Libraries/LibCrypto/Hash/SHA2.cpp index b457fd1894ff9b1..49fb4d97117893b 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA2.cpp +++ b/Userland/Libraries/LibCrypto/Hash/SHA2.cpp @@ -13,7 +13,6 @@ # include # include # include -# pragma GCC diagnostic ignored "-Wpsabi" #endif namespace Crypto::Hash { diff --git a/Userland/Libraries/LibGfx/ImageFormats/PNGWriter.cpp b/Userland/Libraries/LibGfx/ImageFormats/PNGWriter.cpp index 7128e5470800ca4..d162d8b4f63ec1a 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/PNGWriter.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/PNGWriter.cpp @@ -15,8 +15,6 @@ #include #include -#pragma GCC diagnostic ignored "-Wpsabi" - namespace Gfx { class PNGChunk {