This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] gdb: Fix phony iconv build;h=5562a44eb490b5777c9e786971907c0727d88495

commit 5562a44eb490b5777c9e786971907c0727d88495
Author: Pedro Alves <>
Date:   Mon Oct 17 17:13:26 2016 +0100

    gdb: Fix phony iconv build
    Cross building gdb for mingw32 on Fedora 23 fails with:
      x86_64-w64-mingw32-g++ -g -O2  [...]  ../../src/gdb/charset.c
      In file included from ../../src/gdb/charset.c:21:0:
      ../../src/gdb/charset.h:134:3: error: 'iconv_t' does not name a type
         iconv_t m_desc;
      ../../src/gdb/charset.c: In constructor 'wchar_iterator::wchar_iterator(const gdb_byte*, size_t, const char*, size_t)':
      ../../src/gdb/charset.c:600:3: error: 'm_desc' was not declared in this scope
         m_desc = iconv_open (INTERMEDIATE_ENCODING, charset);
      ../../src/gdb/charset.c: In destructor 'wchar_iterator::~wchar_iterator()':
      ../../src/gdb/charset.c:607:7: error: 'm_desc' was not declared in this scope
         if (m_desc != (iconv_t) -1)
      ../../src/gdb/charset.c: In member function 'int wchar_iterator::iterate(wchar_iterate_result*, gdb_wchar_t**, const gdb_byte**, size_t*)':
      ../../src/gdb/charset.c:633:25: error: 'm_desc' was not declared in this scope
    	 size_t r = iconv (m_desc, &inptr, &m_bytes, &outptr, &out_avail);
    This is a regression caused by commit cda6c55bd399 (Turn wchar
    iterator into a class).  The problem is that iconv_t is now exposed in
    gdb/charset.h, while before it was only used in gdb/charset.c.
    gdb/charset.c, under #ifdef PHONY_ICONV, does:
     #undef iconv_t
     #define iconv_t int
    So it seems the simplest is to use 'int' in the header file too.
    2016-10-17  Pedro Alves  <>
    	* charset.h (class wchar_iterator) [PHONY_ICONV] <m_desc>: Use
    	'int' as type.

 gdb/ChangeLog | 5 +++++
 gdb/charset.h | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4859e27..4ebbf8d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-17  Pedro Alves  <>
+	* charset.h (class wchar_iterator) [PHONY_ICONV] <m_desc>: Use
+	'int' as type.
 2016-10-14  Sangamesh Mallayya  <>
 	    Ulrich Weigand  <>
diff --git a/gdb/charset.h b/gdb/charset.h
index 64aa58d..c5feb08 100644
--- a/gdb/charset.h
+++ b/gdb/charset.h
@@ -131,7 +131,11 @@ class wchar_iterator
   /* The underlying iconv descriptor.  */
+  int m_desc;
   iconv_t m_desc;
   /* The input string.  This is updated as we convert characters.  */
   const gdb_byte *m_input;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]