Projects
openEuler:24.03:SP1:Everything
nspr
_service:tar_scm:nspr-gcc-atomics.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:nspr-gcc-atomics.patch of Package nspr
diff --git a/nspr/pr/include/md/_linux.h b/nspr/pr/include/md/_linux.h index ad57d08..57877b8 100644 --- a/nspr/pr/include/md/_linux.h +++ b/nspr/pr/include/md/_linux.h @@ -105,6 +105,15 @@ #endif #if defined(__i386__) +#if defined(__GNUC__) +/* Use GCC built-in functions */ +#define _PR_HAVE_ATOMIC_OPS +#define _MD_INIT_ATOMIC() +#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1) +#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1) +#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i) +#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv) +#else #define _PR_HAVE_ATOMIC_OPS #define _MD_INIT_ATOMIC() extern PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val); @@ -116,6 +125,7 @@ extern PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val); extern PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval); #define _MD_ATOMIC_SET _PR_x86_AtomicSet #endif +#endif #if defined(__ia64__) #define _PR_HAVE_ATOMIC_OPS @@ -131,6 +141,15 @@ extern PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval); #endif #if defined(__x86_64__) +#if defined(__GNUC__) +/* Use GCC built-in functions */ +#define _PR_HAVE_ATOMIC_OPS +#define _MD_INIT_ATOMIC() +#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1) +#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1) +#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i) +#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv) +#else #define _PR_HAVE_ATOMIC_OPS #define _MD_INIT_ATOMIC() extern PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val); @@ -142,6 +161,7 @@ extern PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val); extern PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval); #define _MD_ATOMIC_SET _PR_x86_64_AtomicSet #endif +#endif #if defined(__loongarch__) #if defined(__GNUC__) -- 2.32.1 (Apple Git-133)
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2