void-packages/srcpkgs/apr/patches/atomic64.patch
Đoàn Trần Công Danh ae69000001 srcpkgs/a*: convert patches to -Np1
* arduino and antiword is kept at -Np0

```sh

git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

56 lines
1.8 KiB
Diff

commit 69e9378eb86357d4361322256d5d5a39ff4a592d
Author: q66 <daniel@octaforge.org>
Date: Fri Jan 10 13:04:37 2020 +0100
use __atomic builtins instead of legacy __sync
This allows for 64-bit atomic ops on platforms that don't natively
support them such as armv6 and ppc32.
diff --git atomic/unix/builtins64.c atomic/unix/builtins64.c
index 4a4b685..90b5c5e 100644
--- a/atomic/unix/builtins64.c
+++ b/atomic/unix/builtins64.c
@@ -30,35 +30,34 @@ APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val)
APR_DECLARE(apr_uint64_t) apr_atomic_add64(volatile apr_uint64_t *mem, apr_uint64_t val)
{
- return __sync_fetch_and_add(mem, val);
+ return __atomic_fetch_add(mem, val, __ATOMIC_SEQ_CST);
}
APR_DECLARE(void) apr_atomic_sub64(volatile apr_uint64_t *mem, apr_uint64_t val)
{
- __sync_fetch_and_sub(mem, val);
+ __atomic_fetch_sub(mem, val, __ATOMIC_SEQ_CST);
}
APR_DECLARE(apr_uint64_t) apr_atomic_inc64(volatile apr_uint64_t *mem)
{
- return __sync_fetch_and_add(mem, 1);
+ return __atomic_fetch_add(mem, 1, __ATOMIC_SEQ_CST);
}
APR_DECLARE(int) apr_atomic_dec64(volatile apr_uint64_t *mem)
{
- return __sync_sub_and_fetch(mem, 1);
+ return (int)__atomic_sub_fetch(mem, 1, __ATOMIC_SEQ_CST);
}
APR_DECLARE(apr_uint64_t) apr_atomic_cas64(volatile apr_uint64_t *mem, apr_uint64_t with,
apr_uint64_t cmp)
{
- return __sync_val_compare_and_swap(mem, cmp, with);
+ __atomic_compare_exchange_n(mem, &cmp, with, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+ return cmp;
}
APR_DECLARE(apr_uint64_t) apr_atomic_xchg64(volatile apr_uint64_t *mem, apr_uint64_t val)
{
- __sync_synchronize();
-
- return __sync_lock_test_and_set(mem, val);
+ return __atomic_exchange_n(mem, val, __ATOMIC_SEQ_CST);
}
#endif /* USE_ATOMICS_BUILTINS */