gcc/libgfortran/io
Maciej W. Rozycki beb9afcaf1 libgfortran: Verify the presence of all functions for POSIX 2008 locale
While we have `configure' checks for the individual POSIX 2008 extended
locale functions we refer to and use to guard the respective call sites,
we only verify the presence of `newlocale' for our global feature enable
check.  Consequently compilation fails for targets like NetBSD that only
have partial support for POSIX 2008 locale features and in particular
lack the `uselocale' function:

.../libgfortran/io/transfer.c: In function 'data_transfer_init_worker':
.../libgfortran/io/transfer.c:3416:30: error:
'old_locale_lock' undeclared (first use in this function)
 3416 |       __gthread_mutex_lock (&old_locale_lock);
      |                              ^~~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:3416:30: note: each undeclared identifier is reported only once for each function it appears in
.../libgfortran/io/transfer.c:3417:12: error:
'old_locale_ctr' undeclared (first use in this function)
 3417 |       if (!old_locale_ctr++)
      |            ^~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:3419:11: error:
'old_locale' undeclared (first use in this function); did you mean 'c_locale'?
 3419 |           old_locale = setlocale (LC_NUMERIC, NULL);
      |           ^~~~~~~~~~
      |           c_locale
.../libgfortran/io/transfer.c: In function 'finalize_transfer':
.../libgfortran/io/transfer.c:4253:26: error:
'old_locale_lock' undeclared (first use in this function)
 4253 |   __gthread_mutex_lock (&old_locale_lock);
      |                          ^~~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:4254:10: error:
'old_locale_ctr' undeclared (first use in this function)
 4254 |   if (!--old_locale_ctr)
      |          ^~~~~~~~~~~~~~
.../libgfortran/io/transfer.c:4256:30: error:
'old_locale' undeclared (first use in this function); did you mean 'c_locale'?
 4256 |       setlocale (LC_NUMERIC, old_locale);
      |                              ^~~~~~~~~~
      |                              c_locale
make[3]: *** [Makefile:6221: transfer.lo] Error 1

Only enable the use of POSIX 2008 extended locale features then when all
the three functions required are present, removing said build errors.

	libgfortran/
	* io/io.h [HAVE_NEWLOCALE]: Also check for HAVE_FREELOCALE and
	HAVE_USELOCALE.
	[HAVE_FREELOCALE && HAVE_NEWLOCALE && HAVE_USELOCALE]
	(HAVE_POSIX_2008_LOCALE): New macro.
	(st_parameter_dt) [HAVE_NEWLOCALE]: Check for
	HAVE_POSIX_2008_LOCALE instead.
	* io/transfer.c (data_transfer_init_worker, finalize_transfer)
	[HAVE_USELOCALE]: Check for HAVE_POSIX_2008_LOCALE instead.
	* io/unit.c [HAVE_NEWLOCALE]: Likewise.
	(init_units) [HAVE_NEWLOCALE]: Likewise.
	(close_units) [HAVE_FREELOCALE]: Likewise.
	* runtime/error.c (gf_strerror) [HAVE_USELOCALE]: Likewise.
2020-11-26 17:26:43 +00:00
..
async.c Fixes a hang on an invalid ID in a WAIT statement. 2020-05-23 19:01:43 +02:00
async.h Use au->lock exclusively for locking in async I/O. 2020-02-18 19:45:25 +01:00
close.c Add early return for invalid STATUS for close. 2020-05-14 18:33:24 +02:00
fbuf.c Update copyright years. 2020-01-01 12:51:42 +01:00
fbuf.h Update copyright years. 2020-01-01 12:51:42 +01:00
file_pos.c Update copyright years. 2020-01-01 12:51:42 +01:00
format.c Fortran : rejected f0.d edit descriptor PR96436 2020-08-20 07:40:55 +01:00
format.h Update copyright years. 2020-01-01 12:51:42 +01:00
inquire.c Update copyright years. 2020-01-01 12:51:42 +01:00
intrinsics.c Update copyright years. 2020-01-01 12:51:42 +01:00
io.h libgfortran: Verify the presence of all functions for POSIX 2008 locale 2020-11-26 17:26:43 +00:00
list_read.c Update copyright years. 2020-01-01 12:51:42 +01:00
lock.c Update copyright years. 2020-01-01 12:51:42 +01:00
open.c Update copyright years. 2020-01-01 12:51:42 +01:00
read.c Update copyright years. 2020-01-01 12:51:42 +01:00
size_from_kind.c Update copyright years. 2020-01-01 12:51:42 +01:00
transfer128.c Update copyright years. 2020-01-01 12:51:42 +01:00
transfer.c libgfortran: Verify the presence of all functions for POSIX 2008 locale 2020-11-26 17:26:43 +00:00
unit.c libgfortran: Verify the presence of all functions for POSIX 2008 locale 2020-11-26 17:26:43 +00:00
unix.c Update copyright years. 2020-01-01 12:51:42 +01:00
unix.h Update copyright years. 2020-01-01 12:51:42 +01:00
write_float.def PR 93567, G edit descriptor uses E instead of F editing in rounding mode UP. 2020-07-24 20:47:47 +02:00
write.c Disable -Wstringop-overflow warning after checking code path of caller. 2020-06-13 10:04:33 +02:00