Cross-Platform build scripts for audio plugins
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
5.0KB

  1. http://www.databaseusers.com/article/6047407/Bug%3A+Build+failure+on+Linux+with+clang+libc%2B%2B+(atomic+issues)
  2. https://gist.githubusercontent.com/LnL7/5153b251fd525fe15de69b67e63a6075/raw/7778e9364679093a32dec2908656738e16b6bdcb/clang.patch
  3. diff --git src/dbinc/atomic.h src/dbinc/atomic.h
  4. index 6a858f7..9f338dc 100644
  5. --- a/src/dbinc/atomic.h
  6. +++ b/src/dbinc/atomic.h
  7. @@ -70,7 +70,7 @@ typedef struct {
  8. * These have no memory barriers; the caller must include them when necessary.
  9. */
  10. #define atomic_read(p) ((p)->value)
  11. -#define atomic_init(p, val) ((p)->value = (val))
  12. +#define atomic_init_db(p, val) ((p)->value = (val))
  13. #ifdef HAVE_ATOMIC_SUPPORT
  14. @@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val;
  15. #define atomic_inc(env, p) __atomic_inc(p)
  16. #define atomic_dec(env, p) __atomic_dec(p)
  17. #define atomic_compare_exchange(env, p, o, n) \
  18. - __atomic_compare_exchange((p), (o), (n))
  19. + __atomic_compare_exchange_db((p), (o), (n))
  20. static inline int __atomic_inc(db_atomic_t *p)
  21. {
  22. int temp;
  23. @@ -176,7 +176,7 @@ static inline int __atomic_dec(db_atomic_t *p)
  24. * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
  25. * which configure could be changed to use.
  26. */
  27. -static inline int __atomic_compare_exchange(
  28. +static inline int __atomic_compare_exchange_db(
  29. db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
  30. {
  31. atomic_value_t was;
  32. @@ -206,7 +206,7 @@ static inline int __atomic_compare_exchange(
  33. #define atomic_dec(env, p) (--(p)->value)
  34. #define atomic_compare_exchange(env, p, oldval, newval) \
  35. (DB_ASSERT(env, atomic_read(p) == (oldval)), \
  36. - atomic_init(p, (newval)), 1)
  37. + atomic_init_db(p, (newval)), 1)
  38. #else
  39. #define atomic_inc(env, p) __atomic_inc(env, p)
  40. #define atomic_dec(env, p) __atomic_dec(env, p)
  41. diff --git src/mp/mp_fget.c src/mp/mp_fget.c
  42. index 16de695..d0dcc29 100644
  43. --- a/src/mp/mp_fget.c
  44. +++ b/src/mp/mp_fget.c
  45. @@ -649,7 +649,7 @@ alloc: /* Allocate a new buffer header and data space. */
  46. /* Initialize enough so we can call __memp_bhfree. */
  47. alloc_bhp->flags = 0;
  48. - atomic_init(&alloc_bhp->ref, 1);
  49. + atomic_init_db(&alloc_bhp->ref, 1);
  50. #ifdef DIAGNOSTIC
  51. if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
  52. __db_errx(env, DB_STR("3025",
  53. @@ -955,7 +955,7 @@ alloc: /* Allocate a new buffer header and data space. */
  54. MVCC_MPROTECT(bhp->buf, mfp->pagesize,
  55. PROT_READ);
  56. - atomic_init(&alloc_bhp->ref, 1);
  57. + atomic_init_db(&alloc_bhp->ref, 1);
  58. MUTEX_LOCK(env, alloc_bhp->mtx_buf);
  59. alloc_bhp->priority = bhp->priority;
  60. alloc_bhp->pgno = bhp->pgno;
  61. diff --git src/mp/mp_mvcc.c src/mp/mp_mvcc.c
  62. index 770bad8..e28cce0 100644
  63. --- a/src/mp/mp_mvcc.c
  64. +++ b/src/mp/mp_mvcc.c
  65. @@ -276,7 +276,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
  66. #else
  67. memcpy(frozen_bhp, bhp, SSZA(BH, buf));
  68. #endif
  69. - atomic_init(&frozen_bhp->ref, 0);
  70. + atomic_init_db(&frozen_bhp->ref, 0);
  71. if (mutex != MUTEX_INVALID)
  72. frozen_bhp->mtx_buf = mutex;
  73. else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
  74. @@ -428,7 +428,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp)
  75. #endif
  76. alloc_bhp->mtx_buf = mutex;
  77. MUTEX_LOCK(env, alloc_bhp->mtx_buf);
  78. - atomic_init(&alloc_bhp->ref, 1);
  79. + atomic_init_db(&alloc_bhp->ref, 1);
  80. F_CLR(alloc_bhp, BH_FROZEN);
  81. }
  82. diff --git src/mp/mp_region.c src/mp/mp_region.c
  83. index 4952030..47645f8 100644
  84. --- a/src/mp/mp_region.c
  85. +++ b/src/mp/mp_region.c
  86. @@ -245,7 +245,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
  87. MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
  88. return (ret);
  89. SH_TAILQ_INIT(&htab[i].hash_bucket);
  90. - atomic_init(&htab[i].hash_page_dirty, 0);
  91. + atomic_init_db(&htab[i].hash_page_dirty, 0);
  92. }
  93. /*
  94. @@ -302,7 +302,7 @@ no_prealloc:
  95. } else
  96. hp->mtx_hash = mtx_base + (i % dbenv->mp_mtxcount);
  97. SH_TAILQ_INIT(&hp->hash_bucket);
  98. - atomic_init(&hp->hash_page_dirty, 0);
  99. + atomic_init_db(&hp->hash_page_dirty, 0);
  100. #ifdef HAVE_STATISTICS
  101. hp->hash_io_wait = 0;
  102. hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
  103. diff --git src/mutex/mut_method.c src/mutex/mut_method.c
  104. index 09353b0..177353c 100644
  105. --- a/src/mutex/mut_method.c
  106. +++ b/src/mutex/mut_method.c
  107. @@ -474,7 +474,7 @@ atomic_compare_exchange(env, v, oldval, newval)
  108. MUTEX_LOCK(env, mtx);
  109. ret = atomic_read(v) == oldval;
  110. if (ret)
  111. - atomic_init(v, newval);
  112. + atomic_init_db(v, newval);
  113. MUTEX_UNLOCK(env, mtx);
  114. return (ret);
  115. diff --git src/mutex/mut_tas.c src/mutex/mut_tas.c
  116. index 106b161..fc4de9d 100644
  117. --- a/src/mutex/mut_tas.c
  118. +++ b/src/mutex/mut_tas.c
  119. @@ -47,7 +47,7 @@ __db_tas_mutex_init(env, mutex, flags)
  120. #ifdef HAVE_SHARED_LATCHES
  121. if (F_ISSET(mutexp, DB_MUTEX_SHARED))
  122. - atomic_init(&mutexp->sharecount, 0);
  123. + atomic_init_db(&mutexp->sharecount, 0);
  124. else
  125. #endif
  126. if (MUTEX_INIT(&mutexp->tas)) {
  127. @@ -536,7 +536,7 @@ __db_tas_mutex_unlock(env, mutex)
  128. F_CLR(mutexp, DB_MUTEX_LOCKED);
  129. /* Flush flag update before zeroing count */
  130. MEMBAR_EXIT();
  131. - atomic_init(&mutexp->sharecount, 0);
  132. + atomic_init_db(&mutexp->sharecount, 0);
  133. } else {
  134. DB_ASSERT(env, sharecount > 0);
  135. MEMBAR_EXIT();