linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / libraries / db / clang-5.3.patch
blobcaf19ffeb92bf87fc1437d66057bf33d4ab96766
1 diff --git a/src/dbinc/atomic.h b/src/dbinc/atomic.h
2 index 6a858f7..9f338dc 100644
3 --- a/src/dbinc/atomic.h
4 +++ b/src/dbinc/atomic.h
5 @@ -70,7 +70,7 @@ typedef struct {
6 * These have no memory barriers; the caller must include them when necessary.
7 */
8 #define atomic_read(p) ((p)->value)
9 -#define atomic_init(p, val) ((p)->value = (val))
10 +#define atomic_init_db(p, val) ((p)->value = (val))
12 #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_int((p), (o), (n))
20 static inline int __atomic_inc(db_atomic_t *p)
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.
27 -static inline int __atomic_compare_exchange(
28 +static inline int __atomic_compare_exchange_int(
29 db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
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 a/src/mp/mp_fget.c b/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. */
47 /* Initialize enough so we can call __memp_bhfree. */
48 alloc_bhp->flags = 0;
49 - atomic_init(&alloc_bhp->ref, 1);
50 + atomic_init_db(&alloc_bhp->ref, 1);
51 #ifdef DIAGNOSTIC
52 if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
53 __db_errx(env, DB_STR("3025",
54 @@ -955,7 +955,7 @@ alloc: /* Allocate a new buffer header and data space. */
55 MVCC_MPROTECT(bhp->buf, mfp->pagesize,
56 PROT_READ);
58 - atomic_init(&alloc_bhp->ref, 1);
59 + atomic_init_db(&alloc_bhp->ref, 1);
60 MUTEX_LOCK(env, alloc_bhp->mtx_buf);
61 alloc_bhp->priority = bhp->priority;
62 alloc_bhp->pgno = bhp->pgno;
63 diff --git a/src/mp/mp_mvcc.c b/src/mp/mp_mvcc.c
64 index 770bad8..e28cce0 100644
65 --- a/src/mp/mp_mvcc.c
66 +++ b/src/mp/mp_mvcc.c
67 @@ -276,7 +276,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
68 #else
69 memcpy(frozen_bhp, bhp, SSZA(BH, buf));
70 #endif
71 - atomic_init(&frozen_bhp->ref, 0);
72 + atomic_init_db(&frozen_bhp->ref, 0);
73 if (mutex != MUTEX_INVALID)
74 frozen_bhp->mtx_buf = mutex;
75 else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
76 @@ -428,7 +428,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp)
77 #endif
78 alloc_bhp->mtx_buf = mutex;
79 MUTEX_LOCK(env, alloc_bhp->mtx_buf);
80 - atomic_init(&alloc_bhp->ref, 1);
81 + atomic_init_db(&alloc_bhp->ref, 1);
82 F_CLR(alloc_bhp, BH_FROZEN);
85 diff --git a/src/mp/mp_region.c b/src/mp/mp_region.c
86 index 4952030..47645f8 100644
87 --- a/src/mp/mp_region.c
88 +++ b/src/mp/mp_region.c
89 @@ -245,7 +245,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
90 MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
91 return (ret);
92 SH_TAILQ_INIT(&htab[i].hash_bucket);
93 - atomic_init(&htab[i].hash_page_dirty, 0);
94 + atomic_init_db(&htab[i].hash_page_dirty, 0);
98 @@ -302,7 +302,7 @@ no_prealloc:
99 } else
100 hp->mtx_hash = mtx_base + (i % dbenv->mp_mtxcount);
101 SH_TAILQ_INIT(&hp->hash_bucket);
102 - atomic_init(&hp->hash_page_dirty, 0);
103 + atomic_init_db(&hp->hash_page_dirty, 0);
104 #ifdef HAVE_STATISTICS
105 hp->hash_io_wait = 0;
106 hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
107 diff --git a/src/mutex/mut_method.c b/src/mutex/mut_method.c
108 index 09353b0..177353c 100644
109 --- a/src/mutex/mut_method.c
110 +++ b/src/mutex/mut_method.c
111 @@ -474,7 +474,7 @@ atomic_compare_exchange(env, v, oldval, newval)
112 MUTEX_LOCK(env, mtx);
113 ret = atomic_read(v) == oldval;
114 if (ret)
115 - atomic_init(v, newval);
116 + atomic_init_db(v, newval);
117 MUTEX_UNLOCK(env, mtx);
119 return (ret);
120 diff --git a/src/mutex/mut_tas.c b/src/mutex/mut_tas.c
121 index 106b161..fc4de9d 100644
122 --- a/src/mutex/mut_tas.c
123 +++ b/src/mutex/mut_tas.c
124 @@ -47,7 +47,7 @@ __db_tas_mutex_init(env, mutex, flags)
126 #ifdef HAVE_SHARED_LATCHES
127 if (F_ISSET(mutexp, DB_MUTEX_SHARED))
128 - atomic_init(&mutexp->sharecount, 0);
129 + atomic_init_db(&mutexp->sharecount, 0);
130 else
131 #endif
132 if (MUTEX_INIT(&mutexp->tas)) {
133 @@ -536,7 +536,7 @@ __db_tas_mutex_unlock(env, mutex)
134 F_CLR(mutexp, DB_MUTEX_LOCKED);
135 /* Flush flag update before zeroing count */
136 MEMBAR_EXIT();
137 - atomic_init(&mutexp->sharecount, 0);
138 + atomic_init_db(&mutexp->sharecount, 0);
139 } else {
140 DB_ASSERT(env, sharecount > 0);
141 MEMBAR_EXIT();