This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Fix libcpp configury/portability issue
Gerald Pfeifer <gerald@pfeifer.com> writes:
> 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
Try again with the second #ifdef being HAVE_ICONV, *not* HAVE_ICONV_H.
> The *real* problem, I assume, is that we have several config.h file in
> the include path -- intl/config.h versus libcpp/config.h.
Yes. Maybe we should rename them so it's unambiguous.
zw