Make -Wcast-align only a warning

On x86 and x86_64, this warning is never emitted because it is perfectly
fine to do unaligned access. On sparc, such accesses are not supported
by the hardware and will generate a SIGBUS. This must be caught by a
trap handler, and the unaligned access performed there, slowly, using
byte by byte access.

However, making this a Werror is annoying because it will trigger
everytime one casts a byte pointer to something larger, even when
alignment is actually preserved. So, removing all such warnings would be
nearly impossible (for example, just for the mergesort function, there
is a whole GSoC project for it at FreeBSD).

Keep it as a warning for now. The warning can be silenced by using
BytePointer, if desired. We should also investigate where the SIGBUS
trap is triggered a lot and consider improving the alignment of data
where possible.

Change-Id: I6b90025e8c6d69ef1ccda3c10eee270ccc1ebd29
Reviewed-on: https://review.haiku-os.org/c/1103
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
PulkoMandy 2019-02-24 09:36:55 +01:00 committed by waddlesplash
parent 5f49c55851
commit c5769c4f6b

View File

@ -115,12 +115,14 @@ rule ArchitectureSetup architecture
# warning flags
HAIKU_WARNING_CCFLAGS_$(architecture) = -Wall
-Wno-multichar
-Wpointer-arith -Wcast-align -Wsign-compare
-Wmissing-prototypes ;
-Wpointer-arith -Wsign-compare
-Wmissing-prototypes
-Wcast-align -Wno-error=cast-align ;
HAIKU_WARNING_C++FLAGS_$(architecture) = -Wall
-Wno-multichar
-Wpointer-arith -Wcast-align -Wsign-compare
-Wno-ctor-dtor-privacy -Woverloaded-virtual ;
-Wpointer-arith -Wsign-compare
-Wno-ctor-dtor-privacy -Woverloaded-virtual
-Wcast-align -Wno-error=cast-align ;
# disable some Clang warnings that are not very useful
if $(HAIKU_CC_IS_CLANG_$(architecture)) = 1 {