diff options
author | Florian Walpen <dev@submerge.ch> | 2022-02-02 00:58:53 +0100 |
---|---|---|
committer | Filipe Coelho <falktx@falktx.com> | 2022-02-08 18:59:46 +0000 |
commit | 21b293dbc37d42446141a08922cdec0d2550c6a0 (patch) | |
tree | 249829f7e7daf9431fecefeb88c413414a89c18f /common/JackAtomicState.h | |
parent | 3d681a3a9941233295f31a227b5d54a40f0373ca (diff) | |
download | jack2-21b293dbc37d42446141a08922cdec0d2550c6a0.tar.gz |
Fix alignas() on non-packed architectures (#839).
Unbreak the build with Clang on architectures where JACK uses non-packed
data structures, like arm64 or powerpc. The alignment errors are exposed
there because:
* The non-packed data structures require 8 byte alignment.
* alignas() is not allowed to weaken alignment requirements to 4 bytes.
* Clang enforces this according to standard, GCC ignores it.
Use an additional alignas() specifier to let the compiler choose between
minimum alignment (packed) and "natural" alignment (non-packed). This is
both standard c++11 and compatible with older GCC, which does not
propagate alignment requirements of packed substructures properly.
Diffstat (limited to 'common/JackAtomicState.h')
-rw-r--r-- | common/JackAtomicState.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/JackAtomicState.h b/common/JackAtomicState.h index 26d6a565..69c8316e 100644 --- a/common/JackAtomicState.h +++ b/common/JackAtomicState.h @@ -94,7 +94,7 @@ class JackAtomicState protected: T fState[2]; - alignas(UInt32) volatile AtomicCounter fCounter; + alignas(UInt32) alignas(AtomicCounter) volatile AtomicCounter fCounter; SInt32 fCallWriteCounter; UInt32 WriteNextStateStartAux() |