pulsecore/shm: Remove shm_marker struct packing for pa_atomic_t fields 10/268710/2
authorMarijn Suijten <marijns95@gmail.com>
Wed, 3 Nov 2021 16:40:19 +0000 (17:40 +0100)
committerSeungbae Shin <seungbae.shin@samsung.com>
Mon, 24 Jan 2022 03:33:32 +0000 (03:33 +0000)
commitba567a83801fb83fa5fc14fd45a805ce9341da7d
treec004af9f56b4446dc1a68d92a48d734e9d84c042
parentce033b0c9d2049fbca56ea54dc0ea5b3ebf2e827
pulsecore/shm: Remove shm_marker struct packing for pa_atomic_t fields

Taking addresses of fields in a packed struct are not guaranteed to be
aligned, resulting in warnings such as:

    ../src/pulsecore/shm.c: In function 'sharedmem_create':
    ../src/pulsecore/shm.c:198:25: error: taking address of packed member of 'struct shm_marker' may result in an unaligned pointer value [-Werror=address-of-packed-member]
      198 |         pa_atomic_store(&marker->pid, (int) getpid());
          |                         ^~~~~~~~~~~~

The struct already has its fields and types laid out in such a way that
the desired packing (without padding) is guaranteed - enforce this with
a `static_assert` to get rid of the unaligned pointer warning.

Change-Id: I012f97f2df3248c0285a3b4f594ae218bc81385e
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/653>
src/pulsecore/shm.c