summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-12-11 10:05:27 +0100
committerBruno Haible <bruno@clisp.org>2019-12-11 11:38:52 +0100
commitcc6745d8accfa37b8ed48a4ea4220ae80fb7f3bd (patch)
treeaa89c7354b791c262ecc98c727d1fb17cf00f33d
parent47bfe0ab18ebdc74c10e9625c27d0c89a369f512 (diff)
downloadgnulib-cc6745d8accfa37b8ed48a4ea4220ae80fb7f3bd.tar.gz
gnulib-cc6745d8accfa37b8ed48a4ea4220ae80fb7f3bd.tar.bz2
locale: Fix compilation error in C++ mode on MSVC.
* m4/locale_h.m4 (gl_LOCALE_H): Don't set REPLACE_STRUCT_LCONV on MSVC. * lib/locale.in.h (int_p_cs_precedes, int_p_sign_posn, int_p_sep_by_space, int_n_cs_precedes, int_n_sign_posn, int_n_sep_by_space): Define as macros on MSVC.
-rw-r--r--ChangeLog8
-rw-r--r--lib/locale.in.h12
-rw-r--r--m4/locale_h.m417
3 files changed, 35 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b00316dca..ef6280b014 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2019-12-11 Bruno Haible <bruno@clisp.org>
+ locale: Fix compilation error in C++ mode on MSVC.
+ * m4/locale_h.m4 (gl_LOCALE_H): Don't set REPLACE_STRUCT_LCONV on MSVC.
+ * lib/locale.in.h (int_p_cs_precedes, int_p_sign_posn,
+ int_p_sep_by_space, int_n_cs_precedes, int_n_sign_posn,
+ int_n_sep_by_space): Define as macros on MSVC.
+
+2019-12-11 Bruno Haible <bruno@clisp.org>
+
wchar: Fix compilation error in C++ mode on MSVC.
* lib/wchar.in.h (mbstate_t): Don't override on MSVC.
diff --git a/lib/locale.in.h b/lib/locale.in.h
index 918d4dd2bd..77b8b3ba91 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -64,6 +64,18 @@
# define LC_MESSAGES 1729
#endif
+/* On native Windows with MSVC, 'struct lconv' lacks the members int_p_* and
+ int_n_*. Instead of overriding 'struct lconv', merely define these member
+ names as macros. This avoids trouble in C++ mode. */
+#if defined _MSC_VER
+# define int_p_cs_precedes p_cs_precedes
+# define int_p_sign_posn p_sign_posn
+# define int_p_sep_by_space p_sep_by_space
+# define int_n_cs_precedes n_cs_precedes
+# define int_n_sign_posn n_sign_posn
+# define int_n_sep_by_space n_sep_by_space
+#endif
+
/* Bionic libc's 'struct lconv' is just a dummy. */
#if @REPLACE_STRUCT_LCONV@
# define lconv rpl_lconv
diff --git a/m4/locale_h.m4 b/m4/locale_h.m4
index 380e40b00e..c0ec3fc808 100644
--- a/m4/locale_h.m4
+++ b/m4/locale_h.m4
@@ -1,4 +1,4 @@
-# locale_h.m4 serial 22
+# locale_h.m4 serial 23
dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -56,7 +56,20 @@ AC_DEFUN([gl_LOCALE_H],
[gl_cv_sys_struct_lconv_ok=no])
])
if test $gl_cv_sys_struct_lconv_ok = no; then
- REPLACE_STRUCT_LCONV=1
+ dnl On native Windows with MSVC, merely define these member names as macros.
+ dnl This avoids trouble in C++ mode.
+ case "$host_os" in
+ mingw*)
+ AC_EGREP_CPP([Special], [
+#ifdef _MSC_VER
+ Special
+#endif
+ ],
+ [],
+ [REPLACE_STRUCT_LCONV=1])
+ ;;
+ *) REPLACE_STRUCT_LCONV=1 ;;
+ esac
fi
dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK.

Return to:

Send suggestions and report system problems to the System administrator.