[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] wctype-h: fix rpl_towupper/rpl_towlower link error on mingw
From: |
Daiki Ueno |
Subject: |
[PATCH] wctype-h: fix rpl_towupper/rpl_towlower link error on mingw |
Date: |
Wed, 27 Mar 2013 17:33:47 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
See
<https://lists.gnu.org/archive/html/bug-gettext/2013-03/msg00086.html>.
With the recent inline change, rpl_towlower/rpl_towupper are defined as
C99 extern inline. If there are declarations of those functions, GCC
reports "multiple definition" error.
On mingw (not mingw-w64, but http://mingw.org), towlower/towuppwer are
also declared in <ctype.h> as well as <wctype.h>, as follows:
/* Older MS docs uses wchar_t for arg and return type, while newer
online MS docs say arg is wint_t and return is int.
ISO C uses wint_t for both. */
_CRTIMP wint_t __cdecl __MINGW_NOTHROW towlower (wint_t);
_CRTIMP wint_t __cdecl __MINGW_NOTHROW towupper (wint_t);
When <ctype.h> is included after Gnulib's <wctype.h>, they will be
expanded to:
_CRTIMP wint_t __cdecl __MINGW_NOTHROW rpl_towlower (wint_t);
_CRTIMP wint_t __cdecl __MINGW_NOTHROW rpl_towupper (wint_t);
and causes "multiple definition" error.
I'm attaching a patch.
Regards,
--
Daiki Ueno
>From e23bbce242682524d7b52a8637c92482d9a8c2fd Mon Sep 17 00:00:00 2001
From: Daiki Ueno <address@hidden>
Date: Wed, 27 Mar 2013 17:16:46 +0900
Subject: [PATCH] wctype-h: fix gettext link error on mingw
Reported by Josue Andrade Gomes and Takayuki Tsunakawa in
<https://lists.gnu.org/archive/html/bug-gettext/2013-03/msg00086.html>.
* lib/wctype.in.h [__MINGW32__]: Include <ctype.h> before defining
rpl_towupper and rpl_towupper.
---
ChangeLog | 8 ++++++++
lib/wctype.in.h | 7 +++++++
2 files changed, 15 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 3843c33..d8b1ac1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-03-27 Daiki Ueno <address@hidden>
+
+ wctype-h: fix gettext link error on mingw
+ Reported by Josue Andrade Gomes and Takayuki Tsunakawa in
+ <https://lists.gnu.org/archive/html/bug-gettext/2013-03/msg00086.html>.
+ * lib/wctype.in.h [__MINGW32__]: Include <ctype.h> before defining
+ rpl_towupper and rpl_towupper.
+
2013-03-21 Paul Eggert <address@hidden>
sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index a465af2..660f23d 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -44,6 +44,13 @@
# include <wchar.h>
#endif
+/* mingw has declarations of towupper and towlower in <ctype.h> as
+ well <wctype.h>. Include <ctype.h> in advance to avoid rpl_ prefix
+ being added to the declarations. */
+#if __MINGW32__
+# include <ctype.h>
+#endif
+
/* Include the original <wctype.h> if it exists.
BeOS 5 has the functions but no <wctype.h>. */
/* The include_next requires a split double-inclusion guard. */
--
1.8.1.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] wctype-h: fix rpl_towupper/rpl_towlower link error on mingw,
Daiki Ueno <=