-
For example, something like this: uint8_t *p8; uint32_t *p32 = (uint32_t *) p8; generates a warning like this: spice-channel.c:1350:10: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'uint32_t *' (aka 'unsigned int *') increases required alignment from 1 to 4 [-Werror,-Wcast-align] The warning indicates that we end up with a pointer to data that should be 4-byte aligned, but its value may be misaligned. On x86, this does not make much of a difference, except a relatively minor performance penalty. However, on platforms such as older ARM, misaligned accesses are emulated by the kernel, and support for them is optional. So we may end up with a fault. The intent of the fix here is to make it easy to identify and rework places where actual mis-alignment occurs. Wherever casts raise the warning, they are replaced with a macro: - SPICE_ALIGNED_CAST(type, value) casts value to type, and indicates that we beli...
babe5630