1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Use __atomic_load_n() and __atomic_store_n() for a few more things where they are available.

FossilOrigin-Name: a49f8ec552bede7da731e0571ccf49de1a30e7be3a5673150436c8b411ba6ffc
This commit is contained in:
dan
2020-03-30 13:35:05 +00:00
parent 3e42b99175
commit 892edb69c4
11 changed files with 44 additions and 41 deletions

View File

@@ -186,6 +186,21 @@
#pragma warn -spa /* Suspicious pointer arithmetic */
#endif
/*
** WAL mode depends on atomic aligned 32-bit loads and stores in a few
** places. The following macros try to make this explicit.
*/
#ifndef __has_feature
# define __has_feature(x) 0 /* compatibility with non-clang compilers */
#endif
#if GCC_VERSION>=4007000 || __has_feature(c_atomic)
# define AtomicLoad(PTR) __atomic_load_n((PTR),__ATOMIC_RELAXED)
# define AtomicStore(PTR,VAL) __atomic_store_n((PTR),(VAL),__ATOMIC_RELAXED)
#else
# define AtomicLoad(PTR) (*(PTR))
# define AtomicStore(PTR,VAL) (*(PTR) = (VAL))
#endif
/*
** Include standard header files as necessary
*/