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.pull/845/head
| @@ -122,7 +122,7 @@ class JackAtomicArrayState | |||||
| // fState[2] ==> request | // fState[2] ==> request | ||||
| T fState[3]; | T fState[3]; | ||||
| alignas(UInt32) volatile AtomicArrayCounter fCounter; | |||||
| alignas(UInt32) alignas(AtomicArrayCounter) volatile AtomicArrayCounter fCounter; | |||||
| UInt32 WriteNextStateStartAux(int state, bool* result) | UInt32 WriteNextStateStartAux(int state, bool* result) | ||||
| { | { | ||||
| @@ -94,7 +94,7 @@ class JackAtomicState | |||||
| protected: | protected: | ||||
| T fState[2]; | T fState[2]; | ||||
| alignas(UInt32) volatile AtomicCounter fCounter; | |||||
| alignas(UInt32) alignas(AtomicCounter) volatile AtomicCounter fCounter; | |||||
| SInt32 fCallWriteCounter; | SInt32 fCallWriteCounter; | ||||
| UInt32 WriteNextStateStartAux() | UInt32 WriteNextStateStartAux() | ||||
| @@ -417,7 +417,7 @@ class SERVER_EXPORT JackConnectionManager | |||||
| JackFixedArray1<PORT_NUM_FOR_CLIENT> fInputPort[CLIENT_NUM]; /*! Table of input port per refnum : to find a refnum for a given port */ | JackFixedArray1<PORT_NUM_FOR_CLIENT> fInputPort[CLIENT_NUM]; /*! Table of input port per refnum : to find a refnum for a given port */ | ||||
| JackFixedArray<PORT_NUM_FOR_CLIENT> fOutputPort[CLIENT_NUM]; /*! Table of output port per refnum : to find a refnum for a given port */ | JackFixedArray<PORT_NUM_FOR_CLIENT> fOutputPort[CLIENT_NUM]; /*! Table of output port per refnum : to find a refnum for a given port */ | ||||
| JackFixedMatrix<CLIENT_NUM> fConnectionRef; /*! Table of port connections by (refnum , refnum) */ | JackFixedMatrix<CLIENT_NUM> fConnectionRef; /*! Table of port connections by (refnum , refnum) */ | ||||
| alignas(UInt32) JackActivationCount fInputCounter[CLIENT_NUM]; /*! Activation counter per refnum */ | |||||
| alignas(UInt32) alignas(JackActivationCount) JackActivationCount fInputCounter[CLIENT_NUM]; /*! Activation counter per refnum */ | |||||
| JackLoopFeedback<CONNECTION_NUM_FOR_PORT> fLoopFeedback; /*! Loop feedback connections */ | JackLoopFeedback<CONNECTION_NUM_FOR_PORT> fLoopFeedback; /*! Loop feedback connections */ | ||||
| bool IsLoopPathAux(int ref1, int ref2) const; | bool IsLoopPathAux(int ref1, int ref2) const; | ||||
| @@ -64,7 +64,7 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem | |||||
| int fClientPriority; | int fClientPriority; | ||||
| int fMaxClientPriority; | int fMaxClientPriority; | ||||
| char fServerName[JACK_SERVER_NAME_SIZE+1]; | char fServerName[JACK_SERVER_NAME_SIZE+1]; | ||||
| alignas(UInt32) JackTransportEngine fTransport; | |||||
| alignas(UInt32) alignas(JackTransportEngine) JackTransportEngine fTransport; | |||||
| jack_timer_type_t fClockSource; | jack_timer_type_t fClockSource; | ||||
| int fDriverNum; | int fDriverNum; | ||||
| bool fVerbose; | bool fVerbose; | ||||
| @@ -86,7 +86,7 @@ struct SERVER_EXPORT JackEngineControl : public JackShmMem | |||||
| UInt64 fConstraint; | UInt64 fConstraint; | ||||
| // Timer | // Timer | ||||
| alignas(UInt32) JackFrameTimer fFrameTimer; | |||||
| alignas(UInt32) alignas(JackFrameTimer) JackFrameTimer fFrameTimer; | |||||
| #ifdef JACK_MONITOR | #ifdef JACK_MONITOR | ||||
| JackEngineProfiling fProfiler; | JackEngineProfiling fProfiler; | ||||