Skip to content

Commit

Permalink
aix: guard STATIC_ASSERT for glibc work around
Browse files Browse the repository at this point in the history
On 64-bit AIX `sizeof(uv_sem_t)` is 4 bytes which is not large
enough to store a pointer. AIX doesn't use glibc so the work around
introduced by #1795 doesn't
apply, so guard the STATIC_ASSERT so that it is only used when the
custom semaphore implementation is used.

Refs: nodejs/node#20129
Refs: #1795
PR-URL: #1808
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
richardlau authored and cjihrig committed Apr 22, 2018
1 parent 4f77a23 commit 56220e5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/unix/thread.c
Expand Up @@ -449,7 +449,7 @@ static void glibc_version_check(void) {

#define platform_needs_custom_semaphore 1

#else /* !defined(__GLIBC__) */
#else /* !defined(__GLIBC__) && !defined(__MVS__) */

#define platform_needs_custom_semaphore 0

Expand All @@ -461,8 +461,9 @@ typedef struct uv_semaphore_s {
unsigned int value;
} uv_semaphore_t;


#if defined(__GLIBC__) || platform_needs_custom_semaphore
STATIC_ASSERT(sizeof(uv_sem_t) >= sizeof(uv_semaphore_t*));
#endif

static int uv__custom_sem_init(uv_sem_t* sem_, unsigned int value) {
int err;
Expand Down

0 comments on commit 56220e5

Please sign in to comment.