Meta: Disable -Wcast-align warning on RISC-V

Also explicitly specify `-mstrict-align` (The current default `-mcpu`
on gcc doesn't support unaligned accesses, so aligned memory accesses
are already implicitly required).
The `-Wcast-align` warning seems to oversensitive as it flags code like
this: https://godbolt.org/z/c8481o8aa

This used to be added for aarch64 in a473cfd71b, but was later removed
in 11896868d6.
This commit is contained in:
Sönke Holz 2023-12-12 17:13:30 +01:00 committed by Andrew Kaster
parent 7768f97333
commit f04a2b81be

View file

@ -46,3 +46,9 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
link_directories(${TOOLCHAIN_ROOT}/lib/clang/${LLVM_MAJOR_VERSION}/lib/${SERENITY_ARCH}-pc-serenity/)
endif()
if ("${SERENITY_ARCH}" STREQUAL "riscv64")
# Unaligned memory access will cause a trap, so to make sure the compiler doesn't generate
# those unaligned accesses, the strict-align flag is added.
# FIXME: Remove -Wno-cast-align when we are able to build everything without this warning turned on.
add_compile_options(-mstrict-align -Wno-cast-align)
endif()