Skip to content

Commit 66c4c87

Browse files
committed
[Runtime] Android does not support constexpr
As with Cygwin, Android must not use `constexpr` for pthread initializers.
1 parent c65acf0 commit 66c4c87

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/swift/Runtime/MutexPThread.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ typedef pthread_cond_t ConditionHandle;
2626
typedef pthread_mutex_t MutexHandle;
2727
typedef pthread_rwlock_t ReadWriteLockHandle;
2828

29-
#if defined(__CYGWIN__)
29+
#if defined(__CYGWIN__) || defined(__ANDROID__)
3030
// At the moment CYGWIN pthreads implementation doesn't support the use of
3131
// constexpr for static allocation versions. The way they define things
32-
// results in a reinterpret_cast which violates constexpr.
32+
// results in a reinterpret_cast which violates constexpr. Similarly, Android's
33+
// pthread implementation makes use of volatile attributes that prevent it from
34+
// being marked as constexpr.
3335
#define CONDITION_SUPPORTS_CONSTEXPR 0
3436
#define MUTEX_SUPPORTS_CONSTEXPR 0
3537
#define READWRITELOCK_SUPPORTS_CONSTEXPR 0

0 commit comments

Comments
 (0)