From d87d598305bb07beaaf6d872a683ae749e8b1cc7 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Tue, 12 Mar 2024 12:22:34 +0100 Subject: [PATCH] [winpr] add WINPR_ALIGN64 defines Add defines to aling struct members to 8 bytes --- winpr/include/winpr/winpr.h | 10 +++++++ winpr/libwinpr/thread/thread.h | 48 ++++++++++++++-------------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/winpr/include/winpr/winpr.h b/winpr/include/winpr/winpr.h index 04311d8d7..a429c7a11 100644 --- a/winpr/include/winpr/winpr.h +++ b/winpr/include/winpr/winpr.h @@ -119,6 +119,16 @@ #define INLINE inline #endif +#if defined(__GNUC__) || defined(__clang__) +#define WINPR_ALIGN64 __attribute__((aligned(8))) +#else +#ifdef _WIN32 +#define WINPR_ALIGN64 __declspec(align(8)) +#else +#define WINPR_ALIGN64 +#endif +#endif + WINPR_API void winpr_get_version(int* major, int* minor, int* revision); WINPR_API const char* winpr_get_version_string(void); WINPR_API const char* winpr_get_build_revision(void); diff --git a/winpr/libwinpr/thread/thread.h b/winpr/libwinpr/thread/thread.h index aef9bc920..92d05d3ca 100644 --- a/winpr/libwinpr/thread/thread.h +++ b/winpr/libwinpr/thread/thread.h @@ -32,49 +32,39 @@ #include "../synch/event.h" #include "apc.h" -#ifdef __GNUC__ -#define ALIGN64 __attribute__((aligned(8))) -#else -#ifdef _WIN32 -#define ALIGN64 __declspec(align(8)) -#else -#define ALIGN64 -#endif -#endif - typedef void* (*pthread_start_routine)(void*); typedef struct winpr_APC_item WINPR_APC_ITEM; typedef struct { - ALIGN64 pthread_mutex_t mux; - ALIGN64 pthread_cond_t cond; - ALIGN64 BOOL val; + WINPR_ALIGN64 pthread_mutex_t mux; + WINPR_ALIGN64 pthread_cond_t cond; + WINPR_ALIGN64 BOOL val; } mux_condition_bundle; struct winpr_thread { WINPR_HANDLE common; - ALIGN64 BOOL started; - ALIGN64 WINPR_EVENT_IMPL event; - ALIGN64 BOOL mainProcess; - ALIGN64 BOOL detached; - ALIGN64 BOOL joined; - ALIGN64 BOOL exited; - ALIGN64 DWORD dwExitCode; - ALIGN64 pthread_t thread; - ALIGN64 SIZE_T dwStackSize; - ALIGN64 LPVOID lpParameter; - ALIGN64 pthread_mutex_t mutex; + WINPR_ALIGN64 BOOL started; + WINPR_ALIGN64 WINPR_EVENT_IMPL event; + WINPR_ALIGN64 BOOL mainProcess; + WINPR_ALIGN64 BOOL detached; + WINPR_ALIGN64 BOOL joined; + WINPR_ALIGN64 BOOL exited; + WINPR_ALIGN64 DWORD dwExitCode; + WINPR_ALIGN64 pthread_t thread; + WINPR_ALIGN64 SIZE_T dwStackSize; + WINPR_ALIGN64 LPVOID lpParameter; + WINPR_ALIGN64 pthread_mutex_t mutex; mux_condition_bundle isRunning; mux_condition_bundle isCreated; - ALIGN64 LPTHREAD_START_ROUTINE lpStartAddress; - ALIGN64 LPSECURITY_ATTRIBUTES lpThreadAttributes; - ALIGN64 APC_QUEUE apc; + WINPR_ALIGN64 LPTHREAD_START_ROUTINE lpStartAddress; + WINPR_ALIGN64 LPSECURITY_ATTRIBUTES lpThreadAttributes; + WINPR_ALIGN64 APC_QUEUE apc; #if defined(WITH_DEBUG_THREADS) - ALIGN64 void* create_stack; - ALIGN64 void* exit_stack; + WINPR_ALIGN64 void* create_stack; + WINPR_ALIGN64 void* exit_stack; #endif };