aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/io.h
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2014-11-10 02:17:16 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2014-11-10 02:17:16 +0200
commit9cbecd06be8bba398595990b0ecb4156d4a19aad (patch)
tree632705719333408c765e7eddf68dc9b1418b8854 /libgfortran/io/io.h
parentf8df4b4e2b524b2f35fe93dd935c175c495a7fd0 (diff)
downloadgcc-9cbecd06be8bba398595990b0ecb4156d4a19aad.zip
gcc-9cbecd06be8bba398595990b0ecb4156d4a19aad.tar.gz
gcc-9cbecd06be8bba398595990b0ecb4156d4a19aad.tar.bz2
PR 47007 and 61847 Locale failures in libgfortran.
2014-11-10 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/47007 PR libfortran/61847 * config.h.in: Regenerated. * configure: Regenerated. * configure.ac (AC_CHECK_HEADERS_ONCE): Check for xlocale.h. (AC_CHECK_FUNCS_ONCE): Check for newlocale, freelocale, uselocale, strerror_l. * io/io.h (locale.h): Include. (xlocale.h): Include if present. (c_locale): New variable. (old_locale): New variable. (old_locale_ctr): New variable. (old_locale_lock): New variable. (st_parameter_dt): Add old_locale member. * io/transfer.c (data_transfer_init): Set locale to "C" if doing formatted transfer. (finalize_transfer): Reset locale to previous. * io/unit.c (c_locale): New variable. (old_locale): New variable. (old_locale_ctr): New variable. (old_locale_lock): New variable. (init_units): Init c_locale, init old_locale_lock. (close_units): Free c_locale. * runtime/error.c (locale.h): Include. (xlocale.h): Include if present. (gf_strerror): Use strerror_l if available. Reset locale to LC_GLOBAL_LOCALE for strerror_r branch. 2014-11-10 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/47007 PR libfortran/61847 * gfortran.texi: Add note about locale issues to thread-safety section. From-SVN: r217273
Diffstat (limited to 'libgfortran/io/io.h')
-rw-r--r--libgfortran/io/io.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index 1e0d092..a75177f 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -32,6 +32,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include <gthr.h>
+
+/* POSIX 2008 specifies that the extended locale stuff is found in
+ locale.h, but some systems have them in xlocale.h. */
+
+#include <locale.h>
+
+#ifdef HAVE_XLOCALE_H
+#include <xlocale.h>
+#endif
+
+
/* Forward declarations. */
struct st_parameter_dt;
typedef struct stream stream;
@@ -40,6 +51,19 @@ struct format_data;
typedef struct fnode fnode;
struct gfc_unit;
+#ifdef HAVE_NEWLOCALE
+/* We have POSIX 2008 extended locale stuff. */
+extern locale_t c_locale;
+internal_proto(c_locale);
+#else
+extern char* old_locale;
+internal_proto(old_locale);
+extern int old_locale_ctr;
+internal_proto(old_locale_ctr);
+extern __gthread_mutex_t old_locale_lock;
+internal_proto(old_locale_lock);
+#endif
+
/* Macros for testing what kinds of I/O we are doing. */
@@ -450,6 +474,9 @@ typedef struct st_parameter_dt
char *line_buffer;
struct format_data *fmt;
namelist_info *ionml;
+#ifdef HAVE_NEWLOCALE
+ locale_t old_locale;
+#endif
/* Current position within the look-ahead line buffer. */
int line_buffer_pos;
/* Storage area for values except for strings. Must be