* [Build failure] chartset.c build failure: iconv 2nd argument type problem
@ 2009-03-23 16:04 Pierre Muller
2009-03-23 16:10 ` Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Pierre Muller @ 2009-03-23 16:04 UTC (permalink / raw)
To: gdb-patches; +Cc: tromey
Following a commit from:
Changes by: tromey@sourceware.org 2009-03-20 23:04:41
On cygwin, the current iconv function has a (const char **)
type for the second argument, whereas other implementations
seem to be using (char **) type.
This leads to a build error for the current sources.
I don't really know how to fix this issue:
1) Remove -Werror for charset.o target.
2) Enhance configure test for iconv so that it does
find out the exact type of that second argument
a set a ICONV_INBUF_TYPE macro for that type.
Tom, could you please take a look at this?
Pierre Muller
Pascal language support maintainer for GDB
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Build failure] chartset.c build failure: iconv 2nd argument type problem
2009-03-23 16:04 [Build failure] chartset.c build failure: iconv 2nd argument type problem Pierre Muller
@ 2009-03-23 16:10 ` Tom Tromey
2009-03-23 17:27 ` Pierre Muller
0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2009-03-23 16:10 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
>>>>> "Pierre" == Pierre Muller <muller@ics.u-strasbg.fr> writes:
Pierre> On cygwin, the current iconv function has a (const char **)
Pierre> type for the second argument, whereas other implementations
Pierre> seem to be using (char **) type.
Oops, I'm sorry about breaking the build for you.
Pierre> Tom, could you please take a look at this?
Please try the appended patch. If this works for you, I will check it
in.
Tom
diff --git a/gdb/charset.c b/gdb/charset.c
index 5efb849..3c56613 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -86,6 +86,9 @@
#undef iconv
#undef iconv_close
+#undef ICONV_CONST
+#define ICONV_CONST const
+
iconv_t
iconv_open (const char *to, const char *from)
{
@@ -109,7 +112,7 @@ iconv_close (iconv_t arg)
}
size_t
-iconv (iconv_t ucs_flag, char **inbuf, size_t *inbytesleft,
+iconv (iconv_t ucs_flag, const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
if (ucs_flag)
@@ -440,7 +443,7 @@ convert_between_encodings (const char *from, const char *to,
outp = obstack_base (output) + old_size;
outleft = space_request;
- r = iconv (desc, &inp, &inleft, &outp, &outleft);
+ r = iconv (desc, (ICONV_CONST char **) &inp, &inleft, &outp, &outleft);
/* Now make sure that the object on the obstack only includes
bytes we have converted. */
@@ -580,7 +583,8 @@ wchar_iterate (struct wchar_iterator *iter,
size_t num;
gdb_wchar_t result;
- size_t r = iconv (iter->desc, (char **) &iter->input, &iter->bytes,
+ size_t r = iconv (iter->desc,
+ (ICONV_CONST char **) &iter->input, &iter->bytes,
&outptr, &out_avail);
if (r == (size_t) -1)
{
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [Build failure] chartset.c build failure: iconv 2nd argument type problem
2009-03-23 16:10 ` Tom Tromey
@ 2009-03-23 17:27 ` Pierre Muller
2009-03-23 17:54 ` FYI: fix charset.c build failure Tom Tromey
0 siblings, 1 reply; 4+ messages in thread
From: Pierre Muller @ 2009-03-23 17:27 UTC (permalink / raw)
To: 'Tom Tromey'; +Cc: gdb-patches
Yes, it fixes the compilation failure for me,
thanks for the fact reaction.
Pierre Muller
Pascal language support maintainer for GDB
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Tom Tromey
> Envoyé : Monday, March 23, 2009 5:04 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [Build failure] chartset.c build failure: iconv 2nd
> argument type problem
>
> >>>>> "Pierre" == Pierre Muller <muller@ics.u-strasbg.fr> writes:
>
> Pierre> On cygwin, the current iconv function has a (const char **)
> Pierre> type for the second argument, whereas other implementations
> Pierre> seem to be using (char **) type.
>
> Oops, I'm sorry about breaking the build for you.
>
> Pierre> Tom, could you please take a look at this?
>
> Please try the appended patch. If this works for you, I will check it
> in.
>
> Tom
>
> diff --git a/gdb/charset.c b/gdb/charset.c
> index 5efb849..3c56613 100644
> --- a/gdb/charset.c
> +++ b/gdb/charset.c
> @@ -86,6 +86,9 @@
> #undef iconv
> #undef iconv_close
>
> +#undef ICONV_CONST
> +#define ICONV_CONST const
> +
> iconv_t
> iconv_open (const char *to, const char *from)
> {
> @@ -109,7 +112,7 @@ iconv_close (iconv_t arg)
> }
>
> size_t
> -iconv (iconv_t ucs_flag, char **inbuf, size_t *inbytesleft,
> +iconv (iconv_t ucs_flag, const char **inbuf, size_t *inbytesleft,
> char **outbuf, size_t *outbytesleft)
> {
> if (ucs_flag)
> @@ -440,7 +443,7 @@ convert_between_encodings (const char *from, const
> char *to,
> outp = obstack_base (output) + old_size;
> outleft = space_request;
>
> - r = iconv (desc, &inp, &inleft, &outp, &outleft);
> + r = iconv (desc, (ICONV_CONST char **) &inp, &inleft, &outp,
> &outleft);
>
> /* Now make sure that the object on the obstack only includes
> bytes we have converted. */
> @@ -580,7 +583,8 @@ wchar_iterate (struct wchar_iterator *iter,
> size_t num;
> gdb_wchar_t result;
>
> - size_t r = iconv (iter->desc, (char **) &iter->input, &iter-
> >bytes,
> + size_t r = iconv (iter->desc,
> + (ICONV_CONST char **) &iter->input, &iter->bytes,
> &outptr, &out_avail);
> if (r == (size_t) -1)
> {
^ permalink raw reply [flat|nested] 4+ messages in thread
* FYI: fix charset.c build failure
2009-03-23 17:27 ` Pierre Muller
@ 2009-03-23 17:54 ` Tom Tromey
0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2009-03-23 17:54 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
>>>>> "Pierre" == Pierre Muller <muller@ics.u-strasbg.fr> writes:
Pierre> Yes, it fixes the compilation failure for me,
Pierre> thanks for the fact reaction.
Thanks.
Here's the patch I am committing, with a ChangeLog entry.
Tom
2009-03-23 Tom Tromey <tromey@redhat.com>
* charset.c (ICONV_CONST) <PHONY_ICONV>: Define.
(iconv): Make 'inbuf' argument const.
(convert_between_encodings): Use ICONV_CONST.
(wchar_iterate): Likewise.
Index: charset.c
===================================================================
RCS file: /cvs/src/src/gdb/charset.c,v
retrieving revision 1.17
diff -u -r1.17 charset.c
--- charset.c 20 Mar 2009 23:04:30 -0000 1.17
+++ charset.c 23 Mar 2009 17:32:00 -0000
@@ -86,6 +86,9 @@
#undef iconv
#undef iconv_close
+#undef ICONV_CONST
+#define ICONV_CONST const
+
iconv_t
iconv_open (const char *to, const char *from)
{
@@ -109,7 +112,7 @@
}
size_t
-iconv (iconv_t ucs_flag, char **inbuf, size_t *inbytesleft,
+iconv (iconv_t ucs_flag, const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
if (ucs_flag)
@@ -440,7 +443,7 @@
outp = obstack_base (output) + old_size;
outleft = space_request;
- r = iconv (desc, &inp, &inleft, &outp, &outleft);
+ r = iconv (desc, (ICONV_CONST char **) &inp, &inleft, &outp, &outleft);
/* Now make sure that the object on the obstack only includes
bytes we have converted. */
@@ -580,7 +583,8 @@
size_t num;
gdb_wchar_t result;
- size_t r = iconv (iter->desc, (char **) &iter->input, &iter->bytes,
+ size_t r = iconv (iter->desc,
+ (ICONV_CONST char **) &iter->input, &iter->bytes,
&outptr, &out_avail);
if (r == (size_t) -1)
{
Index: dwarf2expr.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2expr.c,v
retrieving revision 1.29
diff -u -r1.29 dwarf2expr.c
--- dwarf2expr.c 3 Jan 2009 05:57:51 -0000 1.29
+++ dwarf2expr.c 23 Mar 2009 17:32:00 -0000
@@ -746,7 +746,7 @@
case DW_OP_GNU_uninit:
if (op_ptr != op_end)
- error (_("DWARF-2 expression error: DW_OP_GNU_unint must always "
+ error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always "
"be the very last op."));
ctx->initialized = 0;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-23 17:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-23 16:04 [Build failure] chartset.c build failure: iconv 2nd argument type problem Pierre Muller
2009-03-23 16:10 ` Tom Tromey
2009-03-23 17:27 ` Pierre Muller
2009-03-23 17:54 ` FYI: fix charset.c build failure Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox