gcc/libgfortran/io
Janne Blomqvist 0536d5b37d 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
2018-11-22 09:58:29 +02:00
..
async.c re PR fortran/25829 ([F03] Asynchronous IO support) 2018-08-21 18:48:59 +00:00
async.h * io/async.h: Use __gthread_mutex_t, not pthread_mutex_t. 2018-09-05 10:28:45 +00:00
close.c * io/close.c [!HAVE_UNLINK_OPEN_FILE]: Include <string.h>. 2018-10-02 20:02:03 +00:00
fbuf.c
fbuf.h
file_pos.c re PR fortran/25829 ([F03] Asynchronous IO support) 2018-08-21 18:48:59 +00:00
format.c io.h: Change declaration of vlist type to gfc_full_array_i4 to eliminate warning for... 2018-09-02 15:55:51 +00:00
format.h io.h: Change declaration of vlist type to gfc_full_array_i4 to eliminate warning for... 2018-09-02 15:55:51 +00:00
inquire.c re PR fortran/25829 ([F03] Asynchronous IO support) 2018-08-21 18:48:59 +00:00
intrinsics.c
io.h Replace sync builtins with atomic builtins 2018-11-22 09:58:29 +02:00
list_read.c gfortran.h (gfc_dt): Rename default_exp field to dec_ext. 2018-03-28 13:59:06 +02:00
lock.c
open.c re PR fortran/25829 ([F03] Asynchronous IO support) 2018-08-21 18:48:59 +00:00
read.c re PR fortran/25829 ([F03] Asynchronous IO support) 2018-08-21 18:48:59 +00:00
size_from_kind.c
transfer128.c
transfer.c re PR fortran/78351 (comma not terminating READ of formatted input field - ok in 4.1.7, not 4.4.7- maybe related to 25419?) 2018-11-09 17:29:33 +00:00
unit.c re PR fortran/25829 ([F03] Asynchronous IO support) 2018-08-21 18:48:59 +00:00
unix.c Use gfc_charlen_type instead of int for string lenghts 2018-10-06 21:21:00 +03:00
unix.h Use gfc_charlen_type instead of int for string lenghts 2018-10-06 21:21:00 +03:00
write_float.def re PR libfortran/86070 (gfortran.dg/fmt_zero_digits.f90 segmentation fault starting with r261077) 2018-06-10 01:49:02 +00:00
write.c re PR fortran/85840 (Memory leak in write.c) 2018-05-28 21:55:31 +00:00