This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: PATCH: Fix libcpp configury/portability issue


On Sat, 30 Oct 2004, Zack Weinberg wrote:
Hmm. I think I'd prefer

#ifndef HAVE_ICONV_H
#undef HAVE_ICONV
#endif

#ifdef HAVE_ICONV
#include <iconv.h>
#else
#define HAVE_ICONV 0
...
#endif

Thy shallst not lie to your compiler. :-/


I tried to implement your suggestion with the patch below, and it works on SUSE Linux 9.1 (i386), but fails on i386-unknown-freebsd4.10:

/sw/test/gcc/cvs/libcpp/charset.c:76:1: warning: "iconv_open" redefined
In file included from /sw/test/gcc/cvs/libcpp/internal.h:34,
                 from /sw/test/gcc/cvs/libcpp/charset.c:24:
/usr/local/include/iconv.h:70:1: warning: this is the location of the previous definition
/sw/test/gcc/cvs/libcpp/charset.c:77:1: warning: "iconv" redefined
/usr/local/include/iconv.h:80:1: warning: this is the location of the previous definition
/sw/test/gcc/cvs/libcpp/charset.c:78:1: warning: "iconv_close" redefined

The *real* problem, I assume, is that we have several config.h file in
the include path -- intl/config.h versus libcpp/config.h.

Gerald

2004-10-31  Gerald Pfeifer  <gerald@pfeifer.com>
            Zack Weinberg  <zack@codesourcery.com>

Index: internal.h
===================================================================
RCS file: /cvs/gcc/gcc/libcpp/internal.h,v
retrieving revision 1.7
diff -u -3 -p -r1.7 internal.h
--- internal.h	9 Sep 2004 19:16:55 -0000	1.7
+++ internal.h	31 Oct 2004 05:41:27 -0000
@@ -26,7 +26,11 @@ Foundation, 59 Temple Place - Suite 330,
 #include "symtab.h"
 #include "cpp-id-data.h"

-#if defined HAVE_ICONV_H && defined HAVE_ICONV
+#ifndef HAVE_ICONV_H
+#undef HAVE_ICONV
+#endif
+
+#ifdef HAVE_ICONV_H
 #include <iconv.h>
 #else
 #define HAVE_ICONV 0


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