Skip to content
  • Marijn Suijten's avatar
    pulsecore/shm: Remove shm_marker struct packing for pa_atomic_t fields · add6e71e
    Marijn Suijten authored and Georg Chini's avatar Georg Chini committed
    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.
    Part-of: <!653>