mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-07 02:27:22 +03:00
2dba79bc6b
FP contraction is a standard-conforming behavior which allows the compiler to calculate intermediate results of expressions containing floating point numbers with a greater precision than the expression type allows. And in theory, it enables additional optimizations, such as replacing `a * b + c` with fma(a, b, c). Unfortunately, it is extremely hard to predict when the contraction will happen. For example, Clang 17 on x86_64 with the default options will use FMA only for constant-folded non-constexpr expressions. So, in practice, FP contraction leads to hard-to-find bugs and inconsistencies between executables compiled with different toolchains or for different OSes. And we had two instances of this happening last week. Since we did not ever used -mfma on x86_64, this patch can only possibly regress performance on Apple ARM devices, where FMA is enabled by default. However, this regression will likely be negligible since the difference would be one additional add instruction, which would be then likely executed in parallel with something else.
43 lines
1.6 KiB
CMake
43 lines
1.6 KiB
CMake
# Flags shared by Lagom (including Ladybird) and Serenity.
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
add_compile_options(-Wall)
|
|
add_compile_options(-Wextra)
|
|
|
|
add_compile_options(-Wno-unknown-warning-option)
|
|
add_compile_options(-Wno-unused-command-line-argument)
|
|
|
|
add_compile_options(-fdiagnostics-color=always)
|
|
add_compile_options(-fno-exceptions)
|
|
|
|
add_compile_options(-ffp-contract=off)
|
|
|
|
if (NOT CMAKE_HOST_SYSTEM_NAME MATCHES SerenityOS)
|
|
# FIXME: Something makes this go crazy and flag unused variables that aren't flagged as such when building with the toolchain.
|
|
# Disable -Werror for now.
|
|
add_compile_options(-Werror)
|
|
endif()
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
|
# Clang's default constexpr-steps limit is 1048576(2^20), GCC doesn't have one
|
|
add_compile_options(-fconstexpr-steps=16777216)
|
|
|
|
add_compile_options(-Wno-implicit-const-int-float-conversion)
|
|
add_compile_options(-Wno-user-defined-literals)
|
|
add_compile_options(-Wno-vla-cxx-extension)
|
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
# Only ignore expansion-to-defined for g++, clang's implementation doesn't complain about function-like macros
|
|
add_compile_options(-Wno-expansion-to-defined)
|
|
add_compile_options(-Wno-literal-suffix)
|
|
|
|
# FIXME: This warning seems useful but has too many false positives with GCC 13.
|
|
add_compile_options(-Wno-dangling-reference)
|
|
endif()
|
|
|
|
if (UNIX AND NOT APPLE AND NOT ENABLE_FUZZERS)
|
|
add_compile_options(-fno-semantic-interposition)
|
|
add_compile_options(-fvisibility-inlines-hidden)
|
|
endif()
|