diff options
author | Janne Blomqvist <jb@gcc.gnu.org> | 2018-11-22 09:58:29 +0200 |
---|---|---|
committer | Janne Blomqvist <jb@gcc.gnu.org> | 2018-11-22 09:58:29 +0200 |
commit | 0536d5b37dd18b0eb9221ec9f55ca29585b43759 (patch) | |
tree | 1c47a0906545646e489776bb7192e076e86825f8 /libgfortran/config.h.in | |
parent | d8bcb00f21f21da751204a6d96ef70cb6b037b97 (diff) |
Replace sync builtins with atomic builtins
The old __sync builtins have been deprecated for a long time now in
favor of the __atomic builtins following the C++11/C11 memory model.
This patch converts libgfortran to use the modern __atomic builtins.
At the same time I weakened the consistency to relaxed for
incrementing and decrementing the counter, and acquire-release when
decrementing to check whether the counter is 0 and the unit can be
freed. This is similar to e.g. std::shared_ptr in C++.
Regtested on x86_64-pc-linux-gnu.
libgfortran/ChangeLog:
2018-11-22 Janne Blomqvist <jb@gcc.gnu.org>
* acinclude.m4 (LIBGFOR_CHECK_ATOMIC_FETCH_ADD): Rename and test
presence of atomic builtins instead of sync builtins.
* configure.ac (LIBGFOR_CHECK_ATOMIC_FETCH_ADD): Call new test.
* io/io.h (inc_waiting_locked): Use __atomic_fetch_add.
(predec_waiting_locked): Use __atomic_add_fetch.
(dec_waiting_unlocked): Use __atomic_fetch_add.
* config.h.in: Regenerated.
* configure: Regenerated.
* Makefile.in: Regenerated.
From-SVN: r266367
Diffstat (limited to 'libgfortran/config.h.in')
-rw-r--r-- | libgfortran/config.h.in | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libgfortran/config.h.in b/libgfortran/config.h.in index f8f98246fd7..cbd720a2670 100644 --- a/libgfortran/config.h.in +++ b/libgfortran/config.h.in @@ -72,6 +72,9 @@ /* Define to 1 if you have the `atanl' function. */ #undef HAVE_ATANL +/* Define to 1 if the target supports __atomic_fetch_add */ +#undef HAVE_ATOMIC_FETCH_ADD + /* Define to 1 if the target supports __attribute__((alias(...))). */ #undef HAVE_ATTRIBUTE_ALIAS @@ -741,9 +744,6 @@ /* Define to 1 if you have the `symlink' function. */ #undef HAVE_SYMLINK -/* Define to 1 if the target supports __sync_fetch_and_add */ -#undef HAVE_SYNC_FETCH_AND_ADD - /* Define to 1 if you have the <sys/random.h> header file. */ #undef HAVE_SYS_RANDOM_H |