Skip to content

Commit 84f6f33

Browse files
committed
Simplify 'HAVE_ALIGNED_ALLOC' preprocessor
1 parent 72dbcd2 commit 84f6f33

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

compiler-rt/test/tsan/free_race_aligned_alloc.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@
55

66
#include <stdlib.h>
77

8-
#if defined(__cplusplus) && (__cplusplus >= 201703L)
9-
# define HAVE_ALIGNED_ALLOC 1
8+
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
9+
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500
10+
# define MACOS_VERSION_AT_LEAST_10_15 1
11+
#else
12+
# define MACOS_VERSION_AT_LEAST_10_15 0
1013
#endif
1114

12-
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
13-
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500
14-
# define HAVE_ALIGNED_ALLOC 0
15+
#if defined(__cplusplus) && (__cplusplus >= 201703L) && \
16+
(!defined(__apple__) || MACOS_VERSION_AT_LEAST_10_15)
17+
# define HAVE_ALIGNED_ALLOC 1
1518
#else
19+
# define HAVE_ALIGNED_ALLOC 0
1620
#endif
1721

1822
int *mem;

0 commit comments

Comments
 (0)