[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: locale: fix compilation error in C++ mode on MSVC
From: |
Gisle Vanem |
Subject: |
Re: locale: fix compilation error in C++ mode on MSVC |
Date: |
Thu, 12 Dec 2019 18:45:26 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
In https://lists.gnu.org/archive/html/bug-gnulib/2019-12/msg00050.html
Bruno Haible did this:
diff --git a/lib/locale.in.h b/lib/locale.in.h
index 918d4dd..77b8b3b 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -64,6 +64,18 @@
# define LC_MESSAGES 1729
#endif
+#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@
-----------
But with a 'REPLACE_STRUCT_LCONV=1', I get an error for
locale.h since there are now double up for all of these:
locale.h(162): error C2020: 'p_cs_precedes': 'struct' member redefinition
locale.h(164): error C2020: 'p_sign_posn': 'struct' member redefinition
locale.h(167): error C2020: 'p_sep_by_space': 'struct' member redefinition
locale.h(170): error C2020: 'n_cs_precedes': 'struct' member redefinition
locale.h(172): error C2020: 'n_sign_posn': 'struct' member redefinition
locale.h(175): error C2020: 'n_sep_by_space': 'struct' member redefinition
--------
I had to do a:
--- a/lib/locale.in.h 2019-12-12 16:30:12
+++ b/lib/locale.in.h 2019-12-12 17:09:16
@@ -138,6 +138,8 @@
char *int_curr_symbol;
/* Number of digits after the decimal point. */
char int_frac_digits;
+
+#ifndef _MSC_VER
/* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
comes after the number. */
char int_p_cs_precedes;
@@ -154,6 +156,7 @@
/* For values < 0: Placement of spaces between currency symbol, sign, and
number. */
char int_n_sep_by_space;
+#endif
};
#endif
for this mess to compile.
--
--gv