diff options
author | Bruno Haible <bruno@clisp.org> | 2019-12-11 10:05:27 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-12-11 11:38:52 +0100 |
commit | cc6745d8accfa37b8ed48a4ea4220ae80fb7f3bd (patch) | |
tree | aa89c7354b791c262ecc98c727d1fb17cf00f33d | |
parent | 47bfe0ab18ebdc74c10e9625c27d0c89a369f512 (diff) | |
download | gnulib-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-- | ChangeLog | 8 | ||||
-rw-r--r-- | lib/locale.in.h | 12 | ||||
-rw-r--r-- | m4/locale_h.m4 | 17 |
3 files changed, 35 insertions, 2 deletions
@@ -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. |