This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: [PATCH] codecvt.h
- To: libstdc++ at sources dot redhat dot com
- Subject: Re: [PATCH] codecvt.h
- From: David Edelsohn <dje at watson dot ibm dot com>
- Date: Mon, 06 Nov 2000 14:55:13 -0500
- cc: Ulrich Drepper <drepper at cygnus dot com>
>>>>> Phil Edwards writes:
David> Both AIX and Glibc declare the second argument to iconv() as
David> "const char **".
Uli> No. The code is correct as it is. Don't change anything.
Phil> Then... what /should/ be changed? The iconv()'s I see all take a second
Phil> argument of 'const char **'. The testsuites fail due to that mismatch:
Phil> /tec/build/Ebuild/include/g++-v3/bits/codecvt.h: In member function
Phil> `std::codecvt_base::result std::codecvt<_InternT, _ExternT,
Phil> std::__enc_traits>::do_out(std::__enc_traits&, const _InternT*, const
Phil> _InternT*, const _InternT*&, _ExternT*, _ExternT*, _ExternT*&) const [with
Phil> _InternT = int_type, _ExternT = ext_type]':
Phil> /tec/build/Ebuild/include/g++-v3/bits/localefwd.h:91: instantiated from here
Phil> /tec/build/Ebuild/include/g++-v3/bits/codecvt.h:412: cannot convert `char**' to
Phil> `const char**' for argument `2' to `size_t iconv(_iconv_info*, const char**,
Phil> size_t*, char**, size_t*)'
Phil> I don't mean to sound sarcastic or anything, but please explain what part
Phil> of this is correct code. As David wrote, the ChangeLogs show that the
Phil> const-ness flips back and forth.
glibc-2.1.97 iconv/iconv.h defines the second argument as
"char **", so that is what everyone must conform to, apparently.
Ulrich, is this change of declaration from the Austin Group or
from glibc? Is this some change in the standard outside of glibc?
The following fixincl patch addresses AIX, but we need to
generalize it to other OSes.
Index: inclhack.def
===================================================================
RCS file: /cvs/gcc/egcs/gcc/fixinc/inclhack.def,v
retrieving revision 1.93
diff -c -p -r1.93 inclhack.def
*** inclhack.def 2000/10/29 19:34:53 1.93
--- inclhack.def 2000/11/06 19:49:28
*************** fix = {
*** 576,581 ****
--- 576,595 ----
/*
+ * iconv.h on AIX 4.3.3 declares the second argument as const char **
+ * while GNU libc expects char **.
+ */
+ fix = {
+ hackname = aix_iconv;
+ files = "iconv.h";
+ select = 'iconv\(iconv_t, const char\*\*';
+ c_fix = format;
+ c_fix_arg = "iconv(iconv_t, char**";
+ test_text = "extern size_t iconv(iconv_t, const char**, size_t*, char**, size_t*);";
+ };
+
+
+ /*
* pthread.h on AIX 4.3.3 tries to define a macro without whitspace
* which violates a requirement of ISO C.
*/
David